A wave of flu hit my hometown. And I wasn't spared. So my drink of choice for about three weeks was tea. I remembered how I saw a video, years ago, where someone used an Arduino Uno and a servo to dip a teabag into a cup. Well, it shouldn't be so hard to make a similar project with an ESP8266, should it?
Materials
Well, since I felt too sick to go outside, I took, what I've found in the basement. I still got some SG90 servos. And for the stand I used some angle brackets, which I fixed with some zip ties. As an arm for the servo, I found some plastic tongue depressors.
Setup
Quite simple. You can use the same 5V input for powering the servo and the NodeMcu. All you need is to select a digital pin for the servo. Any pin will do, since every digital pin on the NodeMcu has PWM capability.
Video
Maker Faire
The IoT TeaMaker was first featured at the Maker Faire Ruhr 2019 in Dortmund, Germany. Everyone could see the TeaMaker in action and try it for themselves.
AVNET invited me to the "electronica 2018" in Munich to hold a speech about IoT and Neopixels. So I thought, wouldn't it be great if I could finish my speech with presenting a functional project on stage by controlling Neopixels with a smartphone. Something with a practical, everyday use in home automation? .... Yeah, I got it! A hat! Home automation at it's finest .. somehow.
Setup
Quite easy. We just need a pin for the Neopixels. Although the WeMos and the Neopixels are working with 5Volts, they can be both be powered by a 3.7V LiPo battery for a short period. To wrap the stipe around the hat once, I needed a total of 19 Neopixels (with a specification of 60 LEDs / meter).
There are different bio metric sensors on the market. They are commonly used to access a private area. Let it be a door, a safe or the privacy of your smartphone. The most known is the fingerprint sensor. A commercial bio metric sensor costs quite a fortune. But there is a cheap alternative for the Maker community. A fingerprint sensor for around 20€.
But how to save and identify a fingerprint with an Arduino? Well, you don't need to. The sensor does all the work. You only have to tell the sensor what to do.
Wiring
If you're lucky, you'll get a color coded connection cable. If you aren't, you will get one where at least the GND line is marked. It should be in one of the corners of the cable. From there you can find the rest. The order would be: GND - RX - TX - 5V. And two pins without a connection.
You have to connect GND to GND, VCC to 5V, TX to RX and RX to TX. But if you want to use the serial monitor to watch your results, you shouldn't use the Rx and Tx on the Arduino side, because it will conflict with the USB-port. You can use the Software Serial library and use pin 2 and 3.
The sensor, I received, was only 5V compatible. So if you want to use it with a NodeMcu or any other ESP, you have to add +5V to power the sensor.
Programming
There is no need to reinvent the wheel. If you search for "fingerprint" in the library manager of your Arduino IDE, you'll probably find two libraries. I used the one from Adafruit. It's equipped with examples for a quick start.
With the example sketch "enroll", you can start saving fingerprints to the sensor.
To test it, use the sketch "fingerprint". You'll get the found ID in the internal database of the sensor and the probability for a positive match. With that, you have all you'll need to build your own access control.
For a very special woman, I needed a very special and unique present. Something really cool. How about a NeoPixel lamp, that can be controlled with a smartphone.
And why not adding some really funky features? Like turning the lamp on/off by the wave of your hand. And some nice animations. How about transmitting the temperature and humidity to your phone. And why not adding a scheduled sunrise, like the one from the sunrise simulator project? Too much? We'll see!
The Build
First of all I need a housing. I decided to use two old CD spindle boxes with different heights. The bigger one will house the Neopixels, the smaller one all the electronics. To make a little glow effect, I wanted to make the transparent plastic look like frosted glass. You can achieve it, by 'polishing' it on the inside with sandpaper. To mount the Nepixels I used a pump spray bottle, that I've cut into length. A lot of hot glue, some holes for the wires and it's a piece of cake.
Video
Problems
Problem 1: APDS 9960
As soon as the APDS 9960 gesture sensor starts working it blocks the processing of the microcontroller as it tries to check for a gesture. This leads to the stage that the animations stopped working smoothly.
So I outsourced the gesture readings to an Arduino Nano. It communicates with the NodeMcu via three digital pins. I made my own small 'protocol'. By setting the pins to HIGH/LOW I can transmit eight different sensor states.
Problem 2: BME 280
The temperature sensor doesn't want to initialize with the begin()-function of the library.
I uploaded a I2C-scanner and checked for the I2C address. I searched the library of the sensor and find a method where you can define the address. With the call of begin(0x76, &Wire) the BME sensor just worked fine.
Wiring
Does it look a little complicated? Maybe. But it's quite easy. Everything needs power, corresponding to it's specifications. The sensors can be powered by the voltage pins of the microcontrollers. The Neopixels need more current, as the controllers can provide, so it needs to be powered directly by the power supply. The APDS-9960 sensor is connected via I2C to the Nano. So it has to be pin A4 (SDA) and A5 (SCL). On the NodeMcu it doesn't matter which two pins we use, since nearly every two pins can be configured to act as I2C.
Features
The lamp communicates via the MQTT protocol. I've put in a small Raspberry Pi Zero W, that acts as a MQTT broker. The Arduino Nano handles the gesture sensor and sends a signal to the NodeMcu to turn on/off all Neopixels. The NodeMcu has access to the BME280 sensor and publishes the temperature and the humidity to the MQTT broker. You can switch modes between On/Off and several animations. For nearly all functions (except the sunrise alarm and the disco light) you can set the desired RGB color.
The NodeMcu syncs time with a NTP server. So you can set a time when to start the sunrise-mode.
Modes
Off (0)
Well, every NeoPixel is turned off. The Lamp still reacts to the gesture sensor
On (1)
Sets all NeoPixels to the desired color.
Animation (2)
Sets the color of the stripe one pixel at a time, starting from the bottom, rising to the top.
Blue Light (3)
A rotating light. Like the one the firefighter or the police use it. But in any color you want.
Fire Simulation (4)
Random flicker, that starts at the bottom, rises and falls randomly.
Sparkle (5)
Turns on all LEDs at the desired color. Adds randomly some white sparkles to the light.
Blink (6)
Remember the classical blink-sketch? Now with a hole lamp and the color you like.
Sunrise Alarm (7)
You set the hour and minute where the alarm starts and it simulates a sunrise (like in the sunrise simulator project).
Disco Lights (8)
Randomly sets up to 4 LEDs to a random color.
FAQ
Why using three boards, when one can do the trick? Raspberry Pi Zero W - Well this is not really part of this project. But I wanted a MQTT broker for the ESP. And for upcoming projects. So why not put it in the lamp? Where I have the place and already the needed power line?
ESP 8266 - The heart of this project. Why not an ESP32? Cos' I don't have one
Arduino Nano - I had a small delay with the library controlling the APDS 9960 gesture sensor. I could have used a ESP32, but I don't have one. I could programmed it on the Pi, but I didn't want to. It increases the cost by about 3.50 € and I found a simple way to transmit simple data. So, who cares?!
Everything fits in the CD case on the lower section. And the more boards you can see there, the cooler it looks. And I like the way it looks.
Many devices uses current on standby mode. So we like to plug them into a power stripes with a switch on it. And we hide it behind some furniture because it's quite ugly to look at some cables. But now it's hard to reach. So.. if we could control the switch remotely within the comport of our couch? That's what IoT is made for.
Wiring
Video
Attention!
Working with 110V AC or 230V AC is very dangerous and should be done only by a professional! Not only can it kill you, you also suffer incredible pain while you die!
Configure MQTT-Client
The MQTT broker and your client device has to be either in the same network or at least reachable through the internet (not really recommended).
You enter the IP and port of your broker to connect to it.
Add a new widget for on/off mode.
Then you subscribe to the channel the ESP is sending it's status to. It is: "esp/3/power/out" in this code.
You need now to enter the channel, where you want to publish commands to. The ESP subscribes messages from this channel. I used "esp/3/power/in" for this case.
Now, the only thing left to do is to define the messages for on and off. Usually it would be best to use 1 for on and 0 for off. I go for 10 for off and 11 for on.
Is yours too small? You want to get more? No, that is no advertisement for a penis enlargement product. It's for a board to extend the numbers of analog inputs to your microcontroller.
It's quite rare that you run out of analog inputs, when using an Arduino Uno, Nano, Micro, etc. Even a ATTiny is already equipped with 4 analog inputs. BUT if you are so keen in using a ESP8266, like I am, you'll find your self in the position having only 1 (!) analog in. This is where a digital to analog converter comes into play.
It's all about libraries
The name of the sensor (ADS1115) already can lead to the conclusion that the board is developed by Adafruit. And of course, if you'll open the library manager in the Arduino IDE and search for ADS1X15. There you have it all. Ready-To-Use library, good commented examples.
I2C on your NodeMcu board
The default pins for I2C on the NodeMcu board are pins D1 (SCL) and D2 (SDA). But the cool thing with the NodeMcu board is, you can define for yourself where the I2C has to be.
With the command: Wire.begin();
You usually start the Wire-library, that is responsible for the I2C bus. But you can also add the pins for SDA and SCL as parameters: Wire.begin(D2, D1);// Wire.begin([SDA-Pin],[SCL-Pin]);
There can be more than one
The ADC1115 has a fixed I2C address, like any other I2C device. Fixed? Not quite! It has up to five different I2C addresses. The default one, and four more addresses, that you can select by connecting the address pin (ADDR) with either SDA, SCL, GND or VDD.
Ever want to build an alarm system?
The RCWL-0516 is a human body motion detection sensor. A sensor, that detects, through induction, human body movement. So it should only react if a body movement is detected. Moving objects should be ignored. How cool is that?
Wiring
Straight forward.
GND => GND
5V => VIN
D2 => OUT
Pin 3V3 on the RCWL-0516 is an output. And the CDS-pin you can attach a light sensor. I will cover it in a later video.
Videos
Wiring & Use
ESP & detection tests
Code
Seriously? You set the pin, the RCWL-0516 is attached to, as an input. And if you register a 'HIGH' signal, you do stuff. Watch the video. Coding is done in 2 minutes.
Q&A
Update 29-05-2017
This sensor seems to get quite an attention. There are some questions that some of my viewers asks. Here is what I found out.
Q: Can you use the RCWL-0516 with an ESP8266? Or will you get randomly false positive results?
A: I've done a short term test with the ESP8266 on a NodeMCU board. It seems to work just fine. The ESP greater Version 12-E is shielded and is FCC certified. So it should, by definition, not interfere with other electronics. However one viewer reported randomly false positive results on a long shot.
Q: Is the water in the human body responsible for the detection?
A: Probably. I tested it with an empty and with a water filled bottle. And even with a cat. And it seems that the bigger the object the further away it can be detected.
Q: Can it be mounted mobile to detect persons?
A: No. The sensor seems to be quite sensible to movement itself. Any movement of the sensor itself seems to trigger the output.
Q: Does the radiation of the sensor harm you in long term?
A: No. The Sensor uses about 30 milliwatts (mW). The radiation output is limited to that value. That is far less than your smartphone emits.
I always wanted one of those fancy LED stripes that you can control with your mobile or tablet. Should be easy to install, lightweight and customiseable.
Well, my brother-in-law is fascinated of this topic as I am. And Christmas was at our doorstep. So what better to do than try to build him a DIY-light.
Well getting started with it was quite frustrating. And it took me quite a while to figure out how it is done since this was my fist contact with the ESP8266.
After I posted a video of the result on FB, I was getting many requests for a manual to this.
Shopping List
Before soldering it to a PCB, I prototyped it on a breadboard. Here is everything you'll need.
The level shifter might not be necessary. The NeoPixel stripe could also work with 3.3 V on the command line. But it would be best if the difference between supply voltage and command voltage would not be so high.
And be aware not to power a whole NeoPixel stripe from your controller. On other Projects I blew up two Arduino Nano.