ESP8266 and DS18B20 – wireless ThingSpeak sensor

Here is another small project of mine: battery operated ESP8266 ESP-01 WiFi thermometer using DS18B20 and ThingSpeak API to collect data.

Before we proceed, you should:

esp8266 ds18b20 thingspeak sensor

Continue reading “ESP8266 and DS18B20 – wireless ThingSpeak sensor” »

Read More

ESP8266 ESP-01 Low Power Mode – run it for months

Amazing ESP8266 ESP-01 WiFi boards have pretty irritating problem: theirs power consumption is pretty high. Minimal power consumption of about 70mA when doing nothing and above 100mA when when transferring data makes it rather impossible to use it on battery power for a longer period of time. Set of 2 AA batteries would be drained in less than a day. Not good.

There is a way to make ESP-01 work for months using something called deep sleep mode. When in deep sleep, ESP8266 disables almost all of its functions and reboots after specified period of time. There is one catch: ESP-01 is capable to enter deep sleep, but unable to restart and resume operation. XPD_DCDC MCU pin in not connected to RESET pin. To fix it, you would have to solder thin wire between XPD_DCDC and RESET pin just like on a picture below:

ESP8266 ESP-01 Deep Sleep hack

Continue reading “ESP8266 ESP-01 Low Power Mode – run it for months” »

Read More

SmartPort inverter for F4 flight controllers

While STM32F4 family processors installed in newest flight controllers are superior to STM32F3 (and F1 of course) in terms of raw speed, they are inferior to F3 family in terms of IO handling capabilities. For example, F4 family is not equipped with UART port inverters. And that creates a series of problems when it comes to connecting various serial RX receivers and telemetry systems.

The most popular FrSky (Futaba) S.Bus serial RX protocol and FrSky SmartPort telemetry require inverted UART signal. If there is no hardware inverter on hardware UART port, they will not work. While S.Bus requires only one data line, external inverter is not a big issue. Some time ago I’ve published The Simplest Harware Inverter. One MOSFET transistor, one resistor and that’s all.

In case of SmartPort, it’s slightly more complicated. Not only signal is inverted, SmartPort also combines TX and RX UART line into single wire. That means the following:

  1. More complicated inverter is required
  2. Software has to support this case and fallback to unidirectional UART mode


Continue reading “SmartPort inverter for F4 flight controllers” »

Read More

Simplest hardware inverter for flight controller

Together with increasing popularity of STM32F4 flight controllers, telemetry became hard topic again. Why? Most popular telemetry protocols, SmartPort and FrSky telemetry , requires inverted signal. Zero becomes one, one becomes zero.

In case on STM32F3 that was not a big problem. Those CPUs have built in inverters. STM32F1 and STM32F4 does not. So, if flight controller designer did not put external inverters on UART ports, FrSky telemetry, SmartPort and even S.Bus would not work.

Luckily, simple inverter for FrSky telemetry and S.Bus can be build using only few electronic parts:

  • Small logic level N-channel MOSFET transistor. One of the best choices is 2N7000
  • 10kOhm resistor
  • few cables

Continue reading “Simplest hardware inverter for flight controller” »

Read More

MPU6000 vs MPU6050 vs MPU6500

MPU6000 and MPU6050

Deep down, MPU6000 and MPU6050 are the same same hardware. They both have the same 3 axis gyroscope and the same 3 axis accelerometer. Both allows max 8kHz gyro sampling rate. From a flight controllers point of view, the only difference between them is bus that connects them to CPU. MPU6000 allows for both I2C and SPI, while MPU6050 has only I2C. That makes MPU6000 better device, but only when SPI bus is in use. I2C is too slow to handle 8kHz gyro updates.



No, MPU6500 is a different monster. It supports both I2C and SPI, allows 32kHz gyro update rate and has much wider gyro signal bandwidth. Is also smaller and consumes less energy. So, in theory, it is much better device than MPU6000. There are some problems with it. First of all, it is much more vibration sensitive than MPU6000. While soft mounting of MPU6000 is usually not needed, MPU6500 will benefit a lot from it. Very often it is even required. Second of all, at this moment, only RaceFlight can utilize 32kHz gyro update rates.


MPU9150 and MPU9250

What are those two MPUs? It’s rather simple this time.

  • MPU9150 is a MPU6050 with integrated AK8975 magnetometer
  • MPU9250 is a MPU6500 with integrated AK8963 magnetometer

Images: 1 2

Read More

ATtiny85 Light Sensor – I2C slave device

I love AVR ATtinyx5 series microcontrollers. They are cheap, easy to use, they can be programmed just like Arduinos and comparing to their size they offer great features. For example, they can be used as remote analog to digital converters connected to master device using I2C bus.

Background: few year ago I've build a weather station based on Raspberry Pi. It collects various data and displays them on dedicated web page and Android app. Every few months I try to add a new sensor to it. Last time it was a daylight sensor. Raspberry Pi does not offer ADC inputs and I has few ATtiny85 on hand that time. One to another, few hours later: photoresistor based daylight meter sensor connected via I2C bus.

ATtiny85 as light sensor with I2C bus

Electric assembly is pretty simple: ATtiny85 directly connected to Raspberry Pi via I2C, photoresistor with 10kOhm pull down connected to ATtiny85 and signal LED.

attiny85 i2c slave light sensor with photoresistor

Code driving this rig is also pretty simple: watchdog timer wakes up ATtiny every few minutes, measures voltage, filters it and stores in memory. Every time read operation is requested, last filtered ADC value (10 bits as 2 bytes).

I2C support is provided by TinyWireS library that configures USI as I2C slave.

 * This function is executed when there is a request to read sensor
 * To get data, 2 reads of 8 bits are required
 * First requests send 8 older bits of 16bit unsigned int
 * Second request send 8 lower bytes
 * Measurement is executed when request for first batch of data is requested
void requestEvent()

  if (reg_position >= reg_size)
      reg_position = 0;

 * Setup I2C
TinyWireS.onRequest(requestEvent); //Set I2C read event handler

Example code to read from device might look like this:

Wire.requestFrom(0x13, 2);    // request 2 bytes from slave device #0x13

int i =0;
unsigned int readout = 0;

while (Wire.available()) { // slave may send less than requested
byte c =; // receive a byte as character

if (i == 0) {
    readout = c;
} else {
    readout = readout << 8;
    readout = readout + c;



Full source code is available on GitHub and my Weather Station with almost a year of light level history is available here.

Read More

Micro MinimOSD stops overlaying in flight: solution

Both MinimOSD and Micro MinimOSD suffers from irritating technical problem. In some setups, they stops overlaying data during hard maneuvers or even right after arming. Problem is very simple: chip MAX7456 is extremely sensitive in terms of supply voltage quality. Working motors and/or servos, can introduce enough power supply noise to occasionally force MAX7456 to reset.

Luckily, solution is simple: separate LC power filter or big enough capacitor connected in parallel to 5V pads of MinimOSD.

Almost any big enough electrolytic capacitor will do (> 100uF, the bigger the better) but best results can be archived with low ESR > 500uF capacitor.

In my case symptoms were not very strong, usually only very fast flips caused MAX7456 to reset, but I’ve decided to go big: 1000uF low ESR capacitor.

Low ESR 1000uF Capacitor

Micro MinimOSD has 5V pads on a side and they are the best place to attach capacitor.

Micro MinimOSD

As you can see below, capacitor is bigger than MinimOSD itself and I had to think a little how to place it inside my Reptile X4R 220 frame.

Micro MinimOSD with capacitor attached

Results are great: no more MinimOSD problems. OSD stays on all the time, no matter how hard I use the stics.

Read More

HC-12 433MHz RF serial module range test

As I mentioned in my first post about HC-12 433MHz radio modules, I’ve put my interest in them for telemetry purposes. While S.Port telemetry I’m using in FrSky Taranis radio might have higher range than HC-12, it is closed environment. Since $10 for a pair of HC-12 is not much, I’ve decided for more open DIY solution.

Setup on a quadcopter consist of one HC-12 configured for FU3 mode and baud rate 9600bps connected to SPRacingF3 UART3 port and “air cooled” (shortened with a coil) 433MHz whip antenna. Well, to be precise, it’s 450MHz since I changed working frequency. Antenna is not tuned or scientifically computed. Just 433MHz version shortened a little using proportions. Antenna is mounted on GPS mast. In next version I will probably replace whip antenna with Vee antenna.

HC-12 Rf 433MHz module in quadcopter

"Air cooled" antenna on quadcopter

Continue reading “HC-12 433MHz RF serial module range test” »

Read More

HC-12 433MHz wireless serial communication module configuration


HC-12 are cheap 433MHz wireless serial port communication modules with a range up to 1800m in open space. Each costs about $5 when bought from China, and 2 of them can create wireless UART link that can be used, for example, to transfer telemetry data from UAV. Or drive IoT device. Or connect sensors. Or whatever else one can think of.

HC-12 433MHz wireless serial communication module

It is based on SI4463 RF chip, has build in microcontroller, can be configured using AT commands and allows to use external antenna. Working frequency is divided into 100 channels starting from 433,4MHz up to 473,0MHz with 400kHz channel separation. Maximum output power is 100mW (20dBm) and receiver sensitivity differs from -117dBm to -100dBm, depending on transmission speed. It accepts 3,2V-5,5V power supply and can be used with 3.3V and 5V UART voltage devices (3.3V safe). Continue reading “HC-12 433MHz wireless serial communication module configuration” »

Read More