Arduino tinkering (part 2) reading a site information via Ethernet Shield

Here are some of my notes while playing with arduino:

Here are my tools:
1) the Make Electronics book: gives a good and practical overview of pure electronics and a good preparation for arduino

2) my coding experience: it helps coming with a coding experience, it facilitates writing code on arduino platform. Doesn't need to be very deep experience as most things can be done with only a few lines of code


Mini project:

Using ethernet shield to read data from a webpage, and using as an input to drive a motor:
(Exemple of a project: read the realtime access number on a google analytics account, and drive a step motor to do a visual speed counter to display on our office)

1) driving a stepper motor through arduino (done)

2) reading a numeric value on a given webpage on the web, and getting it on as an input value on the arduino (to later use this value to drive the stepper motor)

http://bildr.org/2011/06/arduino-ethernet-client/

3) setup of a webserver hosting a single number (once we'll be able to read it on the arduino, we'll program something more advaced, for exemple parsing a weather forecast page or web traffic information)

--> install MAMP on my macbook.

--> check the config to see where the site will be served: for me default http connection on localhost port 8888 : check if you can access the default MAMP home page on http://localhost:8888

--> check the IP address on my computer (ifconfig command on mac / linux) (for me 168.192.0.10
check if you can access the same page on another device connected on your internal network with the IP address you checked + the port selected on MAMP:
http://192.168.0.10:8888 is serving the page on my mobile while connected on my wifi network.

--> modifying the page to show a single number instead of the MAMP welcome page:
on my standard MAMP installation, I just needs to modify the file located on
Applications > MAMP > htdocs > index.php
I just place the number value 555 like this <555> and save the page, the script on the arduino side will "parse" the value inside the "<" and ">"

4) sketch and shield connection

to be able to connect the ethernet shield we must know its mac and ip address:
here is how to get it: https://www.arduino.cc/en/Guide/ArduinoEthernetShield


Commentaires