This project is an improvement to Skydive Auto Reminder - Meow Call; therefore, being familiar with that project is a prerequisite.
I always thought makers, myself included, over design projects because that is the cheaper, easier, and dare I say, lazy way to go. Blinking a light is one step in learning Raspberry Pi, but that Single Board Computer is capable of doing a lot more. When I made Consuela, I could've just used a Raspberry Pi with a voice HAT/Bonnet. I only used Spresense because it was given to me for free by Sony to participate in Make It Better contest which I did ended up winning, but not with Consuela. Adafruit featured that project on their blog which was flattering and embarrassing at the same time.
Today is Redemption Day.
Meet Julie, the younger more efficient version of Consuela. Julie is the combination of my two favorite boards Sony Spresense and ESP8266. Obviously, neither board is capable of handling a web browser; let alone Selenium. Nonetheless, ESP8266 will make HTTP calls and receive responses to process before sending them to Spresense to vocalize.
Hardware5 Volt and ground pins of both boards should be connected together. Tx pin of ESP8266 needs to be connected to Rx pin of Spresense. Power can be supplied to either board for operation, but each board will have to get its own code separately via its micro USB port. Micro SD card needs to be setup and audio files loaded as explained in the previous tutorial.
Studying The PageBefore we get into Arduino IDE, we need to understand how the web browser (which Julie doesn't have) acquires data to display on the page. We know it's not a simple HTTP GET request because Consuela had to use Selenium to obtain load clock data.
Please note the page you're interested in might look a lot different. However, finding the solution should be a similar approach to the following:
Open the Drop Zone (DZ) page and click Ctrl+Shift+I. Click on the Network tab then filter by clicking on XHR.
We're only interested in the first three lines starting with "?EIO=3" ("&t=....." can be removed). The first call is to get SID to be used in subsequent calls. The second call is HTTP POST to subscribe to announcements. The last call is to receive the data.
Arduino IDEAs you may have seen in my recent projects, I started combining sketches of the same project in one.ino file. In this project, the top part of the sketch is very similar to the sketch used by Consuela with few modification such as baud rate, and of course, Julie has to sound different when starting. I also had to switch to Serial2 instead of Serial because we are no longer using USB port.
As for the bottom part of the sketch, ESP8266 needs to connect to WiFi then make the three calls we discussed above. Once we receive the response, we can parse it for the data we need. When the time is right, data will be sent to Spresense at the same baud rate as above.
ConclusionAlthough ESP8866 on its own can play audio, we needed to use Spresense to save all the required files (as audio not HEX), and have better audio quality. So, if you don't have Sony Spresense, I would highly recommend getting one, but if you can't, this project could be made with only ESP8266.
One of the advantages Julie has over Consuela is power up / shutdown. No Operating System booting means faster to get online and safer to get off fast. If you recall at the end of Consuela's project, the DZ decided to change page layout. When we scrape data from the web, changing the page layout often require rewriting the code to get the data. However, HTTP calls are less likely to change which means better code longevity.
Julie is here to stay.
Demo
Comments