Friday, August 24, 2018

Breadboard hack for ESP32 and ESP8266

For an index to all my stories click this text

When the NodeMCU came out some years ago there was a problem fitting it on a breadboard. The module was simply to wide to fit.

So I devellopped an aid which you can see in the picture above and which was described in the story you can read here:

However time passes and the Wemos D1 came out which solved the problem cause it had the same functionality as the NodeMCU but fitted nicely on a breadboard.

Then the ESP32 came along and the problem started all over.

As you can see the module itself fits on a breadboard but there is no space for attaching leads.

The problem can be solved by building a similar aid as I did for the NodeMCU. However there rises a problem. At this moment there are several versions of the ESP32 devellop boards around. And they have different sizes.
Well stick to one brand/model/size then !!!
Hey I am Dutch and I buy that module which is cheapest at the time. So I never know which will be my next buy.

With an ESP2866 (NodeMCU) you can put half of the module on the breadboard and let the other half stick outside. Most pins we need are on one side anyway.

This is not easily done for the ESP32 because it has interesting pins on both sides.

Fitting the ESP32 on two breadboards next to eachother is not going to work either. As you can see the ESP32 devellopment board I am using now is just a few mm short.

So then I had this stupid Idea.

Look at the breadboard. In the middle there is a gap with no holes.

So just cut it in half. Use a saw like above.

No we have to halves.

As you can see the ESP fits neatly as we can move the two halves away from eachother.

This works and is great for attaching cables to the breadboard. However there is no easy way to add switches etc.

Then I had another ide which I think is the best.

From one side of the breadboard bend the power rail off and cut it loose.

Now the ESP will fit neatly on two breadboards and you have ample space to add all kinds of electronics for your project.

The prices of breadboards are so darn cheap that it is not a waste to use this trick. You can buy 5 of them for about 4.50 Euro/USD at our favorite chinese suppliers.

Till next time
happy breadboarding


Friday, August 17, 2018

Installing the ESP32 the easy way

For an index to all my stories click this text

I can not believe it is already 2 years ago that Espressif introduced and released the ESP32.

For those who live in the void a quick introduction.
Espressif is the manufacturer of the ESP8266 chips. And the successor of the ESP8266 is the ESP32.

Above you can see a picture of the ESP family. The ESP8266 on the left and the ESP32 on the right. The form factor is not all that different but the possibilities are. Both are breadboard friendly.


Pinout of the ESP32. Just look at all the posibillities. Click on the picture to enlarge.

Well at least that was, what I presume, the plan when they released the ESP32. However things not always go as planned. The ESP8266 has a large base in the hobby/tinkerer world and we did not embrace the ESP32 as quick as was expected. There are in my humble opinion several reasons for this.

- The ESP8266 is sufficient for most projects
- The ESP32 is much more expensive
- The ESP32 is more difficult to install

On the last point I want to elaborate.
No matter how fond I am of Basic as a programming language and it is my preferred rapid devellopment environment for the ESP8266, the most used programming environment is undoubtedly the Arduino IDE. However installing the ESP32 into the Arduino IDE was (up to now) a painstaking tedious undertaking.

Considering these points it is understandable that most hobbyists stay with the ESP8266 notwithstanding the benefits of the ESP32.

However there might be a change coming up.
First the price of the ESP32 is dropping. A board comparable to the NodeMCU is now priced at about 4 Euro/USD at our chinese suppliers with free shipping !!!

Next to that the Installation of the board in te Arduino IDE got simplified in such a way that you can install it in a few minutes and as easily as an ESP8266.

Before I show you how to install it, let's look at a few of the benefits of this board:

- running at 160Mhz (or 240 Mhz) thats double the speed of the ESP8266
- 520KB ram
- Wifi AND Bluetooth
- 18 channel ADC
- 10 capacitive touch pins
- 4 SPI interfaces
- 2 i2s interfaces
- 2 i2C interfaces
- Can Bus
- 16 PWM channels

It is obvious that the ESP32 should get more attention as there are far more possibillities with this module as with the ESP8266 especially now the price is so attractive.

Installing the ESP32 the easy way

I'll show you how to easily install the ESP32 boards in the Arduino IDE.

First go to and install the lastest version of the IDE on your computer. At this moment in time that is version 1.8.5

When installed open the Arduino IDE and from the file menu choose preferences (highlighted here).

In the preferences in the last line which is the Additional Boards Manager URL's copy the following URL:

Now open the boards manager which can be found in the tools menu under board.

In the boards manager look for ESP32 by Espressif systems.

As you can see in my version I already installed but you will get the option to Install. So choose install and see the magic happen.

First test

When installing has finished we can test the board.

Attach your ESP32 with an USB cable to your computer. Choose the right COM port just like you are used to do with the ESP8266.

From the Examples in Communication choose ASCII-Table. Compile and upload it withe the arrow symbol at the left top of the IDE.

Next open the Serial monitor at 9600 baud and see your first program run.

That's all.

Now you can easily start devellopping ESP32 programs with the ESP32.

Life just got a lot easier !!!

Projects with the ESP32 will be coming up in the future, so please visit this blog often.

Till next time
Have fun

Luc Volders

Friday, August 10, 2018


For an index to all of my stories click here

At my work I drink lots of  tea. I start with 2 cups when I arrive, and then during the day I drink at least 8 cups. That is more then 10 cups of tea a day. The problem is that I often put the tea bag in the hot water and forget about it. The result then often is a cup that is too strong or even bitter.

The tea bags tell me the tea has to soak 2 to 3 minutes. Now how am I going to keep track of the time when I am busy at work. I could set a timer on my computer screen but that is too much hassle and not sexy at all. More sexy would be a timer with several leds that faded in or out. But what if the time ran out and I am not at my desk.

So I decided to build a tea timer.

The picture is taken in my hobby room, not at my work. And yes I need to reorganise as I have many projects cluttering up my desk.

My tea timer is a part electronics and part mechanical solution.
A microcontroller is attached to a servo. The servo drops the tea-bag into the cup and gets it out after a set time. This has been done a few times by using an Attiny85 with a servo and a pot-meter to set the time. That is a perfect acceptable solution. However I decided to do things different.

A tea-timer with a website

We are living in the IOT era so let's give the tea-timer a website. The idea is to take a NodeMcu (or Wemos d1 mini) attach a servo to it and do the rest in software. This is a bit more expensive as using an Attiny85 with a potmeter but has the advantage that it has power management on board. So I can feed it direct from an USB power source like a phone charger or power bank. Next to that I can control it from my phone or computer which is cool !!

The hardware

The hardware is straight-forward.

This could be done with an ESP-01 but I used a NodeMCU as it can be powered through USB which gives me an opportunity to use a powerbank as a powersupply when no computer is near. Next to that it supplies 5 volts to power the servo. The servo is attached to d7.

The software

Again I did this project in my favorite rapid devellopment environment: ESPBASIC. Well the software is so easy it speaks for itself.

The slider is used to set the number of minutes the teabag needs to soak. And there are 4 buttons. When the time is set with the slider and Start button is pressed the teabag will slowly be lowered into the tea. I lower it slowly on purpose as you do not want to be splashed by hot water. After the set time the teabag is lifted out of the cup slowly again.

The Up and Down buttons will rise and lower the teabag manually. This function is disabled when the start button is pushed.

The Off button also rises the teabag out of the cup but then ends the program.

timer 500,[set]

wprint |<body style="background-color:SaddleBrown ;">|
wprint |<span style="color: SpringGreen;">|
wprint |<h1 style="text-align:center;">Luc Volders</br>Tea Timer</br>|
wprint "<br/>"
wprint |<span style="color: White;">|

for i=1 to 45
servoval =i
delay 20
next i

slider minutes, 0, 8
wprint "<br>"
wprint "Minutes :  "
minut2 = minutes / 2
textbox minut2
wprint "<br/><br/>"
button "<h2>Start<h2>", [Start]
wprint "<br><br>"
button "<h2>UP<h2>", [Up]
button "<h2>Down<h2>",[Down]
wprint "<br><br>"
button "<h2>Off</h2>", [Off]
wprint "<br/>"

minut2 = minutes / 2

if servoval <> 45 then
for i=0 to 45
servoval =i
delay 20
next i

if servoval <>0 then
for i=45 to 0 step -1
delay 20
next i
servoval = 0

for i=45 to 0 step -1
delay 20
next i
delay minut2 * 60 * 1000
for i=1 to 45
servoval =i
delay 20
next i
servoval = 45

if servoval <> 45 then
for i=0 to 45
servoval =i
delay 20
next i

Some remarks concerning the program.

- The chosen time is tracked by the servoval variable.
- The SET function stes the minutes by 30 seconds
- The delay in the for loop determines how fast the bag will rise or be lowered
- The servo value 0 is down and 45 is up.
- Adjust the number 45 to your own needs, just keep the Pythagorean theorem in mind
- The delay in the Start function: delay minut2 * 60 * 1000 soaks the teabag for the choosen time.

To use this program start with installing ESP-Basic on the Nodemcu board. Open a new file and paste the above code in. Run the code and you are set to go. If you want to know how to do this look at my ESP-Basic introduction page which can be found here:

The frame

The frame is made by experimenting. I made mine 24 cm high and 18 cm wide. First set the servo in the down position ( 0 degrees) and attach the arm so it rests horizontal. Attach a teabag and hold the servo at such a height that the teabag is on the bottom of a cup

Next position the arm so it is sticking as wide as possible out of the frame. In my case I positioned the servo at a hight of 18 cm and 11 cm from the left. This last part could be done better like 13 or 14 cm to the left. That way the cup is positioned a bit farther from the frame which is better when the arm is lifted.

I designed and 3D printed an arm and some feet for the frame. The feet have a gap which is 2mm wide which fits the carton I used for the frame. If you use a thinner carton just make the frame a bit longer and fold the carton at the bottom and press it in the feet. I did not print the frame itself. The feet took me about 2 hour to print so I was not patient enough to print the frame. If you want the STL files just send me an e-mail requesting them.

Thats it for this episode.
Have fun

Luc Volders

Friday, August 3, 2018

Motion detection with RCWL-0516 Radar

The most well-known motion detecting module is the PIR of which I described the basics in this story and with which I made a simple alarm in this story

However lately there is a lot of  fuss about a new module by the name RCWL-0516. So let's see what the difference with a PIR is.

A PIR makes a kind of infra red map of its location. After a while it makes a new infra red map and compares the two. When there is a change in the map that means there is motion and the PIR the makes its output high.
As this description suggests the PIR depends on a change of location of a heat source.

The RCWL-0516 is a magnetron / radar module. The module sends out pulses and measures the return time. If a change in the return time is detected that indicates that something in the path of the pulses has changed position. So the RCWL-0516 is not heat dependend but detects any movement. In real life that almost boils down to the same as most movements will mostly be made by people or animals which are also heat sources.

The connections

Do not let the size of this picture deceive you. The module is only 1.7 x 4 cm !!!

As you can see on the right side the module has 5 connections.

- 3.3 Volt

I found no official papers on this module on the internet. However there are some hobbyists who have done some research and their findings is what I am using to work with.

As long as CDS is high the module functions. So it is the chip-select line. In the beginning I used the module with CDS unattached and it worked. Best results are gained when CDS is attached to +3.3 Volts.  Test what works best for you.

According to the literature I found on the internet the 3.3 Volts pin is an OUTPUT pin. So you should not use it to power the module. Power should be connected to VIN. Again according to the documentation found on the web anything from 4 to 28 Volt will work. I just attached it to the VIN from my NodeMCU unit and that works flawlessly.

First test

I did not find a Fritzing part for the RCWL-0516. I presume that that is because the module is so new.  I tried to make a simple alternative for it.

This first setup is very simple. In fact it almost looks like the first PIR setup.
Just attach a 5 volt source (I used an USB power bank) to GND and VIN and connect OUT to a led with a delimiting 220 Ohm resistor.

When I powered this setup for the first time I thought the module was not working or that I connected it wrongly. The LED was ON all the time. This will happen to you also if you use this setup. But do not worry. The module is not faulty and you did not do anything wrong. The module is just so sensitive that it notices any movement direct and therefore the LED will always be on.

So I sat totally still and the led went out.
When I as much as lifted a finger or nodded my head the LED went on again. This module is very sensitive.

The LED will stay on for about 2 seconds and then goes OFF if no movement is detected.

We have a long corridor in our house and I put this setup on one end and I stood on the other side and the module easily detected my movements. The distance was 6 meter !!!!

Attach it to an ESP8266

The next step was to connect the RCWL-0516 to an ESP8266. I used a NodeMCU for this as it supllies 5 Volts and 3.3 Volts and is easily powered over USB.

As you can see I powered it with 5 Volts from the NodeMCU and attached CDS to 3.3 Volts on the NodeMCU. I attached the led to D5 (through a 220 ohm delimiting resistor) and the RCWL-0516 OUT pin to D6 on the NodeMCU.


For a quick result I wrote a program in ESP-Basic

timer 1000, [test]

wprint |<h1 style="text-align:center;">Luc Volders</br>Radar Tester</br>|
wprint "<br/>"
textbox value
wprint "<br/><br/>"
button "<h2>Off</h2>", [Off]
wprint "<br/>"

sensor = io(pi,d6)
if sensor = 0 then
value = sensor


First pin D5 is set as output (this is where the led is connected) and D6 is defined as input (where the RCWL-0516 output) is connected.
Next step is to set variable A to 0 so we can make an endless loop.
Then the program tests wether D6 is LOW. If that is the case the led stays off and the program jumps to subroutine green that sets the led on the web-page also off.
When D6 is HIGH (movement detected) the program sets the led on and jumps to subroutine red which sets the led on the webpage in the color red.

I put this setup in my room and aimed it at the door. Next I went outside my room and closed the door. I opened my webbrowser on my phone and look at what was happening.
The RCWL-0516 detected movement at a distance of 4 meter through a closed door !!!

This means that we can put this module INSIDE an enclosure and makes it more hide-able in case of an alarm system.


- The RCWL-0516 is a very cheap and yet sensitive motion sensor.
- It can be powered with anything from 3.3 to 28 volts
- The RCWL-0516 measures movement easily on a distance of 6 meter
- The RCWL-0516 measures movement from a distance of 4 meter through a closed door !!!
- The module just uses 1 data pin so can be used with an ESP-01 or even an Attiny85
- As the module can be powered with 3.3 or 5 volts and has a 3.3 signal pin it can be used with a Raspberry Pi

So you can build an enclosure for your project and put the RCWL-0516 inside and it will still work. Testing is recommended though.

Till next time.
Have fun

Luc Volders