The Totoro Project it's a nice IoT project you can copy in many other different form.
Using the ESP01 board, with the MQTT protocol, you can communicate the status of button to the MQTT Broker ( in my case AdafruitIO ).
An useful guide for MQTT and Adafruit: https://goo.gl/BVXdso
You can use every MQTT Broker you want and same for the button function.
How it's works?
Every device in the network are connected at the MQTT Broker and read the channel called "love_box".
When you press the button on one device, it sends a message on the channel, and the other devices blink the led. Until you do not press the button, the device blinking.
With this system you can send a little "blare" to other device.
Step 1: The Materials
For create this project you need some stuffs:
- ESP01 board
- Useful - The programmer for ESP01 ( DIY )
- 3D model
LM317 voltage regulator
Resistors: 150ohm, 270ohm, 10K and 68ohm.
Led - or internal led -
Mini Pushbutton Switch
- BNC connector - https://goo.gl/DrD8k2 -
Step 2: Make the Protoboard
The power for the board:
Take the protoboard and solder the components according to the first pic.
This configuration allowed the LM317 - https://goo.gl/VtzNz -to produce around 3.4 volt for the ESP01.
Question: why i can't use the LM7805?
Answer: the LM780x series does not works under 5 volt, and it can not produce 3.3 volt.
When you finished, check the output voltage with the multimeter. It's must be around 3.4 volt and 4.3 volt.
For power supply you could use 5V power supply or bigger. I recommend you not use bigger than 9 volts, it emits to much heat - power lost - !
The ESP01 is a board of series ESP, it's small and practical, but not very user friendly.
Remember, you can not use the Arduino pins to communicate directly to the ESP01, because it's a 3.3 volt pins tolerants.
It's a very useful made a programmer for programming the ESP01 with a FTDI: https://goo.gl/2Jowbv
Use the second image as a guide and remember special pin functions, third image, seen in the guide above.
For more info read the 1° steps of this guide: https://goo.gl/JpsYWB .
If you are Italian, you can read my guide for the ESP01 and FTDI DIY: https://goo.gl/5wxG4V
Finish the Protoboard:
The fourth image is the finished of the project on the protoboard.
I strongly recommend the Female Headers for connect the board to the protoboard. Just in case something goes wrong, you can reconnect another board.
Do not connect the button and her resistor, we will do it after.
Step 3: MQTT Broker - Adafruit IO
The MQTT Broker is a "server" for all your messages, from and to the devices. Take a look at the first image.
For more info, use this useful guide: https://goo.gl/oJAuQZ
In my case, i use the Adafruit IO, but you can use every MQTT Broker you want.
Go to the Adafruit IO and do the registration.
Now you need to create a new dashboard and:
- Add Feed - https://goo.gl/z2Npto -
- For my code is "love_box"
- Add blocks - https://goo.gl/YJsCqX -
- Momentary Button: link to "love_box" with Press Value = 1 and Release Value = 0
Line Graph: link to "love_box" with with Y-Axis Minimum = 0 and Y-Axis Max = 2
At the end you will have something like the second image.
Question: why is so important the "love_box" name in the dashboard?
Answer: in the MQTT Broker - Ada IO - you created the channel called "love_box", and if in the code you used a different channel, the MQTT will not work.
The last step on the MQTT Broker - Ada IO - is the "AIO KEY". On the dashboard, click on the top right little key.
Now copy the "Username" and "Active Key" and write them on the Arduino Code.
Step 4: Arduino Code
Install ESP Core for Arduino IDE:
The main guide is this: https://goo.gl/yAqlU4 and follow the "Installing with Boards Manager".
Now take a look of the first image. The Black version of ESP01 have a 1MB flash disk size and the blue version have 512k. What does mean? Look at the second image, you need to select the correct "Flash size".
The Arduino Code is in this repository: Code much clear to read.
Remember to edit:
If you decided to edit the "Adafruit_MQTT_Publish" and "Adafruit_MQTT_Subscribe" channel, you must edit the same lines and the called in the code.
Step 5: Meshmixer and 3D Print
For my project i need a 3D model of Totoro.
I found it on thingiverse, at this link: https://goo.gl/n3mAsi
You could use every 3D model you want, the next steps are the same.
It's time to install Meshmixer . With this powerful tool, you can do the shell for your project.
Import in Meshmixer the Totoro STL, and use the Hollow tool : https://goo.gl/NnJMv3
In the same tool, remember to do an Escape Holes on the back.
Now you need to cut the model in half using Plane Cut tool:https://goo.gl/axPKXV
Use the export button to export the lower part.
In the end, you must cut off the ear. Select the ear and use the Separate tool - five image - .
Use the export button to export the ear.
Return to half top model and use the Erase & Fill tool: https://goo.gl/d4LR76 - six image - .
I prefer to print the pieces one at a time, remember to use the transparent 3D filament!
Step 6: Assembly
Drill an hole on top of the head. This hole is necessary to put inside the button.
Blocking the button with the hot glue, and test the connection with a multimeter in continuity mode.
Take the ear and add a little piece on bottom, using hot blue or super attack. Cut the piece if it's too high.
Now you can connect the button and her resistor according to the schematic on the step 2.
Remember to not close the 3D model before testing the correct operation!
Press the button on the Adafruit IO and the internal led must blinking, until you pressed the button on the ear.
Repeat the test with button on the ear.
Step 7: Ready to Go
Finally this is the final result.
- Question: did you have use the internal led or external red led?
- Answer: in this pic and video i used the internal led. To clarify better, the red LED is the power led - you can not shut off - and the blue LED is the internal led. The internal led and the external led, in my schematic, is the same pin.
- Question: can i use it on the unknown network?
- Answer: no you can't. You must re programming the ESP01, because this board have not space for OTA.
Much info for the OTA: https://goo.gl/Xv6v6z
But you could do this thick: add a special connection ID and password for your Personal Hotspot on your phone!