Temperatures, light levels, pressure, logging, LCD, PCB – bringing it all together

Ever since getting the LCD working and temperature and light level logging using COSM and the Pi Cobbler, I’ve wanted to compact all of this onto a single add-on board.


I’ve mentioned this in forum posts and other blog articles, but a part of me thought it wouldn’t happen. It took me a few weeks to bring it all together, but it’s finally done and it works Smile



The circuit


I don’t have a full circuit diagram. I may try to put one together later. Smile It’s a bit messy



The back of the board. Here be dragons.



but I’ll try to describe the important bits.



RasPi.TV Weather Station



Two analog temperature sensors (TMP-36) are connected to 3V3 and GND and the middle pins connected to channels 1 & 2 of the analog to digital converter. (Connected to the two 3 pin headers at the top of the photo.)


A voltage divider (right centre near the chips) made up of two resistors (20k and 10k) splits 3V3 voltage into 1.1V and 2.2V. The 1.1V feeds into a dual op-amp (small chip), set up as a voltage follower. One op-amp gives a steady 1.1V to the reference voltage pin (Vref) of the Analog to digital converter (large chip). The other op-amp feeds 1.1V to two light sensors (LDRs), which in turn are grounded with 20k pull-down resistors (top centre). The non-grounded ends of these resistors are connected to channels 3 & 4 of the ADC.


A 16 pin header socket supports and connects the LCD.


The rest of it is just wiring up the various necessary connections to the Pi, which I’ll outline in the next section.


The connections to RasPi


Four GPIO ports handle the Analog to Digital Converter, which can connect up to 8 channels. I’m only using 4 at the moment, but even with 8 channels connected, it would still only use 4 GPIO ports.

Six GPIO ports control the LCD (used in 4 bit mode – to use in 8 bit mode would need 10 ports)

Two ports; SDA and SCL handle the i2c barometric pressure sensor


Breadboard and PCB calibration differences


Once it was all up and running, it was time to calibrate the temperature sensors. When I did the breadboard circuit, I had to add about 2 degrees to each sensor to get accurate readings. The first thing I noticed with the PCB version was that the readings were both about 2 degrees too high. So that correction factor was removed. Other than that, I had to add 0.1 to one of them so that they would both read the same side by side with my reference thermometer. The only thing I can think that would make a 2 degree correction factor necessary on the breadboard would be poor quality connections, or maybe the ribbon cable caused a small (~20 mV) voltage drop?


Having to calibrate it for each Pi


I set this up on one Raspberry Pi, but am intending to run it on another one. One thing I noticed straight away when moving it to the second Pi was that the temperature readings were different. A quick measure of the input voltage to Vref showed that this Pi was giving a slightly higher voltage (1124 mV compared with 1115 mV for the other Pi). When 1 mV is approximately 0.1 degrees, a difference of 9 mV is nearly a degree. This is noticeable. So it was necessary to tweak the program to use the exact Vref voltage for each Pi separately. It must be due to small differences in the 3V3 voltage regulator.


This shows that you can’t just switch from one Pi to another and assume everything will be exactly the same. Test and measure. Smile






via RasPi.tv http://raspi.tv/2012/temperatures-light-levels-pressure-logging-lcd-pcb-bringing-it-all-together

Comentários

Mensagens populares