dimanche 24 avril 2011

Arduino simple home automation: webserver, sensors and emailing alert with livebox orange

In this project, we will connect to the Internet with the Arduino and an ethernet shield to perform data acquisition, LED process control and an email alert.

See video below: 






What this program do:
It creates a web server with Ethernet shield (e.g. DFRDruino) + Arduino (e.g. Duemilanove).

It generates an HTML page for the client that connects to my server (either locally or remotely) that displays:
- Two temperature values ​​from two sensors Dallas One Wire 1820
- Switch ON or OFF a red LED as a function of the input sent by the client.
- Measure the brightness value with a LDR CdS photocell.
- Checks that the values ​​of temperatures are still between a maximum and minimum, if not, it connects to the SMTP internet service provider to send an email alert.

In addition, you can easily add control more LED by extending the LED array in the sketch.

What do you need:

  1 x LED for Visual Feedback
  2 x Dallas Temperature sensors DB1820
1 x Arduino (e.g. Duemilanove)
1 x compatible Ethernet shield for Arduino (official that have Wiznet5100 or DFRDRuino works fine for me, don’t try with the ENC28J60 Ethernet Shield because the Library is a bit hard to handle at the moment)
1x Breadboard
  + various Resistors etc.

How to set-up:

1 - Since we are using a livebox mini from Orange as a router, all the devices that are connected to this LIVEBOX must have IP addresses starting from 192.168.1.10. Therefore, you’ll have to arbitrary allocates addresses for MAC and IP of your shield:
e.g.:
byte mac[] = {0x48,0xC2,0xA1,0xF3,0x8D,0xB7};
byte ip[] = { 192,168,1, 21 };
2 - Connect your shield to the Livebox either by a RJ45 on the wall or directly on the livebox.
3 - Send the arduino sketch to the arduino shield via the IDE software.
4 – Testing your server: enter 192.168.1.21 in the address bar of your favourite browser and hopefully it will give you the below screen:


Refreshing the HTML page will update all the values: light level, Temperature internal and external.
You can now check the input to switch ON the red led and click on send to validate the form. 

5 - Unfortunately, this HTML page is reachable only from your local network but not on the word wide web network. Moreover, since we are using a livebox mini from Orange as our router, its public IP address is dynamic i.e. it changes each time you perform a new connection to the Internet. Hence, you’ll have to do two more steps:
-          Creates an account with e.g. dyndns.org that gives you a mean to have a “fixed” IP address
-           Create a port forwarding on your router to reach your server from everywhere on internet (including Iphone…, every equipment that have an internet connection)
5-1  Enter your livebox management software: http://192.168.1.1/hnm/standard/HNM_Header/html/header_pc.html

5-2  Click on the configuration page of your router and check out your public IP address (beware that it changes every time you connect to the internet).
Connect to http://www.dyndns.com/services/dns/dyndns/ to create a free account (it’s sufficient for the features that you’ll be using)



You’ll have to enter a hostname for your Livebox, e.g. toto.dyndns.org and also your current IP address (found on 5-2).






























5-3 Click on the NAT/PAT” menu to do a “Port Forwarding” from your internal port to the external port: e.g. internal port : DFDruino a.k.a ‘192.168.1.21’ port 80 => external port : Web Server public IP port 8080 
Subsequently, the data flow on your router’s IP address on port 80 will be forwarding to 192.168.1.21:8080. This also works in the reverse way.

5-4  More interestingly, we can also add a dyndns rule by clicking on DynDNS menu:

- Choose dyndns on the Service menu
- Enter the dyndns hostname e.g. toto.dyndns.org in the “nom de domaine” field
- Enter the login and password that you have entered on dyndns.org
Once “Enregistrer” is entered the Statut field must indicate a date…

6 -  Entering toto.dyndns.org:8080 must gives you the same screen as the #4 step.




Good luck...

You may want also to check these interesting links: 
- http://www.mon-club-elec.fr/pmwiki_mon_club_elec/pmwiki.php?n=MAIN.ArduinoEthernetServeurControleLEDx7 
- http://www.apress.com/9781430232407 
 - http://www.jlectronique.org/jlectronique/Ethernet_Shield.htm

dimanche 17 avril 2011

Arduino Simon Game: Version 3

Initial Release from David M. Auld (19th October 2009) => Version 1 & 2

http://www.dave-auld.net/index.php?option=com_content&view=article&id=96:arduino-project-simon-game&catid=54:arduino-projects&Itemid=107

Added some features by jadiema => Version 3:
  NEW: Added EEPROM storage for high score: level and name
  NEW: Multilangage selection
You'll find the code at: http://code.google.com/p/my-arduino-projects/downloads/detail?name=Arduino_SimonGame_EEPROM_LANGUE_V3_1.pde&can=2&q=#makechanges


 It uses the following Hardware;
  4 x LEDs for Visual Feedback of step
  4 x Pushbuttons for Input of step
  1 x Speaker for Audio Feedback of Step
  1 x LCD for Game Info and Scoring.
  1 x Arduino
  +various Resistors/pots etc.
  Built and tested on Arduino Duemilanove.

My first time-lapse with an arduino and a CANON EOS450D



Last week, I decided to use my photo camera for time-lapse shots, however to do that, I needed a so-called intervalometer. Damned, what is an intervalometer ?
It's a device that times the shots to regular intervals, but those are so expensive, and cost for the CANON EOS 450D around €150, just for a tiny microcontroler and an IR LED.
So I decided to build my own with my favorite open source hardware: arduino.

Here's some example timelapse movies made with several hundred of jpg pictures taken from 4pm to 10pm



Here's my second timelapse movie made with several hundred of jpg pictures taken from 6pm to 9pm.


 Here's my first timelapse movie made with several hundred of jpg pictures taken from 8am to 11am.



The setup in action (a shoot every 30s):


The Arduino code :
http://code.google.com/p/my-arduino-projects/downloads/detail?name=CanonEOS_Sandra_TimeLapse.pde&can=2&q=#makechanges

IR LED with its holder
 

Small breakboard with two buttons (manual or automatic mode), several resistors to manage multiple button choice on analog pin 0, and a voltage divider that holds the IR LED on the image bottom.

Required Parts:
  • 1x Arduino (e.g. Diecimila)
  • 3x 1kohm resistors
  • 1x 4.7kohm resistor
  • 1x IR LED 940nm
  • 2 x push buttons 
  • 1x Arduino AC adapter OR Arduino 9V battery pack
  • 1x box ;-)))


The code is derived from code: 
http://controlyourcamera.blogspot.com/2010/01/infrared-controlled-timelapse.html
Software to mount the images together: Photolapse (freeware): http://home.hccnet.nl/s.vd.palen/index.html