Friday, July 4, 2014

Weather datalogger with ARM cortex-M4 - part1

   So, after blinking LED's and reading buttons I want to go further and deeper inside my ARM Cortex-M4 board: I am developing a data-logger for Temperature, Humidity and light level; It will store its data inside a micro-SD card, available on-board the FRDM-K64F I have.
   The sensors I have in my hands right now are the linear LM35 temperature sensor, the DHT11 digital temperature/humidity sensor and a LDR(light dependent resistor) for visible light level measurement. In the picture below you can see the setup of my experiment; it is  possible to see the big light-blue component (DHT11) aside with LM35 (the TO-92 case) and my Freescale development board with a microSD card connected to it. The LDR is missing in the picture, but is present in the actual prototype.

   Besides the sensors and microSD my board also features a Timekeeping chip, a Maxim DS1302 in a breakout board with a battery mounted on it; That chip makes my data-logging look more "professional" by keeping track of the time of every reading (or event). My code can be download from here and the schematic diagram is seeing below. 

Schematics- click the image to enlarge

   One reading is made every 10 seconds and the data is stored in the microSD card. I have tested the setup for several days, for as long as 21 hours every time. Turns out the system is very reliable: it can be seen below in the temperature plot that both sensors feature a similar behavior, validating the reading of both (analog for the LM35 and digital-serial for the DHT11).

Click in the images to enlarge

   I selected that specific period of time (5AM- 5PM) because it is the most interesting in terms of temperature and light level; There are some considerations to be done in here:

1) The temperature and the light level increase when 5PM gets closer, and that is because my room is facing northwest, so it starts getting a huge amount of sunlight around that time.
2) My light sensor (LDR) is not calibrated and I also don't know its characteristics, so I simply put a series resistor (1Kohm) with it; As a post processing I scale it to fit into a 0-5 arbitrary scale. Around 7:30PM (not on the pictures above) it reaches almost 4.5 with direct sunlight over it.
3) Some noise is expected to appear in the pictures above (as is possible to observe), as the system takes one measurement every 10 seconds. These pictures feature around 12 hours of data!.

   That was the part 1 of a series of improvements I am planning to make on that project; My next step will be using the network hardware available on-board (Ethernet) to send all that data in real-time for a web page I will create. Another piece of future work will also be powering the module with a solar panel (which I have bought already). And finally adding a rain sensor to it, so I can have a complete meteorological station in my house!. All of that was powered by this amazing Freescale development board (FRDM-K64F). 

Thank you guys and see you soon,


  1. This comment has been removed by the author.

  2. I have read your project and it sounds amazing, I have a small question for you, may i know which software are you using to get the graphical results?