Creating Smart Devices with Circuit Playground and AWS

One of the biggest motivators behind creating Jenius was having the ability to experiment with different ideas to create innovative products. It’s an understatement when I say that I love to make things. More than that, I love to merge various technologies to create something different. Hence I explored taking something as simple as a coaster and making it “smart.”

The Idea

I don’t have any coasters in my apartment, and all of my furniture is white. It only made sense for me to 3D print a coaster. However, if you know me, you know that I can’t just make a simple coaster, it has to have some tech inside of it. Immediately, I thought about what action I wanted my coaster to perform. Do I want it to text me if my drink moves? Do I want to place an actuator inside so that it raises in height? No. I decided that I wanted my coaster to tell me how cold or hot my drink is and also let me know when it’s reached the optimal level of drinking temperature.

3D Design

Upon deciding on my idea, I fired up Fusion 360 to begin designing my product. When it came to deciding on a shape, I wanted to stick with the traditional circular coaster style. On the outside, I wanted to include the Jenius logo (designed by yours truly) to give it a finished look. To accomplish this, I took my logo from Adobe Illustrator and exported it as a regular SVG. In Fusion 360, you can import SVGs into your 3D designs by clicking the insert symbol on the right side of the main toolbar. From there, you extrude and move as necessary.

Inside, I knew that I was going utilize the circuit playground board (I’ll talk more about this soon) and that I needed to create a fixture to hold the circuit.

AWS Polly

My smart coaster needed a voice, and Amazon has done a great job creating lifelike voices with their Amazon Polly text to speech service. You need an AWS account to use Amazon Polly, but it has a free tier, which allows you to text to speech for 5 million characters per month for a year. Please read more at https://aws.amazon.com/polly/pricing/

On the main page of Amazon Polly, I inserted the text I wanted my coaster to play when I interacted with it. After choosing a voice that I liked, I saved the MP3.

The Circuit

I’m a massive fan of Adafruit.com and their boards. One of my favorite circuit boards developed by Adafruit is the Circuit Playground. It has every sensor one would need to create something unique, and it’s easy to program. I knew that the board had a temperature sensor, an accelerometer, and a speaker, which are things I needed to make the smart coaster project successful. 

Another cool thing about Circuit Playground is that you can program it in multiple ways. You can program the board with Arduino, Circuit Python, or even Microsoft Make Code. Because I wanted to play audio files, I decided to use Circuit Python. I highly recommend following the “CircuitPython Made Easy on Circuit Playground Express” by Adafruit to get started. This guide walks you through how to setup your Circuit Playground for Circuit Python code.  

I also recommend following Adafruit’s Microcontroller Compatible Audio File Conversion guide as the Circuit Playground cannot play MP3s. All MP3s must be converted to PCM 16-bit Mono WAV files before using it in the code. 

The Code

After installing the Mu Editor and connecting my python ready Circut Playground to my computer, I was able to create code for my new device.

The first thing I did was create a conditional statement using the accelerometer to check for any light shakes to the coaster. Upon a shake, the coaster will play a welcome message with instructions as illustrated in the above video. The next thing I did was print the current temperature with the circuit inside of the coaster. 

Once I had an idea of the current temperature, I then decided to create a conditional statement to check for any significant drops to the current temperature by manually checking for temperatures that went below a certain degree. Once the board detects that the temperature has dropped beyond the number provided, it will play a sound stating that it detects a cold beverage.

I created another conditional statement to look for temperature increases using the same method as above. I created one last conditional statement to look for a specific temperature that I felt comfortable drinking from and saved my code to code.py on the Circuit Playground. Viola! I completed my smart coaster project.

Considerations

It took a few minutes for my coaster to detect a cold or hot beverage. This can be fixed by choosing a temperature that is slightly (a few decimals) lower or higher than your current temperature instead of whole numbers.