The Scent-terrific Smart Candle is a smart lighting and aromatherapy system for the home or office.
- Scent-terrific Candles look like real candles because they are real candles.
- They smell like real candles because a wax melter is built into the base.
- They flicker like real candles!
- They are even controllable with your Alexa device (find the skill in the Alexa Store).
I love smart lighting. I've got seven wall switches, a smart bulb, and a smart plug (connected to a lamp) in my home. I've even built my own smart lamp.
Unfortunately, I haven't found the same innovation when it comes to other lighting apparatus. I haven't seen a smart night light on the market. I think smart lamps can be better.
Smart candles are the worse; most don't look like candles. They don't smell like candles. They aren't controllable by voice.
I've been thinking of building a smart candle system for a while; Hackster's "Alexa and Arduino Smart Home Challenge" seemed like a good reason to take my ideas and attempt to build something.
Design ConsiderationsOne of the interesting aspects of the contest was the notion of taking a idea "from project to product". Using that as my guiding principle, I chose components and a final design based on the following factors:
- Speed to Market - Do the components require special certifications from the FCC? How available are the components?
- Cost of Components - How expensive/niche are the components? Can I substitutes components without a major impact on quality?
- Cost to Manufacture - Can the components be easily manufactured (3D printed, soldered to a PCB, or wood-milled/manufactured)?
After heavy consideration, I landed on a solution that leveraged an Arduino Pro Mini, ESP8266 (S-12 module), Mongoose OS, and AWS IoT (more details in the appendix).
Interaction Diagram and RequirementsThe main interaction model, using Alexa to provide voice control, is as follows:
Once I landed on a design, I started work on a prototype, with the following requirements:
- Controllable via Alexa, Alexa App, and push button (on the device)
- Looks like a candle - real wax and flickering light
- Smells like a candle - must be able to melt wax in order to release a scent
- Warning indicator if wax holder is too hot to touch
- Quickly warm wax - scent should be released 10-15 mins from "turn on" request (note: most electric wax warmers take 30 mins to melt wax)
Flame and Candles
I used yellow LEDs to simulate a flame (leveraging PWM pins to randomly vary the voltage to the LED, which causes the LED to "flicker").
I drilled 5/16 in. holes into 2 in. X 4 in. candles and inserted the LEDs inside to simulate a flame burning.
Wax Melter and Temperature Control
I used an electric heating pad and a ceramic ramekin to meet the scent requirements.
A ds18b20 temperature sensor is used to measure the heating pad temperature. A transistor is used (along with a PWM pin) in order to control the temperature.
- The Arduino keeps the ceramic ramekin "warm" (between 80-90 F) in order to reduce the wax melting time
- The voltage (and current) to the heating pad increases when the candle activated. This allows the heating pad to reach a temperature between 130 - 140 F (wax melts around 130 F).
- A red LED is used to indicate if the ramekin might be too hot to touch.
Voltage Challenges
The heating pad needs at least 12V at 1.2A to (a) get hot quickly, (b) get hot enough to melt the wax, (c) deal with heat loss between the pad, insulation tiles, and ceramic ramekin. [See linked datasheet for more info]
The Huzzah can only accept 4-6 V. The Pro Mini can, in theory, take up to 12V input, but that stresses the voltage regulator on the device (I blew out a voltage regulator on one of my test devices).
Ultimately, I used a 5V 1.5A voltage regulator (7805) to get a safe input voltage for the microcontrollers. I used a TIP 120 Darlington Transistor to handle the voltage switching for the heating pad (using a PWM pin to get more precise temperature control).
Wiring Diagram
Notes/Comments:
- You will need a heat sink on the voltage regulator! There's a 7V gap between the input and output voltages. That equates to 8.4 Watts of power that the regulator is burning off (when the heating pad is on).
- You may not need capacitors on the voltage regulator; I did just to be safe.
The Smart Candle uses two microcontrollers to provide fuctionality
- ESP8266 - connects to AWS IoT (allowing the device to be controlled via Alexa)
- Arduino Pro Mini - controls the LEDs and the heating pad
In order to build your own, you need to configure an ESP8266 to use Mongoose OS and AWS IoT.
Initial Set-up
Option 1 - Create your own AWS account and your own Alexa Skill
- Create an AWS account
- Find and save the custom endpoint for your AWS IoT devices (to do this, go to AWS IoT, then click "Settings").
- Create a simple policy for your IoT thing
- Download and configure the AWS Command Line Interface
- Install and launch Mongoose OS
Option 2 - Leverage my Alexa skill. To do this, you will need to
- Request a temporary user on my account. You can request this by sending a message to me via the Hackster website.
- Download and configure the AWS Command Line Interface
- Install and launch Mongoose OS
Once you have the AWS CLI configured and have downloaded Mongoose OS:
- Step A - Launch the Mongoose IDE. Plug in your ESP8266 device and select the correct COM. Choose Select.
- Step B1 - Select the correct device ("ESP8266 w 4M Flash" if you are using a Huzzah)
- Step B2 - Select the demo.js application and click FLASH
- Step C - Enter your wifi creditials. Click SET, then click DONE.
- Step D1 - Click the "Device Configuration" option on the left menu.
- Step D2 - Check the MQTT box. Enter your AWS IoT Custom Endpoint, Username, Password, Region, and AWS Policy. Click "Provision with AWS IOT"
- Step E1 - Once the update is complete, click on the "Device Files" menu option.
- Step E2 - Find the init.js file. Cut the code from this file and replace it with the init.js code from the code repository below. Click "SAVE and REBOOT"
At this point, your ESP8266 is now configured for use with the AWS IoT cloud. This is necessary in order for the candle to interact with Alexa (using my code below).
Notes/Comments:
- You do not need to understand AWS IoT and Shadows to create this, but it may help (especially as you look at the code and understand the "desired" and "reported" states).
The Pro Mini controls the functions of the smart candle. Building this is straight forward.
First, solder headers onto the Pro Mini (Sparkfun has a great getting started guide). From there, upload the code to the Pro Mini (check the code section for the Arduino code).
The wiring is documented in the Fritzing diagram. You can wire up to 5 "candles" with the code.
Building it - Smart Candle DeviceI decided to build a three candle holder for my second prototype.
Step 1 - Prepare the Candles
- Drill a 5/16 in hole in the bottom of each candle. The hole should be about 3 in deep (three-fourths as long as the candle). Start with a small drill bit and progressively work up to a 5/16 in drill bit. [Note: Be sure to keep the wick in the candle as you make the holes].
- Next, burn the candle for 10-15 mins to achieve a melted look.
- Note - you may want to drill a hole all the way through; this will allow for more light to shine through.
Step 2 - Create the Physical Candle Holder
I used 3D printing to create the candle holder (see section below for STL files):
- "Wooden" candle holder and bottom - Wood PLA filament was used, with a coat of walnut stain to get the color (0.2 mm layer levels)
- LED Insert - Black PLA filament, with a 5mm LED holder.
- Candle Holder Saucer- Black PLA filament. The LED insert snaps onto the saucer.
Notes/Comments:
- You will need to sand the wooden pieces with 180 grit sandpaper before applying the stain. The stain will take approximately 4-6 hours to dry. You may need two or three coats, depending on the look you are going for.
- The candle holder has cut-outs for the 3 mm temperature LED, 2.1 mm DC mount, and power button.
Step 3 - Final Soldering and Assembly
Step 3.1 - Solder the micro-controllers to a protoboard
- Solder the microcontrollers, voltage regulator, capacitors, transistor, and resistor for the temperature sensor to the protoboard.
- Solder a connection between the A0 Arduino pin and pin 15 of the Huzzah.
- Solder connections to the 5v and 12v rails as indicated in the Fritzing diagram
- Solder female headers to the base so that the protoboard can be glued to the candle holder base.
Step 3.2 - Attache the heading pad to the base
- Attached a 2 X 3 length of Peel and Stick tile as a base for the ramekin and heating pad.
- Fold the heating pad in half and use crazy glue to attach the heating pad to the tile.
Step 3.3 - Assemble the remaining components, but do not solder them to the protoboard yet
- Make sure the temperature sensor wires are long enough to reach across the candle holder (left to right = about 8 inches).
- Solder the resistors to the candle LEDs and ensure that the wire is long enough to go through the candle LED holder to the bottom of the candle holder.
- Solder a 3-4 in length of wire to the red LED (temperature indicator). Do the same for the button and the DC panel mount.
Step 3.4 - Assemble the LED holders
- Insert the LEDs into a 5mm LED panel holder. Insert the holder onto the top of the 3D-printed LED holder.
- Snap the LED holder onto the 3D printer cut-out.
- Use a dab of crazy glue to keep everything attached.
Step 3.5 - Assemble, then solder the remaining components to the protoboard
- Slowly soldered all the components together, making sure to use heat shrink (to present shorts). Shorten wire as needed.
- Finally, used crazy glue to ensure all the 3D printed components stay together.
The final build, before adding the candles, looked like so:
Step 3.6 - Add the candles and test with the button
- Place the candles into their holders.
- Plug in the 12V plug
- Turn the light on and off with the button.
Step 3.7 - Test with Alexa
If you are using an account provided my me, then you will be able to control the device through Alexa
- Ask Alexa to 'Discover devices"
- Alexa will scan for 20-30 seconds. Afterwards, she should tell you that a device has been added for you.
- Go to the Alexa app to name the device.
Note - See the next section if you plan to build your own Alexa skill.
Building it - Alexa Smart Home Skill (if you plan to build your own skill)An overview of building Alexa Smart Home skills can be found here: https://developer.amazon.com/docs/smarthome/understand-the-smart-home-skill-api.html
If this is your first smart home skill, then I suggest you first read the documentation and create a few "hello world" skills. Once you're ready, you can use my code to build your own Alexa Skill to control your smart candle.
The Alexa skill responds to the following directives:
- Alexa.Discovery - Used to discover and add devices
- Alexa.ReportState - Used to report state (on/off) of candle to the Alexa App
- Alexa.PowerController - Used to turn on/off the candle
Notes/Comments:
I used Login With Amazon for authentication. You can follow the example here: https://developer.amazon.com/docs/smarthome/authenticate-an-alexa-user-account-linking.html
I am in the process of building a "Device Cloud" for the Scent-terrific Smart Candle, so my code uses the user token to authenticate the user and retrieve the user_id.
The user_id is then used to either (a) discover devices or (b) confirm the user_id corresponds to the device_id.
If you are replicating this skill, you can skip some of the complexity and hard-code values instead. I've left the code as-is, with comments to where you can either hard-code or access a "device cloud" (a DynamoDB table).
Next StepsHere are a few of the next steps needed to fully realize this project as a product.
Next Prototype (v3)
- Add rechargeable battery, in order to operate LEDs in case of power outage
- Allow for wax warmer to be operated independently from candle LEDs
- Add Power Control functionality for LEDs (dim/brighten)
- Create phone app that allows the user to configure the Smart Candle (connect to wifi, schedule on/off, and timer)
- Add reset button on Smart Candle to erase wifi credentials
Things to think about:
- Investigate moving to an ESP 32. It has more pins and BTE/BLE functionality, though that may be overkill (it is also higher cost and is new to development community)
- Think about ways to reduce voltage requirements. Custom ramekins (1/2 in. height) and smaller heating pads will help
- Look into better insulation of the heating apparatus. A redesign of the candle base will help
Path to Minimally Viable Product
- Design/build PCB with SMT components
- Create 2-5 additional models/options for candle holders
- Look at manufacturing the candles with pre-existing holes
- Manufacture ramekins (correct size) and candles (pre-existing holes) to spec
- Think through candle base manufacturing (need more efficient options at scale)
Future Thinking
- Add remote control functionality
- Allow multiple light color options (using an RGB LED)
- Add replenishment options for wax cubes (use Amazon Dash for auto reorder).
Note: This is a longer explanation of considered options. Added to the appendix for anyone who is interested.
One of the interesting aspects of the contest was the notion of taking a idea "from project to product". Using that as my guiding principle, I chose components and a final design based on the following factors:
- Speed to Market - Do the components require special certifications from the FCC? How available are the components?
- Cost of Components - How expensive/niche are the components? Can I substitutes components without a major impact on quality?
- Cost to Manufacture - Can the components be easily manufactured (3D printed, soldered to a PCB, or wood-milled/manufactured)?
I ultimately came down to two design ideas:
Option 1: Hub and Spoke
Components:
- Raspberry Pi to connect to AWS IoT
- RFM69HCW modules to connect from Raspberry Pi to Smart Candle Modules
Pros:
- RFM69HCW module is already FCC certified, and can easily be soldered to a breadboard.
- Raspberry Pi are cheap ($10 retail)
- Clear documentation/examples on connectivity between modules
Cons:
- Would require a "hub" - which doesn't make sense if a user only had 2-3 candle modules.
- Would have to write logic to connect/reset Wifi for the hub AND logic to pair the candle modules to the hub.
Option 2: Direct Wifi Connection to AWS IoT
Components:
- ESP8266, leveraging Mongoose OS, to connect to AWS IoT
Pros:
- No hub used (only need logic to connect/reset to wifi).
- ESP8266 Modules are cheap, but finicky.
- Some of the ESP8266 modules are FCC certified.
Cons:
- A large number of candles could impact a user's wifi connection.
- ESP8266s can be power hogs (though less of an issue for this implementation, as the smart candles would be plugged in).
Final Design
I ultimately decided on Option 2, for the following reasons;
- ESP8266s are cheap, easily mounted to PCBs, generally available, and FCC certified (ESP-12S)
- Most users would only have 2-3 smart candles in a home - so a hub doesn't make sense
- Good documentation on using Mongoose OS to connect an ESP8266 device to AWS IoT
Comments