Category: Micro controllers

Sonoff TH Elite
October 7th, 2022 by Chief

pin up

This time we will Tasmotise Sonoff TH Elite device. Description and technical data of the device shall be skipped since it can be read on the manufacturer`s site.

It is a pretty straightforward process and I must say that I like this device in all aspects.

On this occasion, I got my hands on TH Elite together with THS01 Temperature and Humidity sensor, so here we go…

Flashing the Sonoff TH Elite

TH Elite back side

On the back of the device, there are four Phillips screws, remove them and open the device.


TH Elite Opened

When you open the device, you will notice pins for programming. You need USB to TTL adapter.  Just do not forget that TX from the adapter goes to RX of the device and TX of the device goes to RX of the adapter. It is just like talking and listening, one talks with his mouth, and the other listens with his ears, and vice versa 🙂 3.3 V goes to 3.3 volts of adapter (if you have the adapter that is capable of both 3.3 and 5 Volts be sure to use 3.3) and Ground to the ground.


Solder the wires, and it is ready for flashing. Flasher can be downloaded from here

and firmware from Tasmota site. You need tasmota32.bin (not the other, just that particular one).

Now it is important to put the Sonoff TH Elite into flashing mode. We do that by pressing and holding the button on the device while plugging the USB to TTL adapter into the USB port of the computer. When plugged release the button and as a result device should be in flashing mode. Chose your com port, and browse to tasmota32.bin path and that`s it. Hit the Flash button, and it should end like this.

ESP flasher

If you get the error, most probably ESP is not  in flashing mode. Remove the adapter from the computer’s USB port, press and hold the button on the device and plug in the USB to the computer again. After a few seconds, release the button and try flashing again.

Connecting tasmotised device to home network

Now it is time to connect to the device and configure it.

Tasmota Wi-Fi config

Tasmota Wi-Fi config

Now, get the phone or laptop and scan for Wi-Fi networks. It is wise to turn off mobile data transfer if you are using your phone since sometimes it makes some problems. There will be a tasmota-something network and connect to it. In addition, open your browser and enter in the address bar.

Tasmota Wi-Fi config

Tasmota Wi-Fi config

First chose your Wi-Fi network SSID and enter a password for it. Watch the browser because when it connects to your Wi-Fi it will show you its new IP address. Secondly, write it down or remember it. Third, connect your phone or laptop or whatever you are using back to your home network and enter that IP address in your browser.

Configuring module

Now you go to configure and configure other and paste this into Temlate:

{“NAME”:”Sonoff THR320D”,”GPIO”:[32,0,0,0,226,9280,0,0,0,321,0,576,320,9184,9216,9312,0,0,9313,9248,0,1,0,3840,0,0,0,0,0,0,0,0,0,0,0,0],”FLAG”:0,”BASE”:1}

Module configuration

Module configuration

Select activate, further save. Afterward, the device will reboot.

After that, go to Configure, Configure Template.

Configure Template

Configure Template

Under GPIO25 find Si7021. Si7021 is the actual name of the temperature and humidity sensor that Sonoff calls THS01. You will not find THS01 in tasmota configuration. After that save the configuration. That is it you are ready to roll.

Sonoff THR320D with Tasmota

Sonoff THR320D with Tasmota

The device LCD works and displays temperature and humidity, controls from tasmota work also.

Now it is up to you, how to use it. I personally like to configure it for MQTT and Domoticz, but this device has many uses….

If you like this article and want to learn how to link similar device to Domoticz you can read about it in “DIY server room monitoring” article.

Thank you for reading.


Posted in *.*, Home Automation, Micro controllers Tagged with: , ,

Tasmota ESP8266 Sensor station
February 3rd, 2020 by Chief

How does monitoring Temperature, Humidity, Pressure,  Illuminance, and Air quality sounds like? Well, it sounds great especially if we can do it in under 50 US $ budget, and it even has some basic weather prediction functions, when combined with Tasmota and Domoticz.

Why measure air quality?

We had a situation in the city where people started to get sick with respiratory problems at the mass level and it was obvious that a major problem is the quality of the air. I mean it was noticeable with the bare eyes and nouse but authorities kept saying that air is ok, and they were publishing fake results. Moreover, results were in the form of a statement like “Air quality is at a satisfactory level”. Yes, it is ok if you ar an internal combustion engine with a great air intake filter!

How could air become so bad in a city without industry?

This started happening with the beginning of a heating season, and it was just a coincidence that the city got a brand new heating plant. Well, later we find out that it was not exactly in city ownership. Moreover it is a privately owned and operated, with a nice and lucrative contract. In fact, the new plant is so nice that they shut down former plant (with chimneys like two times higher than those at the new plant) that was owned by the city and the only heating option left is this new monster that uses wood as a fuel. I could write a completely new story on this subject, but I will stop here.

Why Nova SDS011 PM sensor?

I came to learn about it from the necessity. I wanted to see what is going on with the air pollution and I found a bunch of sensors there on the market but did not know where to start. In fact, one independent journalist brought few “Purple Air” sensors and installed them around the city, and the results were catastrophic. For example, they measured 300 – 500 (US EPA PM2.5 AQI ) almost all the time for 2 months. On the other hand, 0 – 50 is ok on their scale and that scale ends with 500.

These purple air sensors cost around 250 US $ so they are not so cheap. On the other hand, you just have to put it on a good spot, connect it to Wi-Fi and power. But it is very enjoyable to build something yourself so, DIY again 🙂 . Just one more comment, authorities said that these “so-called” measuring devices like “Purple Air” sensors are not calibrated, and not attested by their accredited agency so the results were wrong. As soon as they started talking things like that, the air became so pure and enjoyable to breathe that everyone was so shocked and happy to have the opportunity to live under so wise rule.

Joost Wesseling (RIVM) – Air quality measurements using cheap sensors

What convinced me even more that I`m on the right track was Mr. Joost Wesseling from The Netherlands National Institute for Public Health and the Environment, keynote at the Things conference in Amsterdam. If you read this article until now, it means you are interested and I warmly suggest you watch this 25-minute video .

Back to technical stuff…

First, we will make a little bom (bill of materials) containing major parts. After all, we are building a quite complex device. Therefore we must know what parts do we need.

PartPrice US $
1. ESP8266 development board2.8
2. Nova PM sensor SDS011 High precision laser pm2.5 air quality detection sensor module 18
3. BME280 temp hum baro sensor 3V3
4. BH1750 light intensity illumination module 3V2.5
5. 5V 2A power supply3
6. Some wires, cables, connectors, screws, cable ties and a box…10

Regarding tools needed for the job, I used: soldering iron, hot glue gun, small drill, angle grinder, few screwdrivers, cutting pliers, multimeter, smartphone and a computer.

Since I had to order some parts from China, there was not much to do until they came. I was killing some time wondering how to assemble everything together. What will I use as housing? I went through some stuff I had and noticed the old HP Inkjet printer power supply. I opened it and after measuring the size, it looked like everything could fit in nicely. And it did, so this power supply casing was a box for my sensors device.

Nova SDS011 PM sensor
Nova SDS011 PM sensor fitted in the box

First I put everything together to see how it works. I had a doubt regarding connecting two i2c sensors in parallel (doubt was about addressing not about can it work or not). BME280 and BH1750 are both connected to scl and sda pins of ESP, and I did not now will Tasmota firmware be able to discover them both without fine tuning. But it worked like the charm from the start.

Wiring diagram of the Tasmota and Domoticz sensor station with SDS011 air quallity sensor.

Wiring diagram

Wiring diagram
Wiring diagram as simple as it can be

Regarding wiring, SDS011 talks on serial, so RX goes to ESP TX and TX goes to ESP RX. +5 Volt from SDS goes to Vin on ESP with the assumption that you will connect that pin later to the power supply of 5V DC. This sensor working voltage is 4.7 – 5.3 V, so do not connect it to 3 V pin, it is to low and it may affect readings. As always ground goes to ground. BME280 and BH1750 use the I2C bus, so their SCL (Serial Clock) together goes to ESP SCL which is on pin D1, and SDA of both sensors goes to D2 on ESP since it is Serial Data pin. Sensors VCC connects to a 3V pin on ESP. We already know about ground :).

Handling SDS011 while working

Just to mention that it is not a bad idea to cover air inlet and outlet of a sensor while you work around it, especially drilling or grinding, to prevent dirt to pollute sensor. When all rough work is done, remove the covers. Better safe than sorry.

Covered air in and outs of a sensor.

How it fitted together

Since the goal was to make it nonexpensive, and yet durable and to finish it fast, this is what I did regarding assembly. I positioned the Nova SDS011 sensor on one side of the box, put a microcontroller next to it and then made some physical barrier to create a compartment for BME280. The reason I wanted it separated was the intention to remove it from any heat dissipation that the ESP8266 board produces no matter how small it is. That way alteration of the temperature reading would be minimized.

Positioning components inside the box

I made a socket for the ESP development board on the prototype PCB, so it can be removed, or replaced easily without any soldering. After all this sensors unit is a prototype. The micro USB connector on the board is accessible when the box is open in case it is needed. There are markings on board so there will not be the accidental wrong insertion of ESP board.

Socket for ESP development board.
Some in image explanations regarding Tasmota  sensor station with SDS011 air quallity sensor.
Some in image explanations

Installation for test measurements

Tasmota and Domoticz sensor station with SDS011 air quallity sensor.
Sensors device installed just near the roof
Tasmota and Domoticz sensor station with SDS011 air quallity sensor.
Place where I installed device on the house

Well, I had the opportunity to dig in some cables since there is still no facade on the house, and I put a few UTP cables in. I used one for PoE camera, other for sensors device power supply, and since this is the IoT time, I left two more cables to wait for it 🙂 . First, I chose this location thinking, that it is high enough from the ground to prevent dust and some other near ground particles to contaminate sensor readings. Second, it is far enough from the roof to have its heat dissipation mess with the temperature readings. Third, it is enough protected from the rain and both air openings are from the bottom so it should be impossible for rain to get into the device or sensors.


Everything built here is a piece of junk without the software.

Tasmota had been flashed on to the ESP. Tasmota will be sending data from sensors to Domoticz. I will not enter into many explanations here, you can find needed information at those two links. I also uploaded flasher and two needed .bin`s here. Firmware is 7.2.0, and it will be obsolete very soon. I put it for those of you that like shortcuts 🙂 . It will do the job, and later you can upgrade.

Flashing ESP with Tasmota firmware

There are literally tons of information regarding the process out there, but I will put it in very short terms again here. 1. Connect ESP to your computer, figure out what com port is it using and configure Tasmota flasher accordingly. 2. Press taster for entering flashing mode and then press the reset taster on the ESP dev. board. 3. Release the reset taster, and then release the first taster on ESP. 4. Select the tasmota-sensors.bin in flasher and then send it to the device. (tasmota-minimal.bin is needed only if you are doing OTA (over the air) upgrade).

Configure module pins with sensors.

We now need to tell Tasmota, what sensor is connected to which pin on the ESP board. I attached the screenshot of the config and when compared with Wiring diagram it is self-explanatory.

Configure Tasmota module
Configure module for connected sensors

Results from Tasmota and Domoticz

When flashed and configured, here is how Tasmota web interface looks like. You just find its IP address on your dhcp server (it will be showed as sonoff-acb or tasmota-xyz or something like that) and enter that IP address in your browser. It is nice to make a reservation (or static assignment) on dhcp so address stays the same. On that interface you can basically read values from the sensors and configure, backup or upgrade Tasmota.

Tasmota ESP8266 Sensor station
Tasmota ESP8266 Sensor station

This is how the results from Domoticz look like.

But it is not just about reading values that came just now, logging gives the real power…

So, from the PM 2.5 monthly shows some real air quality statistics although my sensors unit is still not operational for a full month. One more thing to remember, this shows pollution in PM2.5 μg/m3 (raw) and the usual standard is US EPA PM2.5 AQI. That means if you are going to compare it to “Purple Air” you need to convert, or at change units displayed on Purple air (it is on the map). Anyway these raw readings converted to AQI are much higher, so you know what to expect.


I wrote this with a simple intention. That is to show how easy to build and inexpensive this kind of sensors unit can be. I hope it serves as a warning and a manual.

If you find this article interesting maybe you should check on this one regarding fixing a “weather unknown” message. Once again, thank you for reading, and if you have any questions or need help, just post a comment. I’ll get in touch with you asap.


Here is a little update on Jully 2020. , a friend send me a few pics of his “do it fast” sensors station. He even added external Wi-Fi antenna for a better connection range.

Posted in *.*, DIY, Home Automation, Micro controllers Tagged with: , , , , ,

February 3rd, 2020 by Chief

Wondering how to add an SDS011 air quality sensor with Tasmota to Domoticz? Here is a step by step guide how to do it.

First, we need to start with the Tasmota configuration. In addition, let`s just assume that we have a hardware sensor like this built. Above all, now we need to configure it.

Flashing ESP8266 with Tasmota Firmware

It is easy so I`l make it as short as possible…

Here are a flasher and 7.2 version bin if you want to start right now. 1. Connect ESP to your computer, figure out what com port is it using and configure Tasmota flasher accordingly. 2. Press taster for entering flashing mode and then press the reset taster on the ESP dev. board. 3. Release the reset taster, and then release the first taster on ESP. 4. Select the tasmota-sensors.bin in flasher and then send it to the device.

Wi-Fi configuration

Further, after flashing just do a regular reset and you are ready for initial configuration. Therefore you need to connect to Tasmota via WiFi as it now acts as a hotspot. For instance, you could use your smartphone to scan for available WiFi networks and you should see one with “tasmota” in a name. Connect to it and it will show you “sign in” message. Click on sign in and it will open Tasmota configuration site. Here are screenshots in a gallery.

When flashed and configured, here is how Tasmota web interface looks like. Just find its IP address on your DHCP server (it will be shown as tasmota-ACB or something like that) and enter that IP address in your browser. It is nice to make a reservation (or static assignment) on DHCP so the address stays the same. On that interface, you can basically read values from the sensors and configure, backup or upgrade Tasmota.

Configure Tasmota Module for the sensors

This should be easy. SDS011 is connected to the Rx and Tx ports of the ESP board. Above all, remember that Rx and Tx need to be crossed (Rx goes to Tx, and Tx goes to Rx). Imagine it like talking. When You talk (Tx)then I Listen (Rx), and vice versa. We are talking about wire connections right now. Now we move to a logical connection. For TX (GPIO1 serial Out) chose from the drop-down menu SDSx1 Tx(101), for the (RX GPIO3 Serial In) chose SDS0x1 Rx (70). In this example, I connected more sensors. It means more pins need configuration. For more info about wiring go to this article.

Configure Tasmota module with pins of SDS011 and other sensors.
Configure module for connected sensors

Configure Tasmota to send data to Domoticz

First of all, Tasmota is not gonna talk directly to Domotics. Therefore you need to have an MQTT broker up and running. Moreover, in most cases, it is a Mosquito and it is installed on the same machine as Domoticz. Under this assumption, we will continue configuring Tasmota. On the MQTT menu, you only need to edit the first field named Host(). There you enter the IP address of your MQTT broker. If it is installed on the same machine as Domoticz than IP address is the same. If you left everything on default values during Mosquito and Domoticz setup, no need to do anything else here.

Configure MQTT for data from SDS011 and other sensors to be sent.
Configure MQTT

Configure Tasmota and Domoticz in pairs

This part can be a little tricky if you do not know how MQTT, and Domoticz work, but I will try to make it clear and in pairs, so it is easier to understand it. First, we will deal with SDS011. Since it has readings of PM 2.5 and PM 10 we will need to create two virtual sensors. Moreover, since the process is the same only one will be shown here. You go to Domoticz website- Setup menu in the top right corner then hardware, and after that chose “Create virtual sensor”.

Domoticz - Add virtual sensor that will  display SDS011 PM 2.5 data.
Domoticz – Add virtual sensor

Then you name it PM 2.5 since it will be for that sensor data, chose “Custom sensor” from the drop-down menu, and add “μg/m3” as axis label as these are the units that sensor actually measures.

Add custom sensor Domoticz for displaying air polution data from SDS011
Add custom virtual sensor Domoticz

This virtual sensor is gonna display data from the SDS011 physical sensor. Meanwhile, next thing to do in Domoticz is to go to Setup/Devices and check the “idx” of the newly created sensor. You can find it at the end of the list or by searching for its name.

Check the idx of newly created virtual sensor that will display SDS011 PM 2.5 data.
Check the idx of newly created sensor

It`s time to follow this setting in the Tasmota Domoticz menu. Idea is to configure tasmota`s predefined value (in this case Sensor idx 7 Voltage/PM2.5 with idx of the newly created virtual sensor named “PM 2.5” in Domoticz. So we enter the value of 192 to that place.

Configure Tasmota for Domoticz

Configure Domoticz setting in Tasmota for SDS011 and other sensor to be sent accordingly.
Configure domoticz setting in Tasmota

Further, I will explain the creating and mapping of a Temp+Hum+Baro virtual switch. Proces is the same, create virtual switch but this time chose like this:

Temperature Humidity Barometer VS
Temperature Humidity Barometer VS

Again check the idx of the virtual sensor on Setup/Devices menu

Temp hum baro idx
Temp hum baro idx

After that, we go back to the Tasmota page and into Domoticz menu and this time set the value of the ” Sensor idx 3 Temp,Hum,Baro” to 148. This has to be repeated for every sensor added, on both sides!

How it looks in Domoticz

If you find this article interesting maybe you should check on this one also. Once more, thank you for reading, and if you have any questions or need help, just post a comment. I’ll get in touch with you asap.


Posted in *.*, DIY, Home Automation, Micro controllers, Tech Tavern Tagged with: , , , ,

May 21st, 2017 by Dr_Kosh

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]Why?[/neovantage_title]

After reading an article from Editor, here at techestigate, about programming for kids and inspiring comment from our reader Ann, “How to get them interested in learning”, I started to think about such a way to start.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]Some history[/neovantage_title]

A lot has changed from late 80`s when I was a teenager. It is hard to explain to my kids how was life back then without mobile/smart phones, tablets, laptops, smart wear etc. My exposure to electronics started with ZX Spectrum and Commodore 64. Later it was HP 28s scientific calculator that got me interested in programming and computer science.

micro by BBC

Original BBC Micro

Back in 80`s BBC (British Broadcasting Corporation) made BBC Microcomputer System, or BBC Micro, a series of microcomputers and associated peripherals designed and built by the Acorn Computer company for BBC Computer Literacy Project. BBC Micro was designed with an emphasis on education. It was notable for its ruggedness, expandability, and the quality of its operating system. The BBC Micro system was adopted by most schools in the United Kingdom. It was also moderately successful as a home computer in the UK despite its high cost. As a side note, Acorn also employed the machine to simulate and develop the ARM architecture which, many years later, has become hugely successful for embedded systems, including tablets, cellphones and microcontrollers. In 2013 ARM was the most widely used 32-bit instruction set architecture.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]S.T.E.M.[/neovantage_title]

At the dawn of second millennium new academic discipline called STEM (short for Science, technology, engineering and mathematics) arose. The term is typically used when addressing education policy and curriculum choices in schools to improve competitiveness in science and technology development in an interdisciplinary and applied approach. Rather than teach the four disciplines as separate and discrete subjects, STEM integrates them into a cohesive learning paradigm based on real-world applications. What separates STEM from the traditional science and math education is the blended learning environment and showing students how the scientific method can be applied to everyday life. It teaches students computational thinking and focuses on the real world applications of problem solving. STEM education begins while students are very young, as early as grade 3 (age 9+).

Idea is very simple make use of programming as learning tool, learn to program then program to learn. Science, technology, engineering, and math these are all areas of learning that our kids need to be comfortable with to excel in the future. STEM makes creators, thinkers, problem solvers, doers, innovators, and inventors. Exposing kids to simple STEM ideas at an early age today sets a foundation for higher learning tomorrow.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]Micro bit[/neovantage_title]

So far, we were going over “how to motivate” part of our question. Let me talk a bit about micro bit itself.


Micro bit by BBC

Again after 30 years, the BBC turn to good old idea, just this time they are calling it BBC Micro Bit. Planning for this project began in 2012 as part of the BBC Computer Literacy Programme and by the time of the launch in July 2015 the BBC had taken on board 29 partners to help with the manufacturing, design, and distribution of the device. The BBC has said that the majority of the development costs were borne by the project partners, and it intends to license the technology as open source and allow it to be manufactured around the world for use in education, and it has formed a non-profit company to oversee this.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]What is it?[/neovantage_title]

The Micro Bit was designed to encourage children to get actively involved in writing software for computers and building new things, rather than being consumers of media. The BBC planned to give away the computer free to every year 7 (11- and 12-year old) child in Britain starting from October 2015 (around 1 million devices). In advance of the roll-out an online simulator was made available to help educators prepare, and some teachers were to receive the device in September 2015.


Micro bit – Cisco

Thanks to Cisco conference (and my coworker that has attended it and donated a micro bit) held locally I was able to get Micro Bit. Cisco is one of project supporter along with Microsoft, ARM Holdings, Samsung, Python Software Foundation, Lancaster University and many other.

The board’s graphical design is intended to appeal to children and vaguely has the shape of a face (are the push buttons its eyes or the Micro bit logo?) with different silkscreen hairdos of several colors. The board was also designed with safety in mind, which is why it is powered from an external battery pack (two AAA 1.5 V cells) instead of from an on-board button cell as was the case for earlier designs. Power can also be applied through the USB connector.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]What can be done with it?[/neovantage_title]


Micro bit overview

Besides scrolling text messages and producing other visual effects on the LED matrix the micro bit can be used for many other applications. Because of its battery pack and Bluetooth LE connection the board is an excellent candidate for the Internet of Things (IoT), and wearable and mobile applications. Its on-board sensors allow for orientation and movement detection making it suitable for games and game controllers or remote controls for other devices. The board can also be used as the brains of an application, like a robot or cart, by using the extension connector.

The edge extension connector breaks out 19 GPIO pins of the main MCU (plus power supply), giving access to the pushbuttons, six analogue inputs, a SPI bus and the I²C bus that is also connected to the accelerometer and magnetometer. Furthermore, five pins have been designed as large holes to accept banana plugs and crocodile clips for quick and easy connections to breadboards and other hardware.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]How to program it?[/neovantage_title]


Programming micro bot

Since the ultimate goal of the BBC is to get children to create software, the micro bit is supported by a suite of online programming tools targeted at novices. Currently four different languages are available: Block Editor and TouchDevelop, both from Microsoft, a visual JavaScript editor from Code Kingdom and MicroPython. The more advanced user can also program the board directly in C/C++ from the ARM mbed development environment.

The micro bit website provides four online development environments, which range from the click-and-drag interface of Microsoft Block Editor to hybrid environments such as Code Kingdoms JavaScript editor and Microsoft Touch Develop. There’s also a highlighting text editor for writing MicroPython scripts, which includes built-in documentation and simple code snippets yet feels very similar to a standard desktop highlighting editor.

Projects are available for all of the languages and editors, starting with Block Editor, the simplest, and moving up to MicroPython, which gives you the most versatile interface and the widest range of transferrable programming skills. There’s also a micro bit Android app, although the process of pairing it via Bluetooth is a little frustrating, thanks to some awkward button-pushing gymnastics, six-digit pairing codes and an infuriatingly short window in which to enter them in the app. Rather than having its own coding interface, the app sends you to the website where you can use editing tools you’re already familiar with.

[neovantage_title size=”3″ align=”left” separator=”none” subtitle=””]Conclusion[/neovantage_title]

For its size, the micro bit is an incredible educational tool that will let teachers, parents and students have fun with code to create games, wearable tech and other devices as yet to be imagined. Its small size and built-in sensors make it quick to code and entertaining to use, but it’s really designed for education and is a springboard to bigger more complex platforms rather than a rival to the likes of Arduino and Raspberry Pi.

Posted in Kids, Micro controllers

April 3rd, 2017 by Chief

There is a new and interesting campaign running  @ Kickstarter regarding the creation of the first Arduino based ECU. First of all, let`s discuss some things about ECU. What is ECU? Ecu or engine control unit is something like a brain for your car`s engine. It harvests information from many sensors, and controls many actuators on the internal combustion engine, to ensure optimal performance. It does this by comparing data from sensors, with ECU maps or so-called lookup tables and adjusting the engine actuators accordingly. So basically ECU is a small and very rough microcontroller with some specialized inputs and outputs, packed in a waterproof casing, with big tolerance for low and high temperatures, and vibrations. The use of the ECU`s in Car industry started in the 80s and they started pushing out old mechanical and pneumatic means of controlling systems like air-fuel mixture, ignition timing, and idle speed. But enough about ECU itself, there is plenty of information to be found all over the Internet.

The big thing is that the manufacturing of ECUs was reserved for big players like Bosch Electronics, Denso, Delphi, Steyr, and some others. Now a new player is coming and it is going to be an open-source platform. It will also be developed in a few versions, each supporting different features. It is important to know that these days ECUs moved from just controlling internal combustion engines to whole new sets of features and capabilities, like GPS, Wi-Fi, Bluetooth, CAN, GSM and many more. All details about this exciting project can be found on its Kickstarter project page. Be aware of a little detail that I noticed regarding this project. By definition, ECU stands for an Engine Control Unit, and this project has the same three letters, but they stand for Electronic Control Unit, so just stay informed if it could affect your needs. Be sure to support this great project if you can since it will bring the power of ECU (whatever 3 words letters represent) to small manufacturers, hobbyists, geeks and other weird people that crawl around 🙂 .

Once again thank you for reading.


Posted in Micro controllers Tagged with: , , , , , ,

August 8th, 2016 by Chief


we would like to share with you some knowledge and experience about the home microcontroller playground.
Arduino microcontrollers will be in focus.

First of all, let’s start by asking ourselves, what is a microcontroller and why do we need it? Someone would even ask does it have anything to do with Microsoft? 🙂 (Just kidding 🙂 )

So here is a basic and simplified definition from Wikipedia:

A microcontroller (or MCU, short for microcontroller unit) is a small computer (SoC) on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory is also often included on-chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general-purpose applications consisting of various discrete chips.

So, let`s take a look at few most common used MCU boards:

First, we will speak a little bit about  Arduino Nano:


Arduino Nano

Its dimensions are around 4.5 x 1.6 cm 1.8″ x 0.62″  and power consumption at 7 V is 20 mA, so small measures make it perfect for small consumption sensitive applications (Weather station that runs on batteries or solar power or something like that) and price of approximately 2.5 $ makes it great choice for a small hobby projects.

Name Processor Operating/Input
CPU Speed Analog In/Out Digital IO/PWM EEPROM [kB] SRAM [kB] Flash [kB] USB UART
Nano ATmega168
5 V / 7-9 V 16 MHz 8/0 14/6 0.512
Mini 1

Now let us explain some of this stuff:



This means that this board is in the manufacturing process with two processor types, and depending on that there may be more variations between those two boards (clock speed, amount of memory, etc.) If any of this may be important to you watch out what version of the board do you buy since there can be a price difference too.


5 V / 7-9 V

It means that microcontroller works on 5 V  (when you connect the board to your computer USB port it will get power also and start working) and when you supply it with external power it should be 7-9 V.

This is because this board has its own voltage regulator and it needs some voltage difference to let`s say make it work as it should or to stabilize the voltage at 5 V.This is also its logic level.
(Remember that with these boards we always talk about DC current).

Analog In/Out


A number of analog Inputs and Outputs, it is number of pins that you can connect analog signal to. In this case, it means 8 analog inputs and 0 outputs. Why do we need that some may ask?

Let us try to make it as simple as possible, microprocessor works with digital signals, it is it`s an advantage , and now we want to process some analog signals, how is that possible?

Well MCU has some analog to digital converters built-in, sometimes referred to us as ADC, and what they do is convert an analog signal or voltage on a pin to a digital value or a number. By converting from the analog to the digital, we can begin to process analog information’s in our programming and later make some decisions or actions based on this same info.

The main parameter of ADC is its resolution and it is measured in bits. Generally, Arduino ADC is 10 bit, and it means that it can detect 1024 different analog levels it is (210) More bits means better resolution. So if an ADC is 5 V logic level, it means that 5 V on the input pin would equal 1023 read value.
Or put it in formula Resolution of ADC\system voltage = ADC reading \ analog voltage measured.
The logical goal at this moment would be to find ADC reading, and that would be 1023\5 *analog voltage measured. For example, if we have 3.4 volts on analog input, the digital read would be 1023\5*3.66  and that is 750. So now you know in this particular case that voltage of 3.66 volts equals 750 digital read signal. So…. what would we need that information? Imagine that you want to monitor the status of a battery and if it gets to low you want charging to be activated. let’s say that this voltage trigger is 3.6 V  or as we calculated  750. Now let’s make a statement that something called x is 750. To put it in most simple words you would write in your microcontroller program something like this: if x<750 turns on relay 1. (Let`s imagine that relay1 activates battery charger). This is just a simplified explanation, not a coding language, but it is not much more different than that.

Now, someone would ask, but what if we want to measure car battery voltage, that should be around 12 V, and in the last example, we can notice that the biggest measuring voltage can be 5 V. Well, that would be great observation, but there is a play around it :). It is called voltage divider but we will come to it later.

Digital IO/PWM

14/6, in this case, it means that this board has 14 digital inputs or outputs, of which 6 can be PWM outputs. Huh, what are you talking about here? Are they inputs or outputs?  And what is that PWM???

Ok, let’s start one by one…

If it says 16 digital Inputs/outputs it means that every one of those pins can be either input or output, digital of course. So how do you make it one or the other way? Let’s presume that we want to connect LED to pin digital 3 on Arduino and to turn it on from time to time, or to make it blink. The simple conclusion is that current will flow from Arduino to LED so the Arduino pin is output.

In coding language it would be like this:

int ledPin = 3;

pinMode(ledPin, OUTPUT)

So what we did, first of all, we said that something that we will call ledPin is on digital pin 3 of Arduino board and that we said that it is going to be output. Quite cool, isn`t it?
We could call it John`sPin or Laker`sPin, or KlingonPin, but we would like to know what is it for, so we should have some naming convention established, but this is enough for now since we still do not know what is that PWM and what is it for?

Here we will not reinvent the wheel, but here is just a definition from (your favorite site from now on 🙂 ) :

“Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full-on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of “on time” is called the pulse width. To get varying analog values, you change or modulate, that pulse width. If you repeat this on-off pattern fast enough with an LED, for example, the result is as if the signal is a steady voltage between 0 and 5v controlling the brightness of the LED.”



This is an example of how the PWM signal would look like on the Oscilloscope.
But why is it so important, if we would only like to control the brightness of LED I could use resistors or a trimmer, it is more simple…..  well maybe but what if I would like to control a big DC motor? The answer is PWM is your type of signal :). The example of using PWM for controlling the speed and power of the DC motor is a cordless drill. There you have one small PWM regulator, and more you press that start button below your finger more speed and power your drill delivers, and if you would put an oscilloscope on motor terminals you would see signal like on the picture above, going from top when drill is off to bottom as button is fully pressed.



The microcontroller has EEPROM (Electrically Erasable Programmable Read-Only Memory) and it is a memory whose values are kept when the board is turned off (like a tiny hard drive).
For now, let`s say that this is not something that would consider you on an everyday basis, but if you want to know more about the subject, Mr. John Boxall has greatly explained it here:



Hm…. you did not read carefully didn`t you? 🙂 Why 1, and 2 kB? Of course,  two versions of the board , two different microcontrollers, and a different amount of memory. If you expect to have memory problems, watch over it (of course who would expect memory problems at the beginning of a project 🙂 ). To put it simple bigger the number = better for you.
What is it for?
SRAM (static random access memory) is where the sketch creates and manipulates variables when it runs. Again, the bigger the sketch = more memory to keep it running.

Intruder alert: .. what is a sketch?

The sketch is basically Arduino program. It is a peace of code that is uploaded to, and run on the Arduino board.
These days it has a .ino extension and is produced by Arduino IDE.

Let’s continue, next is Flash memory:


Again two different boards issue…

Flash memory (program space), is memory space where the Arduino sketch is stored.
More memory = better for you = bigger sketch can be stored.



Type of USB connector onboard.



The native serial support happens via a piece of hardware (built into the chip) called a UART (Universal asynchronous receiver/transmitter).
This hardware allows the Atmega chip to receive serial communication even while working on other tasks.
So basically it is a hardware serial port. This particular board has only one, and you may want to keep those two pins free, or you may end up with problem uploading sketch to a board or using the serial monitor. There is also software serial, and for some applications, it can be used, but generally, baud rate should be kept low (9600) or errors may appear. 

So this concludes explaining some basic terms, facts, and features of the microcontroller board. Let us now continue with introducing a few of our favorite MCU`s

Next is our well known may be the most common board Arduino UNO


Arduino Uno

It`s dimensions are around 7 x 5.5 cm or 2.7″ x 2.2″ and power consumption at 7 V is 20 mA 50 mA @ 7V and it`s price is about 4 $. We often say around since there are many different versions of the same board and this information is just for you to get the idea of sizes. This board is the most common beginner’s choice, great for many projects, very well documented, many examples, many Shields.

Did we just say, Shields? What is the shield? Do we need some kind of protection from this MCU stuff? 🙂

Again, not to reinvent the hot water here is official Arduino definition: “Shields are boards that can be plugged on top of the Arduino PCB extending its capabilities. The different shields follow the same philosophy as the original toolkit: they are easy to mount and cheap to produce”. If you are interested, a complete list of both official and unofficial shields can be found here:

Ethernet shield

Uno with Ethernet shield

Here is a picture of Arduino Uno with Ethernet shield plugged on top. Ethernet shield as it would sound logical gives networking capabilities to Arduino. For example, you could run a web server on your Arduino, and post some data on it, or even make it so that you can turn on / off some relays through a web page, or transmit some sensor readings to services like thingspeak, or .
Not to wander off again, here are specs of UNO:

Name Processor Operating/Input
CPU Speed Analog In/Out Digital IO/PWM EEPROM [kB] SRAM [kB] Flash [kB] USB UART
Uno ATmega328P 5 V / 7-12 V 16 MHz 6/0 14/6 1 2 32 Regular  1

Now it`s time to move on and next on our list is Arduino DUE


Arduino Due

It`s dimensions are around 10.2 x 5.5 cm or 4″ x 2.1″ . Power consumption when running code is still unknown but will be tested and published soon. The price of a 15 $ makes it a little more expensive, but hey it is one of the most powerful Arduinos these days, so maybe it`s worth considering it as a choice for your next project.

There is one more very important thing to consider about DUE: Its logic level is 3.3 V so take care, if it`s gonna “talk” with some other devices, make sure that they are also at 3.3 Volts ll or you may end up with burned or at least damaged Arduino. The same goes for sensors, shields, etc. . On the other hand, you can mitigate that problem by using logic level converters, but that is another story, for now, let`s try to keep things as simple as possible.

But wait, did we few sentences before, just mention sensors? What about sensors? What kind of sensors? Well, that is the beauty, all kind of sensors are there for MCU`s and especially Arduino…
Let`s first observe DUE`s specs, and then we will return to the sensor story.

Name Processor Operating/Input
CPU Speed Analog In/Out Digital IO/PWM EEPROM [kB] SRAM [kB] Flash [kB] USB UART
Due ATSAM3X8E 3.3 V / 7-12 V 84 MHz 12/2 54/12 96 512 2 Micro 4

If we compare it to Uno we see a dramatic increase in everything, CPU speed, nobler of both analog and digital inputs, some analog outputs, more ram and flash, more UART`s, and of course it is not 5 but 3.3 volts logic level. This particular board is a real small little IOPS (inputs-outputs) monster. It can interconnect with the whole bunch of sensors, relays, and other things, and it has the juice to process them. Great board for almost any kind of project, but keep in mind that it is 3.3 V operating voltage.

Now back to sensors, let’s make it a little more imaginable, what sensors are, and what they do…

A sensor is a device that detects and responds to some type of input from the physical environment. The specific input could be light, heat, motion, moisture, pressure, voltage, current, sound, weight,  or anyone of a great number of other environmental phenomena. Some sensors are only able to detect the change, but some are able to even measure that change very precisely.
Here are pictures and descriptions of some of our favorite sensors:

MQ-2 sensor:



This sensor is able to detect flammable and combustible gasses like Methane, Butane, LPG, and smoke.It may be great for a home fire/gas warning/alarm system.
The price is about 1.5 $.

MQ-7 sensor:



This sensor is able to detect  Carbon Monoxide, so in combination with MQ-2, you get a great early warning gas detection system.
One more thing to address here, there is a common myth that Carbon Monoxide is heavier than air. Whoever says that is wrong! CO has a molar mass of 28.0, and air has an average molar mass of 28.8, so it is, in fact, a little easier. It can be assumed that weight of air and CO is the same, and since CO is usually produced from incomplete combustion (heat source), it can be also assumed that CO will move in direction of hotter air, and warm air is more buoyant than cold air so it rises. Following this logic and fact that CO is lighter than the air I would personally put my CO detector on higher place or at the ceiling near the heat source. One more thing CO is odorless, colorless and tasteless, so without the detector it is impossible to notice, that is why it is called “silent killer” and that nickname is well earned. So, MCU`s can even save your life sometimes……
The price of the MQ-7 is about 1.6 $.

Back to sensors…

Dallas DS18B20 temperature sensor:




DS18B20 waterproof

It measures temperature in 9-12 bit values (0.5 deg precision) in range of -55°C to +125 Celsius degrees (-67 °F to 257°F)

It comes in two forms, or packages: TO-92 casing (not waterproof, good for measuring air temperature) on the left picture, and Etanche or Waterproof casing, on the right picture.
These sensors are easy to use, connect and read. Multiple sensors can be connected to the same input since they each have hardware addresses burned in. If you are gonna use a few sensors, like 2 or 3 and have enough inputs free on your MCU, use separate input pin for every Dallas sensor, it is easier since you do not have to read hardware addresses of sensors, and then target them to read data. The waterproof version is great for measuring the temperature of liquids, and other things and places where to-92 would be impractical or on the harm’s way. It can be connected to MCU with 2 or 3 wires, both ways work well, and fewer wires mean more simple and practical, so take your pick.
The price of DS18B20 is less than 1 $ for the TO-92 version, and about 4 $ for waterproof version.

DHT11 Temperature and humidity sensor:



It is something like a combination of DS18B20 and humidity sensor. Humidity measurement range: 20% – 95%, temperature measurement range 0 degrees-50 °C . Humidity measurement error: +-5% ,
temperature measurement error: +-2 degrees. Great for hobby weather station projects. Its successor is DHT22 better range and more precise.
The price of DHT11 these days is about 1 $.

Soil Humidity Hygrometer sensor:

soil hygrometer

Soil Humidity Hygrometer sensor

The name of this sensor says enough. Why would we use it? Well, with this sensor stuck in-ground, MCU could “know” was or is their rain, and how dry or wet is soil, and based on that turn on or off the irrigation system.
The price of this sensor is below 1 $.

Infrared PIR Motion sensor:

pir motion sensor

PIR Motion

Motion detection sensor, great add for a homemade alarm system.

The price of this sensor is around 1 $.

Ultrasonic Module  sensor :



This sensor can measure distance in the range of 2 – 500 cm by the precision of 3 millimeters. Great add on for DIY robots or smart cars.
The price of this sensor is around 1.2 $.

Single Phase Voltage sensor :

voltage sensor

Single Phase Voltage

Monitor your mains voltage, for example, you can make MCU send a signal for the generator to start if the voltage goes below or above nominal value.
The price of this sensor is around 5 $.

microphone sensor


Microphone sensor
This sensor can identify the presence or absence of sound, based on that your MCU can make some actions, for example, if there is a sound detected, turn on light.
The price of this sensor is around 1 $.

Light sensor :

Light sensor


This sensor can detect light intensity. Based on this information your MCU can activate something else, for example, if it is a daytime do not turn on the watering system.
The price of this sensor is around 1 $.

Vibration switch  sensor :

vibration sensor

Vibration switch

This sensor is used to trigger the effect of various vibration, theft alarm, intelligent car, earthquake alarm, motorcycle alarm, etc.

The price of this sensor is around 1 $.

So, to conclude the story of sensors we can make the next conclusions:

  1. There are many many different types of sensors (light, sound, distance, voltage, motion, vibration, gas, temperature, moisture and many, many more).
  2. Sensors are quite inexpensive.
  3. A combination of different sensors can give your MCU interesting possibilities and decision-making information.

So sensors are great, and they can make our MCU playground even bigger and more interesting and productive.

It`s time again to move on and next on our list is Arduino MEGA 


Arduino MEGA

This is maybe the most commonly used and best money\features ratio Arduino board.

Its dimensions are the same as a DUE board or around 10.2 x 5.5 cm or 4″ x 2.1″. Power consumption when running code is still unknown but will be tested and published soon.
With price about 8$ whole bunch of In`s and out`s and decent memory and clock speed it is great for many applications and there is even an open-source 3D printer driven by MEGA.
If we compare it to DUE, it has the almost the same number of ports, slower processor and less memory, but it is a 5V board, so if you are gonna deal with 5V signals, chose this one. There are also different versions of this board, so less money does not necessary mean that you got a better deal. This is applied for all MCU boards since there is a big difference in quality from components used to soldering. There is also a whole mess about different markings, but for the most part, it is a marketing trick. You have Arduino Mega ADK (stand for Android development kit), then you have Arduino Mega 2560 but for the most part, those are the same boards.

Name Processor Operating/Input
CPU Speed Analog In/Out Digital IO/PWM EEPROM [kB] SRAM [kB] Flash [kB] USB UART
Mega 2560


Mega ADK

ATmega2560 5 V / 7-12 V 16 MHz 16/0 54/15 4 8 256 Regular 4

Now let`s observe some non-Arduino boards…

ESP8266 :


ESP 8266 v1

esp8266 2

ESP 8266 v7

Two different versions, version 01 on the left and version 07 on the right.

The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and microcontroller capability produced by Shanghai-based Chinese manufacturer, Espressif.
But what makes it so interesting? It has Wi-Fi but is also a microcontroller. So what? So you can use it in different ways, for example, it can work as a Wi-Fi interface for other MCU (like Arduino). In this case, it will transmit some data that another MCU gives it, over serial connection through Wi-Fi to LAN or to the Internet. It can also host a web server and present data to it. But I think that that was not in mind of designers od 8266. It is quite equipped to work as standalone MCU.
Here is manufactures general specs:

  • 802.11 b/g/n
  • Serial/UART baud rate: 115200 bps
  • Integrated TCP/IP protocol stack
  • Input power: 3.3V
  • I/O voltage tolerance: 3.6V Max
  • Regular operation current draw: ~70mA
  • Peak operating current draw: ~300mA
  • Power down leakage current: <10µA
  • +19.5dBm output in 802.11b mode
  • Flash Memory Size: 1MB (8Mbit)
  • WiFi security modes: WPA, WPA2
  • Module’s dimensions: 24.75mm x 14.5mm (0.974″ x 0.571″)
  • The CPU clock is 80 MHz
  • Number of GPIO`s depends on a board version

Yes we just said GPIO, so let’s explain it:

General-purpose input/output (GPIO) is a generic pin on an integrated circuit whose behavior—including whether it is an input or output pin—is controllable by the user at run time. GPIO pins have no predefined purpose and go unused by default. It is something like Arduino in`s and out`s. This little piece made an entire revolution on IoT playground, and we will not even try to go deep into a story about ESP8266 since there is so much blog posts, guides, Instructables, even whole blogs dedicated to it.
Thing is if you are gonna start playing with ESP, then you will soon learn what the hell is :). Why?

esp versions2

Bunch of ESPs

And even not all of them are here 🙂

But that is not all, you have also different command processors, for them. In the original version, they come with AT cp (those of you that remember dial-up times will know AT commands ), but there are also NodeMCU some others. We will soon write more details about ESP, to get you started…

Word of the author:

Well, it is time to end this story, I hope you find it useful, interesting, and if you have any comments, thoughts, or simply want me to test something, please leave a comment and we will get in touch.
Once again thank you for reading.


Posted in Micro controllers Tagged with: , , , , , , , ,