So, the idea of streaming the RC2014 to the internet had been rattling around in my head for a while, but I’d never quite worked out how the software side of things would work. Although the hardware side should be kind of straightforward, with my software skills, I need to find something I can copy & paste. A couple of days ago I just happened to put the right search terms in to Google and it gave a result that looked like it would do want I wanted. So, with that, my plan for Retro Challenge took shape!
A couple of years ago I played around with some EPS8266 Wifi Modules, but never really found a use for them. However, for this, they would be ideal. The code I had found was a Web Sockets Serial Monitor designed specifically to run on an ESP8266, so I decided to test it out just to check that it did what I expected it would.
Several hours later, it did! Those hours, however, were spent trying to remember how to program these things. My desktop machine didn’t have any of the ESP stuff in the Arduino IDE, but luckily, I still have my old laptop that I used a couple of years ago. Despite getting all the right libraries, it just wouldn’t compile. So, on to the new laptop, with a fresh Arduino IDE and all the ESP stuff and libraries, and it compiles. Getting it to upload, however, was another challenge which actually involved burning myself on the USB to serial adapter at one point! It turns out that of the two I tried, one of them was dead, and the other one spammed my Twitter account ever time it’s turned on (I didn’t know this until checking Twitter later… what! 86 new mentions!). It also turns out they need more power than the adapter can supply. And, in order to program them, the ESP needs to be pushed in to the adapter really really really hard!
The programming jig wasn’t really suitable for testing things out, so time to transfer this to a prototype board. But first, lets work out a circuit! The programming jig has the necessary support components and minimal connections, so that’s a good start. The ESP works on 3v3, so I’m going to need a regulator to drop the 5v down. And the Rx pin is only 3v3 tolerant, so a couple of resistors as a voltage divider will work fine as a level shift here. The Tx pin won’t be connecting to the RC2014, although even if it was needed, 3v3 is sufficient enough to work. GPIO0 is used to either put the ESP in to programming mode or run mode. 2 of the other GPIO pins (15 and 2) were tide to ground and 3v3 respectively on the programming jig. I can’t remember why I did that, but that won’t be needed for this board.
Before hooking up the ESP to the power rails, I checked that the regulator I used (spare one I had lying around) did it’s job. Yup, 3.299v, close enough! On with adding the rest of the stuff.
So, from left to right, we’ve got a connector for 3v3 so it can be powered directly if needed (or use 3v3 elsewhere), and an FTDI header for my 3v3 adapter so the ESP can be reprogrammed. Then there’s a reset button, the 3v3 regulator and caps, then the ESP itself. There’s a 10k pull up resistor on the reset pin, and a program/run jumper below the ESP. As yet, the resistor divider for the Rx pin aren’t fitted. But it should power up and work just as it did in the jig, right?
Ummm… no. Regardless if I used the power regulator, or fed 3v3 in directly, out of the serial header all I got was gibberish. It was consistent gibberish, but not something I could make any sense of. Maybe I damaged the ESP when soldering the wires on? Hmmmm… maybe I should program another one just in case. Well, long story short, it needs GPIO15 connected to ground to work! I can’t see any logic why this would need to be the case, but, whatever, it works now.
I needed to add a rule on the firewall to allow port 81 through to the IP address of the ESP, and after that, I could connect from the outside world and see what my RC2014 was saying!
Things work pretty well, although there’s some kind of issue with carriage returns and/or linefeeds that’s causing some stuff to be dropped, but that’s enough success for one day. We’ll sort that out tomorrow!