The OpenSprinkler USB-Serial Programmer is a handy tool for uploading firmware to OpenSprinkler, OpenGarage, and RFToy via USB. It's also useful for displaying serial debugging messages.
Step 1: Hardware
The programmer is based on the CH340 USB-serial chip, and has a microUSB connector, as well as a card edge connector that can directly plug into the OpenSprinkler devices, as shown below. The orientation is that the top/chip side of the programmer should align with the top/chip side as the device being programmed.
On the top side, the three pins on the card edge connector are TX (device side), +5V, GPIO0, and the bottom three pins are RX (device side), GND, RST/EN.
Step 2: CH340 Driver
Plug in a microUSB cable connected to your computer. It functions as a USB-Serial device and therefore should show up as a serial port. Depending on your operating system, you may need to install the CH340 driver:
- On Windows: generally no need to install driver, unless you use Windows XP or Win 7 64-bit, in which case you should install the CH340 Windows driver. Once done, the programmer should show up as a serial port named COM?? where ?? is a number. You can go to Device Manager to find out the COM port number.
- On Mac: install the CH340 Mac driver. You will probably need to go to System Preferences -> Security and Privacy and allow App Store and identified developers. Reboot your Mac after the driver installation. Once done, the programmer should show up as a serial port named /dev/tty.wchusbserial?? where ?? is a number. You can run
ls /dev/tty.wch* in Terminal to find out the specific number. - On Linux: generally no need to install driver, but due to USB permission, you need to either run programs as root or sudo, or add the USB device ID to rules.d so you can run programs as regular user. Once done, the programmer should show up as a serial port named /dev/ttyUSB? where ? is a number. You can run
ls /dev/ttyUSB* in Terminal to find out the specific number.
Below is a quick summary:
Operating System | Driver needed? | Serial Port Name | Find Serial Port |
Windows | No, except Windows XP & 7 64-bit | COM?? | Device Manager |
Mac | Yes | /dev/tty.wchusbserial?? | ls /dev/tty.wch* |
Linux | No | /dev/ttyUSB? | ls /dev/ttyUSB* |
If you run into troubles, you can google 'CH340 driver' and there are plenty of information online. For example, SparkFun provides detailed instructions on how to install CH340 driver.
Step 3: Upload Firmware
If use VSCode to compile firmware, as in our default firmware compilation instructions, you can directly upload a firmware in VSCode, by clicking the Upload button as shown below. It auto-detects the serial port, or you can specify the specific serial port in platformio.ini.If you want to upload a already-compiled firmware (.bin file), you can use the the command line tool esptool, or GUI NodeMcu flasher.
Step 4: Checking Debug Messages
In VSCode, you can click the Serial Monitor button to open a serial console which displays serial debugging messages. By default, the baud rate is 115200 bps.
There are also many standalone Serial tools you can use, such as the serial monitor in Arduino (cross-platform), putty on Windows, screen on Mac, gtkterm on Linux.