______________________________________________________________________
WEEK 7
I. Progress for Week 7
- Continuation of Week 6 with connecting to WIFI with router
- Beginning from steps 3 onwards
II. Current Interesting Applications of Arduino
- DIY Radio Control using Arduino
- Going to buy a new Wireless Controller for your next Robotics project. Why buy a new one when you can Do-It-Yourself? All you need is an Arduino, an old Joystick with a Gameport (15-pin connector) and a pair of Series 1 xBee Modules.
Receiver: xBee + Arduino + [your amazing Robot, Car or a Plane!]
Transmitter: Joystick + xBee [No additional hardware needed]
- The cart has two motors which use a chain to drive each of the rear wheels. A pair of H-bridge controllers let the Arduino interface with them. It’s also has a Bluetooth module that makes it a snap to pull accelerometer data from the Wii remote. The front end looks like it uses rack and pinion steering, but you won’t find a pinion or a steering column. Instead, a linear actuator is mounted parallel to the rack, moving it back and forth at the command of the Arduino.A Nintendo Wii-remote along with bluetooth communication and an arduino gives this magical cart with a wireless steering wheel.
______________________________________________________________________
WEEK 8
I. Updated Arduino Code though Arduino Software found:
http://arduino.cc/en/Main/Software
Code used for Arduino used to connect it to the router.
/*
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
/*
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters —————————————-
unsigned char local_ip[] = {192,168,2,100}; // IP address of WiShield
unsigned char gateway_ip[] = {129,25,1,253}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,128,0}; // subnet mask for
the local network
const prog_char ssid[] PROGMEM = {"belkin.3479"}; // max 32 bytes
unsigned char security_type = 3; // 0 – open; 1 – WEP; 2 – WPA; 3 – WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"44cc367d"}; //
max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 // Key 3
};
// setup the wireless mode
// infrastructure – connect to AP
// adhoc – connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters
----------------------------------------
// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
// Check if the requested URL matches "/"
if (strcmp(URL, "/") == 0) {
// Use WiServer's print and println functions to write out the
page content
WiServer.print("<html>");
WiServer.print("Hello World!");
WiServer.print("</html>");
// URL was recognized
return true;
}
// URL not found
return false;
}
void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
}
void loop(){
// Run WiServer
WiServer.server_task();
delay(10);
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
/*
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters —————————————-
unsigned char local_ip[] = {192,168,2,100}; // IP address of WiShield
unsigned char gateway_ip[] = {129,25,1,253}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,128,0}; // subnet mask for
the local network
const prog_char ssid[] PROGMEM = {"belkin.3479"}; // max 32 bytes
unsigned char security_type = 3; // 0 – open; 1 – WEP; 2 – WPA; 3 – WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"44cc367d"}; //
max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 // Key 3
};
// setup the wireless mode
// infrastructure – connect to AP
// adhoc – connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters
----------------------------------------
// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
// Check if the requested URL matches "/"
if (strcmp(URL, "/") == 0) {
// Use WiServer's print and println functions to write out the
page content
WiServer.print("<html>");
WiServer.print("Hello World!");
WiServer.print("</html>");
// URL was recognized
return true;
}
// URL not found
return false;
}
void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
}
void loop(){
// Run WiServer
WiServer.server_task();
delay(10);
II. What has been accomplished
Able to communicate though router though the use IP address, displaying given message. Use Telnet from windows to communicate with IP address using to send messages.
What is Telnet? - Telnet is a protocol that allows you to connect to remote computers (called hosts) over a TCP/IP network (such as the Internet). You use software called a telnet client on your computer to make a connection to a telnet server (i.e., the remote host). Once your telnet client establishes a connection to the remote host, your client becomes a virtual terminal, allowing you to communicate with the remote host from your computer.
By the end of this week, we were successfully able to connect our Arduino board to the router with the use of specific IP address. Even though this was a long arduous task, with different techniques and ideas, it was successful.
Reference used : implement a chat server with Arduino
III. Using TouchOSC program
What is it? TouchOSC is a multi touch screen interface for your iPod, iPhone, iPad or Android device. It consists of push and toggle buttons, sliders and rotary controls, Figure 1.1.
Figure 1.1: Exemplifying push, toggle buttons of TouchOSC in an iphone display
Essentially, this was used to convert our codes created in arduino, to TouchOSC so that one can communicate though a smart phone using wireless signals.
IV. Goals for Week 9
- Change wireless settings to allow Arduino to be controlled wirelessly
- Change code on the Arduino, TouchOSC so that the lights could be dimmed upon command
- Start working on the final report
________________________________________________________________________
WEEK 9
I. Project update
- In this project, we have been trying to reach our goal of having a control panel that will control the intensity of the light. We created a code for Arduino that will allow the Arduino to both receive messages from the router and transfer that into the correct language that will dim and brighten the light (the codes attached in Part II) . Also, we created a code that will send messages form our control panel through the router and send it to the Arduino.
By the end of this week, we were successfully able to connect Arduino to router, and command light switches to go ON and OFF with the use of proper IP address.
II. Updated Script though Arduino Software found:
http://arduino.cc/en/Main/Software
Arduino code with light functions
/*
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters —————————————-
unsigned char local_ip[] = {192,168,2,100}; // IP address of WiShield
unsigned char gateway_ip[] = {129,25,1,253}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,128,0}; // subnet mask for
the local network
const prog_char ssid[] PROGMEM = {"belkin.3479"}; // max 32 bytes
unsigned char security_type = 3; // 0 – open; 1 – WEP; 2 – WPA; 3 – WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"44cc367d"}; //
max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 // Key 3
};
// setup the wireless mode
// infrastructure – connect to AP
// adhoc – connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters —————————————-
int redState = 0;
int whiteState = 0;
int greenState = 0;
int redPin = 5;
int whitePin = 6;
int greenPin = 7;
// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
if (strcmp(URL, "/pin5") == 0) redState = !redState;
if (strcmp(URL, "/pin6") == 0) whiteState = !whiteState;
if (strcmp(URL, "/pin7") == 0) greenState = !greenState;
digitalWrite(redPin, redState);
digitalWrite(whitePin, whiteState);
digitalWrite(greenPin, greenState);
// Check if the requested URL matches "/"
// if (strcmp(URL, "/") == 0) {
// Use WiServer’s print and println functions to write out the
page content
WiServer.print("<html>");
WiServer.print("Light Control<br><br>");
printLightStatus("pin5", redState);
printLightStatus("pin6", whiteState);
printLightStatus("pin7", greenState);
WiServer.print("<br>The arduino has been running for: ");
WiServer.print(millis());
WiServer.print(" milliseconds<br>");
WiServer.print("</html>");
// URL was recognized
return true;
//}
// URL not found
return false;
}
void printLightStatus( String lightName, int lightState) {
WiServer.print(lightName);
WiServer.print(" Light is ");
if(lightState ==0) {
WiServer.print(" <b>off</b> <a href=/");
WiServer.print(lightName);
WiServer.print(">Turn On</a><br>");
} else {
WiServer.print(" <b>on</b> <a href=/");
WiServer.print(lightName);
WiServer.print(">Turn off</a><br>");
}
}
void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
pinMode(redPin, OUTPUT);
pinMode(whitePin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop(){
// Run WiServer
WiServer.server_task();
delay(10);
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters —————————————-
unsigned char local_ip[] = {192,168,2,100}; // IP address of WiShield
unsigned char gateway_ip[] = {129,25,1,253}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,128,0}; // subnet mask for
the local network
const prog_char ssid[] PROGMEM = {"belkin.3479"}; // max 32 bytes
unsigned char security_type = 3; // 0 – open; 1 – WEP; 2 – WPA; 3 – WPA2
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"44cc367d"}; //
max 64 characters
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 // Key 3
};
// setup the wireless mode
// infrastructure – connect to AP
// adhoc – connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters —————————————-
int redState = 0;
int whiteState = 0;
int greenState = 0;
int redPin = 5;
int whitePin = 6;
int greenPin = 7;
// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
if (strcmp(URL, "/pin5") == 0) redState = !redState;
if (strcmp(URL, "/pin6") == 0) whiteState = !whiteState;
if (strcmp(URL, "/pin7") == 0) greenState = !greenState;
digitalWrite(redPin, redState);
digitalWrite(whitePin, whiteState);
digitalWrite(greenPin, greenState);
// Check if the requested URL matches "/"
// if (strcmp(URL, "/") == 0) {
// Use WiServer’s print and println functions to write out the
page content
WiServer.print("<html>");
WiServer.print("Light Control<br><br>");
printLightStatus("pin5", redState);
printLightStatus("pin6", whiteState);
printLightStatus("pin7", greenState);
WiServer.print("<br>The arduino has been running for: ");
WiServer.print(millis());
WiServer.print(" milliseconds<br>");
WiServer.print("</html>");
// URL was recognized
return true;
//}
// URL not found
return false;
}
void printLightStatus( String lightName, int lightState) {
WiServer.print(lightName);
WiServer.print(" Light is ");
if(lightState ==0) {
WiServer.print(" <b>off</b> <a href=/");
WiServer.print(lightName);
WiServer.print(">Turn On</a><br>");
} else {
WiServer.print(" <b>on</b> <a href=/");
WiServer.print(lightName);
WiServer.print(">Turn off</a><br>");
}
}
void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
pinMode(redPin, OUTPUT);
pinMode(whitePin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop(){
// Run WiServer
WiServer.server_task();
delay(10);
III. Work on final report. Meeting times:
Wednesday 6 PM, and Friday 3 PM.
- Split up parts:
Abstract - Mohil
Indroduction - Mohil
Technical Activities - Ronak
Results - Rushi
Future Work - Sagar
IV. Using TouchOSC program
V. Interesting Arduino Application in real world
John, "The finished Arduino wireless water sensor", LifeBoat Farm. June 20th, 2011 <http://lifeboat.co.nz/the-finished-wireless-water-sensor/>
In a nutshell, this sensor measures resistance through an array submerged in the tank to determine the water level, then sends that data back to a server in the house for humans to read. He covered the prototype and the first iteration of the sensor. Below is the Arduino with an added WiFly shield – an add-on that gives the Arduino the ability to (mostly) seamlessly communicate over the farm’s existing 802.11 WiFi network. Arduino shields piggy-back on top of the board, and in this case the WiFly shield has a handy prototyping area – perfect for projects like this where you need to add a few components to a solution. The red and black leads you can see here connect to the water level sensor in the tank. The whole thing is mounted on an aluminium bracket I made up to fix it securely in the project box.
The Code:
It’s in three parts; the main .pde file, the settings file, and the water level reading function in it’s own file – just put all three in the same place.







