Final Project Video

ESE 190 Final Project Video

Project Description

The project is a modified Billy Bass that will be connected to an Amazon Alexa. Using an Arduino motor shield, we will configure the fish to open and close its mouth in sync with the Alexa's sound output. In addition to the Alexa capabilities, we will reading basic environmental characteristics using temperature and humidity sensors. The temperature sensor and humidity sensor will publish data to Thingspeak, from which the data will be read using an Alexa skill. The bulk work for this project will be centered around figuring out how to transform sound input from Alexa to motor output on the Billy Bass.

Project Write-Up

Changes Made: We were not able to get hold of a Billy Bass in time. As a result, we made a fish-shaped mount using the laser cutters that utilized the servo provided in the kits, and which included LEDs for the eye and environmental lighting. Additionally, we made a laser-cut housing for the electronics to improve the look of the project. We also encountered difficulties with Thingspeak’s high update timeout, and ended up making a dedicated server without this bottleneck.

Software: All relevant code (for Arduino, serial reader, Alexa skill, and IoT server can be found here:

Since we had to use a servo to move the fish mouth, we had to find a way to interpret audio signals (from input) and convert it to a server output in a non-blocking manner. Audio signals were gathered from a breadboard 3.5mm headphone jack audio-in component and analog signals were read every loop cycle. Upon 20 milliseconds finishing, we updated the servo position to an “open” position when the audio signal surpassed a specific threshold (of 15 mV) and closed to a “closed” position otherwise. To avoid halting the system with a delay(x) call, a timeout counter was used to achieve the intended effect. A red LED (corresponding to the fish eye) was also triggered on and off according to the state of the servo (open/closed respectively).

For one of our IoT sensors we used the light sensor. The wiring was similar to what was done during class; however, the current draw from the servo motor caused our light sensor values to spike if the servo motor turned on. In order to prevent erratic readings from being published to our server, we implemented a “running average” light sensor value calculation to smooth the light sensor value readings.

The other sensor was a DHT11 Humidity and Temperature sensor. Since the DHT11 library was not compatible with the version of the Arduino we had (had not been updated since 1.5.x, we were on 1.8.x), we hardcoded some of the necessary functions to read off data from the sensor (which relied on a separate buffer read system rather than a simple analogRead call).

IoT: Our Arduino Uno WiFi we had often failed to connect to the network and, if it did, would often stop publishing data randomly. In order to create a more reliable means by which to publish data to our server (which would later be pinged by the Alexa skill), we made a serial reader script that would pull data off of the Arduino Serial channel (9600 Baud). This script was implemented on python and would automatically determine when a USB serial device was connected to the computer. Upon connection, it would read data every second and publish data to our custom IoT server.

IoT Server: Since Thingspeak’s write data rate limit was detrimental to debugging (and would often lock out further POST requests if multiple requests from a single IP were published to it), we decided to create a simple node app to handle our IoT data (to avoid any POST and GET restrictions). The app implements two routes: /update and /getData which update the current sensor values and send back the current sensor values published to it (respectively). This server was deployed to heroku. Since the only data needed was the most recent sensor readings, the data was kept in memory (which has a small disadvantage of being reset upon server restart, but this shortcoming wasn’t too bad for us).

Alexa Skill: In order for us to communicate sensor data values to users of the Billy Bass Fish, we created an Amazon Alexa Skill to allow users to query for the current temperature, humidity, and light sensor values. These values correspond to the ones published to our IoT server by our serial reader script. The Alexa skill was easy to implement as there were only 3 additional “intents” that needed to be made. The harder issue; however, was establishing the correct server side permissions to allow Alexa to get data from our server; however, once this hurdle was passed, it was just a matter of learning Alexa’s specific “Intent-Dialog flow” and establishing appropriate prompts to the user. The ultimate behavior we achieved was allowing the user to say “Alexa, ask Billy Bass Fish what is the weather/light levels/humidity” and Alexa being able to respond with the appropriate values.

Overall Information flow: To recap our information flow: Data from the sensors is captured by the Arduino and published to the Serial Channel (baud 9600). Our serial-reader script allowed us to read the serial channel and publish data to our IoT Server. Alexa, upon asking a user “Alexa, ask Billy Bass Fish what is the weather / light / humidity?”, would query our IoT server for the appropriate data and respond back to the user (via the Alexa), which would also trigger the servo to move.

Fish and Electronics Housing: All parts were CAD’ed in Solidworks, and cut from MDF & acrylic in the RPL, and assembled with a mix of hot glue, press fits, and screws. The servo was mounted with screws, and the separate jaw attached with hot glue. Both the eye and background LEDs were soldered in parallel, and attached variously. The electronics housing included holes for cabling and the sensors.

While the further applications of a novelty fish thermostat are ... limited, there are a number of technical improvements that could be made with more time. The fish currently requires an external speaker, power source, and audio connection, and it would be good to integrate these features into potential future builds. Also, the servo used has a ~20 ms delay, which a different choice of servo might fix.

Updated Parts List

  • Fish: 1/4" Acrylic and MDF, screws, hot glue, LEDs
  • Amazon Alexa
  • Arduino WIFI Board
  • Small rechargeable speaker
  • Light sensor
  • DHT11 Humidity and Temperature sensor
  • Low-profile panel jack
  • Wall adapter power cable for Arduino
  • Audio extension and splitter cables

Built With

Share this project: