Thursday, December 14, 2017

Digital Chalkboard



Intro

While I'm making videos for you, it is often necessary to write something important down. Sometimes just, so remember the identifier of the item. Or do you really think I can remember things like "ADXL345" or "VL53L0X"? And honestly: I haven't got much paper in my flat. So I thought about getting a some kind chalkboard. Less waste than writing on paper.

The e-Writing Board

I came across this little gadget. It's like a tablet where you can write on it with a stylus or your finger. I must have this thing! I asked Banggood, if they can provide me with one of those boards and they agreed.
That e-writing board is such a lightweight, I'm afraid to break it. And have you ever had a Etch-A-Sketch in your childhood? You could "write" and draw on a board without any batteries.


Different sizes

This board seems to be available from 4.5" up to 12" from different manufactures. And they are awesomely cheap! Haven't found one that exceeded the 25 € mark.

Video



Summary

Pro

- Cheap
- Lightweight
- Low power consumption (Battery used only for erasing)
- Lock screen switch prevents accidental deleting

Cons

- Uses non-rechargeable batteries
- Lock screen switch doesn't prevent overwriting



Links

EPOLLO Ultra Thin LCD Writing Tablet

Wholesale Computer Accessories


Friday, November 10, 2017

IoT - power it up!




Intro

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.

Links

ESP 8266 NodeMcu @ Amazon
Relay @ Amazon
Simple Power strip @ Amazon
Finding a Smartphone @ Amazon

Update

Code for the ESP 8266
https://bitbucket.org/Remnis/mqtt-iot-switch

 
 Banggood 11.11 Global Shopping Carnival Electronic Special -- https://goo.gl/zHEiJW

Thursday, October 12, 2017

Controlling the fan speed with your Arduino





Intro

You savaged a fan from an old PC to use it as a ventilator? Just hook it up to 12V and the sucker runs. Well, it runs at a constant speed. Maybe too fast, maybe too noisy. There must be a possibility to slow it down.

The idea

When you apply 12 Volts to it and then remove the power supply, it keeps spinning while getting slower. So if you continuously apply and remove the power, you can control the fan of the speed by the duration of the phases when the 12V is on and when it is not.

What do we need

The Arduino doesn't supply 12 Volts. So we have to use some sort of switch. An electronic switch. A MOSFET. That's a kind of transistor, that can handle the needed current/voltage needed. I used the IRF530N, because it was the only Mosfet I had and it matches the specification of the vent by far ;-). It's a N-channel Mosfet. That means you can control the connectivity of the negative pole of the power source to the fan by applying a positive voltage.

PWM

Pulse Width Modulation is the magic phrase. A digital output pin can only have two possible states. On or off. 1 or 0. HIGH or LOW. While HIGH is typically indicated by an output of 5 Volts (3.3 Volts occasionally) is LOW represented by a 0 Volt output. So how do we simulate an output of 2.5 Volts? Well, simply spoken, if we have a time frame of 10 seconds. Half the time we put out 5 Volts and half the time 0 Volts, we will have an output of 2.5 Volts of the time of those 10 seconds. Wired? Sure. But this is how math works ;-)
PWM



Video



Wiring





Links
IRF530N at Amazon

PWM-Image
https://commons.wikimedia.org/wiki/User:MatthiasDD


Monday, October 9, 2017

Use the force, Maker!




Into

Controlling a servo just by the wave of your hand? The wet dream of every Star Wars fan, isn't it? Yeah, mine too! With Microsoft's Kinect or OpenCV and a webcam and a ton of programming you can do it! Or there is a tiny, little module for your Arduino or your Raspberry Pi that can handle some simple gestures. The APDS-9960 can do the job.
It can be set to three different modes. It can work as a proximity sensor. Well, of that we have quite enough in the Arduino world. It can also operate as a ambilight sensor. Not bad. With four of them - each for every corner of your TV - you can make your own low cost ambilight.
But the mode, we're looking for, is the gesture recognition mode. It can detect following hand-movements:
- left to right
- right to left
- up to down
- down to up
- close to far
- far to close

How to use

Well, this is a multi functional sensor. It is developed by SparkFun. Therefore SparkFun published a pretty good library with very useful examples. If you pick the GestureTest example, you can implement easily your own control mechanism.

Video

 Connections 

 Careful

There are some versions of the sensor, marked as APDS-9960, that are really a APDS-9930. That means they are lacking the coolest of all functions - the gesture recognition thing!

Links

SparkFun Library @ Github
APDS-9960 @ Amazon

Wednesday, August 16, 2017

H-Bridge for your robot




Intro

Turning a DC motor on and off isn't that much of a problem, is it? But if you want to change direction, you must have a way to switch the polarity that drives your motor. Well, that is what a H-bridge does.

How to control

For each motor, you should have 2 pins to control the output. If you pull one pin HIGH and the other one LOW the motor should spin. If you invert this configuration, the motor will spin in the other direction. Pulling both pins to LOW or both to HIGH will stop the motor.
Now you have the ability to turn the motor on in both directions. If you also want to control the speed of the motors, you should connect it to PWM ports.


Wiring




Video 



Pro-Tip

If your motor doesn't spin, you probably have a too low input voltage. These boards are equipped with voltage regulators. So you can try using a higher voltage. I used a 9V battery for the 5V motors myself. Worked perfectly.

For controlling your robot it makes sense to extract the commands for the wheel to spin in separate methods. Make a method for spinning the left wheel in clockwise direction. And one for counterclockwise direction. It's so easier to program some logic to your vehicle.

Buy at Amazon

H-Bridge L298N
5V DC Motor with gearbox
Robot chassis with motors
H-Bridge L9110

Monday, July 24, 2017

Text on your Display



Intro

If you want to add some visual output to your Arduino projects, you'll need a display. If you need only little to display, the LCD 1602 is a quite good solution. But you'll waste about 8 Pins on your Arduino for the display to get working. Luckily there exists a I2C adapter that you can solder right onto the pins of the display. So all you need to connect are the I2C pins, a good library and little of coding.

Wiring 

If you already have the I2C adapter soldered onto the board, wiring is quite easy. You should usually have only four pins to hook up. VCC and GND of course. The LCD display works with 5 Volts. So we go for the 5V Pin. The Arduino Uno and Nano can handle the current need for this display. SDA (data line) to analog 4 on your Arduino Uno or Nano. And SCL (clock line) to analog 5 (other Arduinos or ESP might have different pins).





Video





Needed library

https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

When thinks aren't working

  • Did you remember to call the begin()-method of the library?
  • Did you turn the backlight on?
  • Have you tried to adjust the contrast with the potentiometer on I2C adapter?
  • Did you check the I2C address? (use the i2cdetect sketch)

Where to buy

You can search on eBay for LCD1602 I2C. You'll get plenty of results.
Or, here are some direct links to Amazon:

LCD 1602 with I2C adapter

LCD 1602 without I2C adapter

I2C adapter

The bigger LCD 2004

Monday, June 12, 2017

Extend your analog inputs




Intro

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.


Video


Wire up

Normal wiring


Wiring with two modules on I2C



Links

Adafruit Library
https://github.com/adafruit/Adafruit_ADS1X15

Amazon
ADS1115
NodeMcu

Friday, June 2, 2017

Keeping balance with a gyroscope




Intro

"I like to move it, move it! I like to move it, move it!"
If you want to measure movement, you probably will use one of these sensors. Why you want to measure movement anyway, you ask? Hey, who doesn't want to build a quadcopter? Or a self-balancing robot?
 There are 2 common senors, that will do the trick. The GY-61 (ADXL335) and the bigger brother the GY-291 (ADXL345).

The sensors

The GY-61 is the easier sensor to handle. It has VCC and GND and three analog outputs. One for each axis. You can read the sensor values with the analog inputs of an Arduino.
These are quite raw values. And even, when the sensor doesn't seem to move, the values does. So you have to program some method to smooth these values and probably a calibration routine, if you want to use it in a matter of a balanced project.
The GY-291 is a little different. It has an I2C bus. And I recommend to use the library, that is provided by Adafruit. If you're using the Arduino IDE, just search for ADXL345 in the Library Manager.



Video






Which sensor for which project?

Well the advantage of the GY-291 is, that you don't need to interpret the sensor values for yourself. The library does all the work for you. And it has a I2C bus. That means, you won't waste any pins on your controller. Because you can attach several devices to I2C, as long as they have different addresses. The smaller brother, the GY-61, doesn't need much code to operate. The sensor delivers it's values through 3 analog outputs. Well, at least it delivers something. You have to interpret the values for yourself. If you want to build something like a self balancing robot, I would recommend, that you build a small calibration routine. 
Both sensors costs about the same. 
For one of my next projects, where I want to use an ATtiny. Since the ram of this board is extremely limited and I just want to know, if the sensor is moving anyhow, I'll stick to the GY-61.

Links

Amazon

Friday, April 21, 2017

Shooting Laser to measure distance



Intro

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

Thursday, April 20, 2017

Raspberry Pi Zero W(ireless)





Intro

On the 28.02.2017, the fifth birthday of the Raspberry Pi, a new version was released. The Raspberry Pi Zero W. The W stands for wireless and indicates that Wifi and Bluetooth is already integrated on this board. Finally.
The 'old' Raspberry Pi Zero costs about 4£ plus shipping, while the new version costs about 9.60£ plus shipping.

Difference in power consumption

One thing that was on my mind is: does the integrated solution draws more or less power other than attaching external Wifi and Bluetooth.
The solution I found most similar to the configuration on the new Pi Zero W was the HAT from Redbear. It also extends the Pi Zero with the same connectivity as the new one has now.
So I installed the same Version of Raspian on both models (Kernel 4.4, Release Date: 2017-03-02), turned Bluetooth on and connect with active Wifi to my home network.

Pi Zero + Redbear HAT Pi Zero W
... ...
140-160 mA 130 mA

More expensive or cheaper?

Well, kind of a tricky question, isn't it? On the first sight, you see the same-sized board with identical specs for more than the double of the price. But think about it. If you want to use it, as a streaming-client, a home cloud server, a broker for IoT projects or even a small PC, you need what? Internet connection. So you need a Wifi dongle. And since it wouldn't fit, you also need a OTG adapter. And a small USB hub would be also nice. Oops! That's a lot of extra to buy.


Watch the Pi Zero W


Worth it?

If you are looking for a small single board computer as a replace for a Lunix based desktop computer, you should probably go for the Raspberry Pi 3.
But if you want to buy a Pi Zero anyway, you should go for the version with the integrated connectivity. Because if you are a maker and want to build your own IoT device, a Webserver or even a autonomous robot, you wish earlier or later that you can communicate with your Pi.

Monday, April 3, 2017

Coolest motion detection sensor


Intro

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.

Links

Amazon

RWCL-0516
NodeMcu
Arduino Uno

Monday, March 20, 2017

Makers most popular HC-SR05 ultrasonic sensor



Intro

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.

Tuesday, March 14, 2017

Dallas 18B20 temperature sensor



Intro

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.

Thursday, March 9, 2017

DHT22 temperature and humidity sensor



Intro

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.

Links

Amazon
DHT22 Sensor
Arduino Nano
Breadboard
Resistors

Sunday, February 5, 2017

Controlling NeoPixels with a Webserver on an ESP8266

Esp 8266 NeoPixel Webserver

Intro

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.

  • 2x Breadboard 400 Pins
  • Logic Level Shifter (3V to 5V)
  • NodeMCU Esp8266
  • Breadboard Power supply
  • Jumper Wire
  • Neopixel (W2812b) Stripe

HowTo Video

Here is a step-by-step video how it is made.


Code

Posted the Code on Bitbucket (it's like Github). There you can find the source code and wiring.
https://bitbucket.org/Remnis/neopixelwebserver

Advice

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.