The 4x4 Keypad is technical speaking just 16 buttons. Usually you will need one digital input pin for each button which is connected to ground or voltage. So you will need 16 digital input pins plus a common ground/voltage. But the keypad has only eight connectors. How does this work?
The Matrix
The first four pins are connected to all buttons row-wise. The last four pins are also connected to all buttons, but column-wise.
So the first pin has a connection to button 1, 2, 3, A, the second pin to 4, 5, 6, B and so on.
And pin five (the first pin from the other group) is connected to button 1, 4, 7, *.
Keypad matrix
How to read a button-press
In simple terms: if you can measure a connection between pin 2 and pin 6, button 5 is pressed.How can we realize it with an Arduino? You connect all eight pins to digital pins of an Arduino. Declare the first four pins as output pins (that would be the pins, responsible for the rows) and the last four pins as input pins (aka the columns). Then you would pull each of the output pins high (one after another) and read all the input pins. So you pull pin 1 HIGH and read pins 5 to 8. Then you pull pin 1 LOW again and pull pin 2 to HIGH. Again reading pins 5 to 8. You have to continue with pin 3 and 4. And if none of those input pins get a positive reading - you know no button is pressed. Otherwise you know exactly which button was pressed.
Since the Corona virus (Covid-19) caused a worldwide pandemic, we became aware how important it is to wash our hands properly. You should wash your hands for at least 20 seconds with soap. How to measure it? You can use your wet hands to start the stopwatch on your smartphone - not ideal. Or you can sing "Happy Birthday" twice. Well, this might be a little awkward. And if you are in hurry, you can sing the song much faster. I managed to sing two times "Happy Birthday" within 12 seconds. It would be nice to have a timer, that you can start touch-less. But it must look cool somehow. I remembered the classic SiFi movie Demolition Man (1993). Which takes place in 2032 and instead of toilet paper the people are using the three seashells. This would make a nice timer.
The parts
Most of the parts are somehow leftovers. The plastic box was a box containing chocolate sweets. I used three Neopixels from an old strip. The plastic seashells where also a sweet I know from my younger days. In German it is called "Schleckmuschel" or simply "Leckmuschel". Which both can hardly translated into English. Literally it would be "Seashell to suck" or "Seashell to lick". But I think the closest would be "Toffee in a Seashell". It was on sale as a retro campaign. A cheap IR proximity sensor and all of this controlled by an Arduino Nano.
The build
To remove the candy from the seashells, I could licked them, till they are clean. But first of all this would have taken ages and it tasted not as good, as when I was a kid. So I soaked them in warm water for quite a while until the toffee was vanished into the water. I needed a box for the controller, the sensor and the three seashells to fit on top of it. An empty box of candy will do. Just cut a hole for the sensor to reach though. The controller, the sensor and the connection for the Neopixel get their own PCB prototype board. Now gluing the Neopixels and the seashells on the top of the box and connecting everything. I choose to power everything with a small USB powerbank, which is connected to the USB port of the Nano. Usually I would connect the power rails of the Neopixel stripe directly to the power source. But since this are only three pixels, I have no hard feelings about connecting it to the 5V output pin of the Arduino.
Friends of mine are about to celebrate their 50th anniversary. And both love colorful, blinking LEDs like I do. So I decided to make a glowing heart for them. Since I'm only creative but not an artist, I never wasted a thought about creating the heart shaped form for myself. After hours of research, I found a heart made of wooden branches, that fits my needs.
The build
I used a 60 LEDs / meter Neopixel strip. I figured out that if I placed them on the inner side of the heart, I'll need about 48-49 Pixels. Well, with a little overlap I can make it 50 to honor the 50th anniversary. Since the strip's adhesive tape won't stick on the wooden surface, I additionally fixed it with some thread. That took about 10 minutes. I put the controller in one of those electrical installation boxes.
The Programming
I thought about using an ESP as a controller, but it shouldn't be too fancy. So I used an Arduino Nano. That limits the program to a few kbs. So I made ten different animations. Tried to be very efficient and flexible. The animation, I'm most proud of is the beating heart. I tried to use real heartbeat timings for this. And since the 50th anniversary is also called the golden wedding, I made three modes with only golden colors. And to change the modes, I implemented a push-button.
One of the modes is quite special. I made an animation, that simulates a heartbeat. For this I investigated how the correct timing for the heartbeat is and tried to implement it as accurately, as I can. Which worked out pretty well.
The couple is quite happy with the present. In fact, after three month they are still enjoying it - which is longer than most of my relationships last.
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.
Well, I needed an eye catcher for the Maker Faire Ruhr 2018. Moving lights always gain the interest of people. Which includes me as well. The idea behind it: a LED stripe that changes color in response how close you get to it. The distance can be easily determined by a ultrasonic sensor. And with a Neopixel stripe I could easily change the color. But wait! With the Neopixels I can control each pixel individually. So instead of using one ultrasonic sensor, I'm using five. Each of the sensors triggers a different piece of the LED stripe.
Problem
If you want to measure the time the sound takes to travel towards an object and back, you would usually use the puleIn-function. The problem is, that while the micro controller measures the time it does nothing else. So you would have to wait for the signal to return, before you can trigger another ultrasonic sensor. But we want to be able to operate several sensors simultaneously. I was about to imagine a proper algorithm, when I found out, that I wasn't the first to encounter this problem. And I'm not the first to find a solution for it. The library handles this issue.
The Build
I've found a wooden plank from a slatted frame with a length of 135cm. Perfect! I'm using one meter in the middle for placing the Neopixel stripe and five ultrasonic sensors.
The diameter of the ultrasonic sender and receiver tubes are close to 16mm. This is a drill size I had to purchase. I predrilled the holes with a 3mm drill, before using the 16mm one.
First I tried to glue the Neopixel stripe on to it, but that wouldn't hold. I fixed them with zip-ties.
I used an Arduino Nano as the controller, soldered a custom PCB and glued it on the back side of the lath.
I wanted the build to be robust. So I soldered wires from every sensor to the PCB. So that nothing will accidentally disconnect though the transport.
The Algorithm
The original design was that all LEDs were lit white when the maximum distance of three meters is detected. Technical speaking the values of all three colors are set to 254. The value of green and blue is now determined though the distance of an object to the sensors. Well it looked quite unspectacular, but it worked.
Video
Wiring
The power from the Arduino will not be enough to power all sensors and the LED stripe. So you need to add an external power line (5V).
This time-of-flight sensor is a laser distance sensor, that emits a 940nm laser. It can measure distance up to 125cm quite accurate. Adafruit delivers a ready-to-use library and a functional example you should try.
Wiring
The sensor is connected via I2C. So you have to use pin 4 and 5 on the Arduino Uno/Nano (other Arduinos may have different pins for I2C). It works with 3.3 volts. But since the breakoutboard has a voltage regulator implemented, you can connect it also to 5 volt.
Video
Casing
=> work in progress
Where to buy?
You can find it on eBay, if you search for "Time of flight"
Or directly from Amazon: Time of flight Arduino Nano
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.
If you're starting with Arduino, you won't get past this sensor. It's a cheap, easy-to-use ultrasonic distance sensor. If you ever wanted to build your own obstacle avoiding robot, you'll need at least one of these sensors.
How it works
In simple words. There is a speaker that emits an ultrasonic impulse. The pulse is not audible for the human ear. The pulse travels with the speed of sound. And when it hits a target, it's reflected back to the sensor, where a microphone can detect it. And because we know how fast sound travels, we can calculate by the duration of the impulse to came back, the distance to the object.
Wiring
Wiring is easy. The sensor works with 5V. And both data pins are also 5V tolerant. So fist the usual 5V to 5V and GND to GND.
I attached the trigger pin to Digital 2 (D2) and the echo pin to Digital 3 (D3). But you can use any digital pins.Although I wouldn't recommend using Pin 0 or Pin 1, cos' it would probably interfere with the serial monitor.
Video
Watch the video. It probably will answer all your questions.
The Dallas 18B20 is probably the most common temperature sensor in the Arduino community. It's cheep, it's small and part of many Arduino startet kits.
Wiring
The left pin is the Ground (GND) pin. The middle is the data line. We connect the data line to digital pin 2 (D2). The right pin can be connected to 3V3 or to 5V. And since this sensor works on the 1-wire bus, we have to connect the data line also to VCC though a 4.7kOhm resistor.
Video
Here is the Video of the process.
Code
Just install a library for the Dallas sensor and open the simple sketch
DallasTemperature library
The simple sketch
If you run the serial monitor, you can see the actual temperature.
The DHT11/DHT22 is a quite popular sensor in the maker scene. It's a temperature and humidity sensor.
Easy-to-use, quite accurate and also affordable. If you're looking for examples of self made weather stations, you'll find that many makers use exactly this sensor. There are many different temperature sensors on the market. But only few, cheap humidity sensors.
Wiring
Code
I didn't develop any code for this. Since, when you search for DHT in the Library Manager and install a fitting library, you can load an example and it will work. (see video).
Video
1-Wire bus
While searching the internet I found several different datasheets to this sensor and many different tutorials to this sensor and how to implement a pullup resistor to this. So I tested different configuration myself. And I found out that the sensor would even work without any resistors. The sensor using the 1-Wire bus. So I would recommend using a resistor. About the correct value I'm unsure. But it seems everything between 1kOhm and 10kOhm will work just fine.
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.