After assembling the hardware, it's time to get the firmware and configuration in place.
Initial install of sketch is via USB upload from Arduino IDE:
- Plug the USB cable in, look on Arduino IDE for which port has been assigned (under Tools -> Port) and select that port
- Open serial monitor window
- Upload in Arduino IDE
- Hold down "Flash" button and tap "Reset" - keep "Flash" button held down until blue LED flashes and progress display in Arduino IDE shows the upload is in progress - can release "Flash" button then during upload.
- After upload finishes, node will reboot itself. Do "tail -f /var/log/nginx/error.log". When the firmware checks for new sketch and spiffs, it will generate an error as the MAC address hasn't been associated with anything in the server side scripts. The error includes the MAC address - copy that to clipboard
- emacs /var/www/html/tempnode/sketch.php and add new entry in the initialization of the $db array for this MAC address pointing it to a specific sketch (for now I've got one sketch for temp nodes and one for the thermostat)
- emacs /var/www/html/tempnode/spiffs.php and add new entry in the initialization of the $db array for this MAC address pointing it to a specific configuration spiffs file. This file doesn't exist yet, next steps will define it.
- emacs /var/www/html/tempnode/spiffs/Makefile and a new macro for the base directory for this new node, add a new file section, add it to the all and version dependencies
- Copy ~/esp/home-env/tempnodes/data/office to ~/esp/home-env/tempnodes/data/newnode
- Within ~/esp/home-env/tempnodes/data/newnode edit the version.dat, node.txt, mquser.txt, mqpass.txt, mqhumtop.txt, mqpsitop.txt, mqtmptop.txt
- Now that the source directory for spiffs is configured, go to /var/www/html/tempnode/spiffs/ and do make
- Reboot new node to get it to load spiffs (the sketch will be the same version that was already uploaded) and confirm on OLED that the node name is picked up from spiffs configuration
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.