Merry Christmas!

The PCBs came in today, they look great.  Of course I will need to make the modifications I mentioned last week.  I haven’t received the CH340G chips yet. I will wait until I receive them before I start building.


This week, I wanted to add  a slider to set the Sigma Delta output that drives the voltage booster to the web interface.  I didn’t know javascript at all so, I went to an online tutorial at This tutorial is very basic and even explains the basic concepts of programming in general.  I didn’t learn enough to set up a slider, I did learn enough to do some testing.

I quickly got the Sigma Delta output working in GPIO12 by copying the necessary code from the test project I was using. I then added a call to config_sigma_delta() from user_init() in user_main.c.  I also added a call to set_sigma_delta_duty() from my test code in cgi_relay.c.  Of course I added includes to sigma_delta.h in both of those files.  I then changed the Sigma Delta output from GPIO12 to GPIO4 to match the HV_pulse line used to run the switched coil.

Now if I hit the say Hello button, It changes the Sigma Delta output duty cycle. also, the Chart on the index.html page gives the current reading from the ADC once every 5 seconds.



Web Server feature customization

I found out why my URLs without .html on the end weren’t being handled the same as the rest.  There is an array defined in app.c that maps URL paths to alternate paths.

URLsI haven’t found the code that uses this yet, but it seems pretty straight forward what this is used for.

In the function init_http_server in app.c I found several functions that I think I don’t want.  I put a // at the beginning of those lines so that the compiler treats those lines of code as comments.  This is called “commenting out”.  This is useful when removing code that you suspect has an error, or , as in this case, I suspect I can remove.

I don’t need the captive portal. I am happy if users can use the IP address to get to the web server.  Having a domain name and using the web server from within a local network complicates things.

I commented out the lines:

    http_server_bind_urls((http_server_url *)&api_urls);

I compiled with these changes, “crossed my fingers”, and uploaded. And… I got a continuous stream of reboots with messages coming into the serial terminal program at 115,200.  this means it started the code that initializes the UART and failed some time after that.

Backing up, I uncommented the server_bind lines and again tested on my board. I am able to connect to the Access Point with my android phone. When I point my phone browser to, I get an empty page. When I point my desktop browser to the assigned network address, I also get a blank page from the server.  When I point either browser to they both load the initial webpage.

I decided to do a hello world cgi function trying to understand how things work.  To the api_urls I added an entry pointing to a new function called http_tst_api_hello.  I then added that function to the cgirelay.c and cgirelay.h files.  The new function will send “Hello World” out on the serial port using the DBG macro.  The new button shows up on the page, but doesn’t appear to do anything except cause a jump to the top of the page.

I don’t know Javascript, CSS and only a little bit of HTML, this part is going to be a challenge. I did finally get what I was trying to do.  Seems like a small step, but it took a lot of studying and tinkering.

I am not putting any of this code up on github, because I am only taking steps to learn how things work. When I start building in real functionality, then I will start putting this code on github.

Web Page Hello World

Serial Hello World

First web page

I have the web server up and running which is great.

While reviewing my design, I found a few mistakes in the layout.  These mistakes are easily fixed with either a jumper wire or solder bridge, so I can keep on testing when the new PCBs arrive.

The web server isn’t working as easily as I had hoped.  I made a copy of the cats web page in the project, added my banner photo from this site and added html links in each page to point to the new page. With my picture added, It wouldn’t compile.  I am sure there is enough room in ROM, so I just need to figure out some settings. I removed the picture from the project and it compiles. I added an entry in my hosts file to point to When I go to on my network it seems to work most of the time.  Speed and reliability will need to be worked on.

My new page unfortunately comes up blank. If I add .html to the end of the url my page loads correctly.  I went through the pages and added the .html ending to each link.  I don’t understand why this is happening this way.

I opened and modified the  I changed the irom_0_seg  line. I changed the len value from 0x51000 to 0x80000.  This allowed me to add the banner photo into the project.  I don’t know if this can cause problems.  Assuming the value was at 0x51000 for a reason gives me reason to be concerned about it.  It’s possible that I have allowed data to overlap which could cause major problems. I need to learn how the .ld linker files work.


Web Server firmware

I am waiting on the stuff I ordered last week.  The CH340G chips are probably going to take the longest at 3 to 4 weeks.

To start with I updated my virtual machine to keep it current, I downloaded V1.5.0 of the Espressif SDK, and updated the lubuntu inside of the virtual machine.

I spent this week trying to get the chip running as a web server.  On the ESP8266 forum I found about a project called esp-ginx.  It is a web server with a lot of features.  For me it looks like a lot more than I need.  This is good for this design, I can cut away or ignore the features that I won’t be using or needed.

I downloaded the zip from github.  I ran make from the wrong directory and it failed to compile.  Finally realizing I need to run make from the project directory I was able to get it to compile without any errors.  I then uploaded it to my board and it didn’t work.  I was continuously getting fatal exception (0) on the serial port at 74800 baud.  Thinking that my RAM chip might be causing problems, I decided to remove it and try again.  Still no success.

I then tried to load the code into the NodeMCU board that I also use for testing. I got the same results with it.  I re-loaded my code into my board and got it back to working.  After many tries I finally realized tried putting the app folder in my home directory without any of the SDK files and it compiled.  I loaded this to my board with the commands: make clean, make html, make, and make flash.  The virtual machine had crashed and I needed to reboot my whole system before this worked for me.

This has been very frustrating just to find out that I didn’t understand the way to set up my files.  After I got the web server up and running, I added an entry to my hosts file on my computer.  I made an entry that pointed to he ip address of the board and associated it with