Tuesday, May 29, 2012

Week 7 , 8 , 9



______________________________________________________________________

WEEK 7

I. Progress for Week 7 

  • Continuation of Week 6 with connecting to WIFI with router 
    • Beginning from steps 3 onwards 
Current Set-up of Arduino, Breadboard with Belkin Router 


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);

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 


These can be arranged into a 'layout' and sends OSC messages to your PC or MAC.TouchOSC sends out OSC signals across your WiFi network. Your DAW will only be able to receive MIDI notes, so you will need some software to convert OSC to MIDI. This is where PureData and OSCulator come in.  They listen in to your WiFi network for OSC signals to convert into MIDI.  You would then have to map each signal to a midi note, then map those notes in your DAW.


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);




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. 



Tuesday, May 8, 2012

Week 6 progress Report

I. New Part: Wifi Arduino Purchased and assembled with Arduino Board 

Figure 1.0: WIFI Arduino with USB cord 

  • What is WIFI Arduino? This is the shield you need to get Wi-Fi connectivity to our Arduino-based project.  The Arduino WiFi shield is an add-on board that mates a ZeroG WiFi module to an Arduino board and allows for wireless connections between your Arduino and the Internet.

II. Current Set-up with Arduino Wifi Board 

Figure 1.2: Current Set-up of Wifi Arduino board with breadboard, with connections without the router. 



  • What does the sep-up exemplify?  As it can be seen in Figure 1.2, With the Wifi shield, we are able to begin coding our wifi coding. We are going to have to translate between to different software languages. We have begun programming the shield it self and creating the code that can be used to dim and brighten the light. The current picture we have above is when the Arduino and its wifi shield are connected through wifi. Our final steps are to create the program that can convert that into wifi and transmit the correct code to the Arduino to either raise or dim the light. 
III. Connecting Arduino Board with Netgear WIFI router 


  • Ideally, our setup with wifi board: 
  1. Install DD-WRT Firmware
  1. Configure Router to be WiFi Client
  1. Do Some Tests
  1. Install USB Serial Drivers
  1. Install Serial-to-Network Proxy
1. Install DD-WRT Firmware
Installing programs on a router, known as firmware, are achieved by a method called flashing.
  • In order to start installing DD-WRT Firmware on the router we needed to check if our router is supported. Go to router database to do that.
  • Identify the model brand of the router that you have. Then you can directly go to DD-WRT downloads page to find the files you need.
  • Create a folder before you download any files and save all files in this new folder.
  • Log onto GUI and upload your files to the router.

  1. 2. 
  2. Configure Router to be WiFi Client
  • Hard reset your router. It means reset by pressing reset button usually on the back of the router.
  • Connect router by cable connecting your computer and LAN port of your router.Set IP address on your computer to be of your router.
  • Open a web browser and connect to 192.168.1.1 to view the DD-WRT GUI.
  • If you are not asked to change password reset your router again and hit reset password.
  • Go to Wireless-> Wireless Security and enter the Security Mode and other key information that matches your router. Then Hit SAVE. Also change your Wireless Mode to client.
  • On that same tab set the Wireless Network Name (SSID) to exactly the same SSID as your primary router you will be connecting to over wireless. Make sure spelling and capitalization match.
  • NEXT go to Setup -> Basic Setup and change Connection Type to Automatic Configuration - DHCP
  • On that same tab in the Network Setup section set the Local IP Address to 192.168.2.1. Make sure your Client subnet is different from the Primary Router subnet.
  • Change your Timezone and DST to match where you are.
  • Set your computer back to auto IP and auto DNS if you like. You will get a DHCP address from the router.

3. Do Some Tests
4.Install USB Serial Drivers
  • Plug the USB end of the USB to serial adapter into a USB port on your computer.
·         Click the "Cancel" button when the Found New Hardware Wizard appears.
·         Insert the installation CD that came with the adapter into the drive on the computer.
  • Accept the License Agreement then click the "Next" button to continue with the installation.
  • Click the "Finish" button to complete the USB to serial driver installation and then unplug the adapter.
  • Select "Yes, I want to restart my computer now" then click the "Finish" button to complete the USB to serial driver installation.
  • Unplug the adapter and wait for your computer to restart.
  • Plug the adapter into the USB port, after the computer has restarted, to verify that the adapter is working correctly.

5.Install Serial-to-Network Proxy
  • I can’t find anything about this online
  • Also if i remember correctly we didn’t fininsh in this weeks lab


Helpful links:
router database:
http://www.dd-wrt.com/site/support/router-database



     The steps are:

IV. Helpful Video: 
WiFi for Arduino with Asus WL-520gu

A quick video showing a router acting as a serial-to-network gateway

Source: http://todbot.com/blog/2010/12/16/wifi-for-arduino-with-asus-wl-520gu/


Tuesday, May 1, 2012

Group Members

Engineering 102 - 005 
Group 01 

Tablet Controlled General Purpose Controller 

Group Members: 

Name: Mohil Parakhiya 
Major: Biomedical Engineering 
Email: mmp92@drexel.edu
Responsibilities: Researcher, Website Maintenance, Group Management,
                                           Final Report Writer and Final Presentation Creator

Name: Rushi Thaker 
Major: General Engineering, Pre-Med
Email: ryt23@drexel.edu
Responsibilities: Software Aspect, Material Management,
Final Report Writer

Name: Ronak Darji 
Major:  Electrical Engineering 
Email: ronak.s.darji@drexel.edu
Responsibilities: ResearcherHardware Aspect,
Final Report Writer 


Name: Sagar Babariya
Major: Electrical engineering
Email: skb69@drexel.edu
Respnsibilities: Aid with Hardware, Final Report Writer
 and Final Presentation Creator



________________________________________________________________
Advisor:
Dr. Eugenia VIctoria Ellis 
genaellis@drexel.edu
Westphal College of Media Arts & Design