
Arduino LEDs and Temperature sensor
In the last years I have got in touch with many people enthusiast of a small integrated micro-controller called Arduino. For those of you that never heard about it, Arduino is an assembled electronic board centered around the ATmega328 (a programmable micro-controller with 32KB of flash Memory). The Arduino board is an Italian open source prototyping project (www.arduino.cc) developed mainly for artists, designers and for those people like us at Echomaterico interested into “interactive architecture” (interactions between environment and architecture).
Here is the first of a series of future experiments that i am going to held with Arduino. I actually feel like a child playing with the electronic version of what is known as “The Chemistry Set”! Few weeks ago i have received my Arduino Beginner Kit and soon i started to play around with it. The intention is to study and analyze the potentialities of such a micro-controller for interactions between environmental variables and sustainability issues in architectural fields. The task is not straight forward and it will require time for testing and prototyping, so be patient .. any outcome will be posted.
I will aim to apply Arduino within the following fields of analysis: Indoor Comfort Temperature measurement and visual communication with the user, Photovoltaic Power output and Solar radiation, Daylight analysis measurement and management.
The Pictures in this post refers to the first trial on measuring the Indoor temperature, obtaining also a sort of visual alert using 10 red LEDs. The circuit senses the Indoor temperature of the room and reports the output on my Mac, showing at the same time a dynamic “switch-on” of 6 LEDs. The Arduino is connected through a usb cable and data are transmitted in real time to the MAC. Touching the sensor with my fingers increases the temperature causing other two or three LEDs to switch on.
Since i am not familiar, still, with the Arduino language, i simply modified and joined together two open-codes that you’ll find at the end of this post.

Simple circuit with 10 LEDs and a Temperature Sensor on the top right side
Testing separately the two scripts i am able to collect interesting outcomes, and i suggest you as well to have fun with them.
Using the sensor apart from the LED’s array i have been able to measure the indoor temperature and to get on my screen the results (around 21, 22 Celsius) The sensor though seams to be not so accurate in its instantaneous reaction to rapid dynamic changes of the temperature. In a coming test the following sensor will be used: LM35 Precision Centigrade Temperature Sensor.
Unfortunately my attempt in joining together the code of the Temp. sensor with the one of the LED Array didn’t outcome the correct temperature measurement. As you can see in the following picture, the temperature i have got is only around 2 degree C or maximum 3!!!. I will have therefore to understand what’s wrong with it … maybe some variable is not converted correctly… i’ll let u know soon.
I am sure i did many mistakes, but i will keep going in learning Arduino. Here are the two base Codes .. give it a try!
Credits:
Enrico Crobu
/*LED bar graphTurns on a series of LEDs based on the value of an analog sensor.
const int analogPin = 0; // the pin that the potentiometer is attached to const int ledCount = 10; // the number of LEDs in the bar graph 2, 3, 4, 5, 6, 7,8,9,10,11 }; // an array of pin numbers to which LEDs are attached // loop over the pin array and set them all to output: for (int thisLed = 0; thisLed < ledCount; thisLed++) { pinMode(ledPins[thisLed], OUTPUT); } } // read the potentiometer: int sensorReading = analogRead(analogPin); // map the result to a range from 0 to the number of LEDs: int ledLevel = map(sensorReading, 0, 1023, 0, ledCount); for (int thisLed = 0; thisLed < ledCount; thisLed++) { // if the array element’s index is less than ledLevel, // turn the pin for this element on: if (thisLed < ledLevel) { digitalWrite(ledPins[thisLed], HIGH); } // turn off all pins higher than the ledLevel: else { digitalWrite(ledPins[thisLed], LOW); } } } |
/*TEMPERATURE SENSOR An open-source LM35DZ Temperature Sensor for Arduino. This project will be enhanced on a regular basis
|
This entry was posted on Sunday, February 14th, 2010 at 11:34 am and is filed under / software & hardware, POST SLIDER, TECHNIQUES AND TECHNOLOGIES FOR SUSTAINABILITY. You can follow any responses to this entry through the RSS 2.0 feed.
Contents and Pictures by

Design by

Subscribe to entries
Subscribe to comments
All content © 2010 by echomaterico/blog
