Cheap Yellow Hotspot/CYH+

At races or other outdoor events, you seldom have access to a wifi network you can use for connecting your devices to each other. To connect between the YamuraLog control and the device I’m viewing the files on, I needed wifi to connect the logger control to the tablet/laptop used to view the files so I could transfer files with FTP. An ESP32 in Station mode can provide a hotspot anywhere that will let me do exactly that.

An ESP32 in Station mode provides an ad-hoc Wifi network. You could do this with a bare ESP32 connected to a device with a USB cable for power, but I had an ESP32 Cheap Yellow Display on my desk, and I’d already designed the 4 AA battery box for power so I used those to make a battery powered portable hotspot. It’s useful to see how many connections there are to the network, and to have a reminder of the hotspot username and password. The case contains 4 AA batteries, the RTC module, a power switch, and the cheap yellow display module.

Parts and Tools

This is an easy project, only a few solder joints required. Easily done on a weekend morning. Total cost is around $25.00.

3D printer that can print PETG. This is better for pieces intended for outdoor use than PLA. Takes about 12 hours to print the box, box top, battery compartment and battery cover on my Elegoo Centauri Carbon 2.

DIYMalls 2.8″ ESP32-2432SO8R $15.00 (sold in packs of 2 for $30)

PCF8563 Real Time Clock $1.66 (sold in packs of 6 for $9.99)

Power switch $0.89 (sold in packs of 10 for $8.99)

Schottky diode 1A 20V reverse polarity protection $0.05 (pack of 125 for $5.99)

10 2-56 threaded brass inserts very useful for assembling 3D printed parts $1.80 (pack of 50 for $9.00)

10 2-56 x 1/4″ socket head screws $0.99 (pack of 100 for $9.84)

10 #2 washers $0.38 (pack of 100 for $3.71)

2 4-pin JST 1.25mm female connector $1.00 (pack of 20 male/female pairs for $9.99). Check your Cheap Yellow Display board, some come with 1 or 2 of these connectors

Battery terminals $2.80 (need 4 pairs, sold in pack of 10 for $6.99) For the 4 battery box.

100K, 150K resistors

100nF capacitor

Soldering iron and solder

3D printer and PETG filament for printing box and battery holder.

Soldering iron tips for heat set inserts $16 Optional. You can push the inserts into the 3D printed parts with a standard solder tip. I wouldn’t use the one you use for soldering though. These tips make it easier to set the inserts so if you’re going to do this frequently it’s a good investment.

Heat shrink tube.

All current code and files for 3D printing the case and battery holder are on Github – Yamura CYH+. Code is for Visual Studio Code PlatformIO, so you will need to download the IDE from here. This can be built in the Arduino IDE too. I’m migrating all of my active projects from Arduino to Visual Studio Code and starting any new projects in Visual Studio Code – I like the IDE better.

For either IDE, install the Bodmer TFT_eSPI and Adafruit RTCLib libraries.

Notes

There’s always some feature creep. after starting with a bare ESP32, I added a battery box, case and switch. Then I wanted an accurate clock on the hotspot to act as an NTP server for the data logger. I also added a section of code to get time from a real NTP server by connecting to a known network connected to the internet – this sets the RTC after the battery is replaced or the first time it’s powered on.

At first the plan was to modify the logger code to get time from the hotspot on boot. When I thought about how often the logger boots at the track (every time the car starts) that seemed like too much waiting around for a wifi connection just to get the time when I may want to start logging data right away. When I realized I have a different time source for the logger – the GPS – I decided to use that to set the time. So I didn’t need to get time from the hotspot and the feature creep of adding an RTC to the hotspot was really not needed after all. But the RTC is nice to have on the hotspot, and may it come in handy for other devices that I connect to the hotspot.

I also changed the code to start IP addresses assigned by the DHCP server on the ESP32 to connecting devices at 192.168.4.3. The IP of the hotspot is 192.168.4.1. This left 192.168.4.2 free so I could have the FTP server device always connect as 192.168.4.2. This makes life easier for the data logger control – it always knows to connect to the hotspot, and the FTP server is always going to be at 192.168.4.2. I ran into issues at the track when devices connected and disconnected and the logger couldn’t find the FTP server. This solves that problem.

Rabbit Hole!

I’m not an electrical engineer, I got into hardware when the first Arduinos and shields came out. Making the hardware plug and play made it possible to build functional hardware without knowing all the details of the electronics behind it. I’ve learned more about hardware as I’ve built projects, but sometimes things still catch me out. Probably more often I just completely miss things that a EE would laugh at, but everything works eventually, if not in the most efficient way.

This rabbit hole started when I added a battery level display to the CYH+. This is something I’ve wanted to do for this project and the Tire Pyrometer project for a while. The last thing I want at an event is to have batteries die without warning. OK, maybe not the last thing given all the things that can go wrong at a race, but it’s annoying. It’s fairly simple, just a voltage divider read by an ADC port on the CYD. With some help from Claude about battery chemistry, brownout levels and what the ADC value actually means, this was fairly easy to add and looks great.

The rabbit hole is reverse polarity protection. I learned back in high school that a diode immediately after the battery pack can protect against reverse polarity, so if the user puts the batteries in backwards the magic smoke doesn’t come out of the CYD. What I didn’t consider is forward voltage drop – I just though of the diode as a one way door with no resistance. So when the battery voltage on the display was lower than the value shown on my trusty multimeter, I started digging into it. The Schottky diode I’m using has around 0.7V voltage drop, pretty much the difference I was seeing between the display and the meter. I can live with this for now, just means I will be swapping batteries before they are truly dead. I use rechargeables, so not a huge deal. I will be investigating ‘ideal diode’ protection that does the same job with a much smaller voltage drop. For now, assembly will show the voltage divider with the Schottky for reverse polarity protection.

Assembly

As always, I start on a breadboard. Feature creep in full display – this started with a single connection to the Cheap Yellow Display for power, and a diode between the battery box and the board for polarity protection. Now there’s the RTC module (upper left) and the voltage divider for battery level (upper right). It’s a bit disturbing that the colors don’t match my conventions – red VCC, black GND, yellow I2C SCL, blue I2C SDA – but I’ll get over it. Does make me triple check the connections though.

Connections:

Upper right – Voltage divider to IO35. Other pins are not connected

Middle right (next to LED1 and microSD slot) – I2C connection to RTC. 3.3V and GND to VIN and GND on RTC. IO22 is SDA, IO27 is SCL

Bottom (next to USB connectors) – VIN from diode, and GND from battery pack. Other pins not connected.

Code

Stay tuned!

Using the CYH+

Stay tuned!

Leave a Reply

Your email address will not be published. Required fields are marked *