Поиск по этому блогу

суббота, 14 ноября 2015 г.

Weather station: Chibios, stm32f051, bmp180, DHT11 sensor and 1.3 OLED sh1106 display

Although I am an electronic engineer, periodically I want to spend my time constructing some fancy devices for home. Last weekend's project was a Meteorology station - I really need to know the temperature, pressure and humidity in my apartment!

So, the first thing to do - decide what hardware platform fits well. I choose STM32F051 MCU (it's really cheap and powerful enough for my modest needs). The compiler should be arm-none-eabi-gcc, RTOS - Chibios, graphical engine - uGFX.
The other thing to deal with - its sensors! Well, let's forget about analogue sensors. All we need are modern digital devices! I personally hate calibration, because it's too tedious to tune every sensor individually.
BMP180 Sensor

DHT11 Sensor
So, I've selected Bosch Sensortec's bmp180 sensor for temperature and pressure. For the humidity I've selected a cheap Chinese DHT11 sensor. Maybe this was a mistake, because it was not easy to make it work properly.

To show the information it has a 1.3' OLED display. BMP180 is I2C sensor, and the display uses this bus as well. The DHT11 sensor uses it's self-brew protocol, quite tricky for implementation with any RTOS, because you have to use micro-secondary delays to get data.

The schematics are quite simple:
The PCB layout is simple too.

The only mess I had was that I routed the DHT11's data line to the PB2 pin of the MCU. This pin unable to perform a ICU (interval capture unit) feature :( So, I had to implement sensor reading using a conventional the GPIO port function. Here there is an example of how to use this hardware feature with a DHT11, but due to already-produced PCBs I can't use this approach.
So, I grabbed my logic analyzer and ran it with Sigrok. I was happy to find that the latest Sigrok has an embedded decoder for the DHT11 protocol!


Okay, the code has been uploaded to github. Enjoy!




среда, 18 февраля 2015 г.

Using Ethernet PHY with STM32F4DISCOVERY in Chibios

Ethernet with Chibios on STM32F4Discovery


STM32F4DISCOVERY board is rather chip and can be easily purchased for the price near 25$.  It features powerful stm32F407 MCU, with FPU, MAC, USB and 1Mb of flash. Moreover, it runs on 168 MHz frequency. So your tasks will run really fast! For my projects I use Chibios/RT, which make developing applications just a piece of cake, because of many ready to use drivers and many devboards support "out of the box".
stm32F407 supports MAC, so we can go to eher/inter net to send/receive data. I used module with PHY from aliexpress.com, with DP8 from Texas Instruments.
You can find my code in github

OMG, quadcopter!

Hello guys.
It is time  for me to switch on English.
I started to construct my own quadcopter. As well as I am ChibiOS fan, I decided to use Taulabs flying controller, because they plan was to get rid of FreeRTOS and use Chibios there.
For now I decided to use my STM32F3Discovery as a platform.



This cheap board already has a magnetometer, accelerometer and gyroscope.
I just needed an adapter and I ordered one on seedstudio. Gerbers can be found in Taulabs' software pack in the hardware folder. Not bad!


Ok, but what about the frame, engines, ESCs, battery and numerous other stuff? I used recomendations from these videos.
I bought the recomended frameESCs and  A2212 930KV motors.
I also bought the FlySky TH9X Radio.

Assembled copter:

So, it is almost time to fly!
Here is a video on very first fly on YouTube:
https://www.youtube.com/watch?v=JToOy15wG7o