background preloader

Arduino

Facebook Twitter

18 : Construire une sonde de température radio pour 7€ Ce post est le dix-huitième d’une liste de tutoriels sur le raspberry PI, cliquez ici pour accéder au sommaire ! Faire du on/off c’est bien ! Mais contrôler sa maison en disposant d’indicateurs c’est mieux ! Aussi allons-nous voir, pour changer, comment construire un petit capteur qui va transmettre une information de température par radio au Raspberry PI. Si comme moi, vous vous interrogez sur l’intérêt de connaître la température d’une pièce en temps réel, je trouve personnellement qu’il n’y en a aucun, en revanche cela peut être très utile pour le Raspberry PI, qui pourra par exemple en dessous d’une certaine température, enclencher les radiateurs, on appelle ça des scénarios (on en reparlera dans un prochaine tuto) pour le moment, contentons-nous de récupérer l’information via une interface web et via notre interface vocale Yuri.

Avant tout, le traditionnel quart d’heure de honte en vidéo : (Le charisme d’une truite avec un double menton, un acteur né je vous dis !!) Le principe. Moi et mon Arduino, pour le fun. Sleep. Electronics : Microprocessors : Power saving techniques for microprocessors. Summary In this thread I show various power-saving techniques for the Atmega328P processor. They include sleep modes, use of power-reduction registers, and other techniques. Applying all of them can result in a current draw as low as approximately 100 nano-amps (100 nA), well below the self-discharge rate of most batteries. Proof from the datasheet for the Atmega328P (page 405 of my copy): That is 100 nA at at 25°C running at 3v.

These techniques would be useful for battery-powered devices where the full power of the processor was only required intermittently, for example a TV remote, calculator, doorbell, or some sort of environmental monitor where you only needed to check things from time to time. Introduction I am going to explore various power-saving options for running your project, presumably from battery power. These examples are specifically for the Atmega328P processor, but the techniques are pretty general. Summary of methods Baseline - Arduino Uno Sketch A Sketch B Bare-bones board. Lab3 - Laboratory for Experimental Computer Science. Watchdog and Sleep functions This example shows how to make use of the Watchdog and Sleep functions provided by the ATMEGA 168 chip .

These functions are useful if you want to build low power consuming devices operated by battery or solar power. The reduced power consumption is achieved by through a intermittent operation of the system .In case of Arduino your main loop will be executed once before the system is put into the sleep mode. After a few seconds t the watchdog wakes the system up and the main loop is executed again. When we assume that the time to measure a sensor and making some decisions will take 10 millisecond and the watchdog is set to 8 seconds the on/off ratio is 800 which extends the battery live time by this factor.

Battery live time calculation Now we want to know long we can operate our device with standard alkaline AA Cells. In normal operation with a current of 20mA the battery will last 2000/20 = 100 hours or about 4 days. Nightingale Example Burn the Bootloader. Sleeping Arduino - Part 1. SecretVoltmeter - tinkerit - Accessing the secret voltmeter on the Arduino 168 or 328 - Open source releases from TinkerLondon and Tinker.it. It turns out the Arduino 168 and 328 can measure their own voltage rail. Copy, paste into Arduino and see what it returns. This works on an Arduino 168 or 328. long readVcc() { long result; // Read 1.1V reference against AVcc ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Convert while (bit_is_set(ADCSRA,ADSC)); result = ADCL; result |= ADCH<<8; result = 1126400L / result; // Back-calculate AVcc in mV return result;} void setup() { Serial.begin(9600);} void loop() { Serial.println( readVcc(), DEC ); delay(1000);} The voltage is returned in millivolts.

Note the following: This works on Arduinos with a 328 or 168 only. The Arduino 328 and 168 have a built in precision voltage reference of 1.1V. The chip has an internal switch that selects which pin the analogue to digital converter reads. So if you measure how large the known 1.1V reference is in comparison to Vcc, you can back-calculate what Vcc is with a little algebra.