Wednesday, December 12, 2018

Fingerprint Sensor with an Arduino or an ESP


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.


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.


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.




Fingerprint Sensor
Arduino Uno


Fingerprint Recognition Module --
Wholesale Arduino Compatible SCM --
More Electronics (EU Warehouse) --

5% off Industrial & Scientific New Arrivals --  (code: ab9275)

Thursday, September 6, 2018

KatLight - the wonderlamp


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.





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.


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.


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.


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.


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.

Parts list

Neopixels 60/m
APDS 9960 Gesture sensor
BME 280
Arduino Nano
Raspberry Pi Zero W

Source Code

KatLight at bitbucket

Monday, July 9, 2018

Sunrise Simulator


For an event, I needed something special. How about a simulated sunrise. And it would be nice, if I could be able to remote control it and put it anywhere in the room. And of course it should be low cost. So the magic words for this are: NodeMCU, Neopixels, LiPo battery and a MQTT broker.


Nothing fancy here. The battery is connected to GND and the 3.3 Volts on the NodeMcu and also on GND and the 5 Volt input of the Neopixel stripe. Yes, we power a 5V Neopixel stripe with a 3.7V battery. When fully charged, it will work for some time. The Neopixel stripe mustn't be too long. I used just five pixels, and it works fine.





To simulate the sunrise, I'm setting one color at a time. So I divided the given time in three equal parts (one for each color). Within the first third of the time span, I raise the color value of the red LED from 0 to 255. Then I start with the green color. Blue at last. When all three colors are at max, you'll get a white glowing LED stripe.


I want to add a sunset algorithm and a full cycle of a sunrise, sunshine and a sunset. Just check the Git repository from time to time.


Git repository


Neopixels 60 LEDs/m
Electrical box
LiPo battery

Saturday, June 2, 2018

Talk, little buddy, talk!


In the beginning of 2018, I've discovered a Kickstarter project, called "The Little Buddy Talker". It's a small chip on a breakout board with 254 short voice messages and a 3.5mm audio jack.


The Little Buddy Talker is connected via SPI to the Arduino. And since TLBT is mounted on a breakoutboard with pins on the bottom, you can easily put it on a breadboard for wiring.

The Sound Chip

The chip on the board is the aP23682. It's a voice IC with the capability of recording up to 682sec voice in a 16bit quality. With this chip, you could probably make your own buddy talker. All you need are the voice samples.


What could have been better?

Since the buddy talker is connected via SPI, it would be usefull, if it had the standard SPI connector matching to the one on the Arduino Uno, Mega or Nano.
The buddy talker doesn't give any feedback, that indicates when a sound file has finished.


Kickstarter Project: "The Little Buddy Talker"

Arduino Uno
Jumper Wire
Audio cable 

Tuesday, March 20, 2018

Ultrasonic Reactive Light Bar


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.


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.



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).


Arduino Nano @ amazon
HC-SR04 Ultrasonic sensor @ amazon
Neopixels @ amazon
NewPing Libriary
Ultrasonic Lght Bar Code