Saturday, November 21, 2015

Homodruino: The Biped Robot


HOMODRUINO®

BING - The Talking Robot



BING is an experimental Biped Neurotronic Gnoric and the first prototype in my series of autonomous Homodruinos biped intuitive machines(IM). Currently, he is undergoing a series of trial-and-error modular programming procedures to calculate his walking motions using only four servos as his Degrees of Freedom (DoF). (For a well-designed autonomous robot, I would need at least 17 servos).

I am in the process of designing a structural compartment that will serve as his body and will accommodate the Arduino board, a 9v battery, and his sonic head. In the interim, I am using an office stamp for his body, rubber bands to secure everything together in one piece, and some fasteners for his legs.

I am also developing a simple sketch that includes voice implementation for you to enjoy. If you’re interested in further experimentation, you can use the sketch provided below as a starting point. Feel free to adjust the numbers and feel fascinated with the results. Enjoy the process of building and programming Bing!


Hardware:
5 microservos 
1 ultrasonic (eyes)
2 fasteners (feet and hips)
1 rubber stamp(body)
connecting wires
breadboard
Arduino R3 UNO board


Block Diagram:



Note: Same schematic. The only difference is you are adding 3 more servos. If you don't want to complicate matters, you may remove the RGB and push button circuitry.

ARDUINO SKETCH:

Code # 28:
/* ===============================================================
      Project 28: Homodruino: The Biped Robot
      Author: J. B. Wylzan with some help from the Arduino community
      Website: http://www.ihackrobot.blogspot.com
      Abstract: Build an autonomous Biped Robot.
================================================================== */

#include <Servo.h>

int x= 1000       ///change to 200 for dancing
Servo leftFoot;
Servo leftHip;
Servo rightHip;
Servo rightFoot;

void setup()
{
  leftFoot.attach(4);
  leftHip.attach(5);
  rightHip.attach(6);
  rightFoot.attach(7);
}

void loop()
{
  stop();
  forward();
}

void stop(){
  leftFoot.write(90);    
  leftHip.write(90);
  rightHip.write(90);
  rightFoot.write(90);
  delay(x);
}

void forward(){
 leftFoot.write(80);    
 rightFoot.write(70);  
 leftHip.write(90);    
 delay(x);
  rightHip.write(90);  
  leftFoot.write(70);    
  rightFoot.write(80);  
// delay(x);

}

/* ================================================================== */

Challenge: 
Create the robot with an ultrasonic sensor attached on its body.
Make Bing dance, march, walk sideways, jog and walk backward.

Actual Layout:



Procedure:
1. Build the prototype as shown above
2. Run the Arduino Interface
3. Select File > New
4. Copy Code #28 above
5. Paste Code #28
6. Click File > Save
7. Click Verify
8. Click Upload
9. Robot will move slowly forward or dance.





Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 

Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled iHackRobot. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: Biotronics: The Silver Species, Joey Lawsin, 1988, USA.


"The Last Human on Earth will no longer be Human." ~ Joey Lawsin
================================================================== 
The Homotronics® and Intuitive Machines® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®

L.A.W.S.I.N. Educational Production
 ================================================================== 













Friday, November 20, 2015

Robot controlled by iPhone and iPad

How to build a Robot on an Arduino that can be controlled by an ipad or iphone:
by J.B. Wylzan

The Web Server

Robot controlled using an iPad

iPhone, iPad, Kindle controllers
Homodruino: an adruino robot



/* ===============================================================
      Project Homotronics: Robot controlled by an iPhone or iPad
      Author: J. B. Wylzan with some help from the Arduino community
      Website: http://www.ihackrobot.blogspot.com
      Abstract: Control a robot via a smart phone or smart tablet.

================================================================== */

Please try the Arduino SKETCH first below before using my iPad sketch:

/*
  Source: Arduino Website

 WiFi Web Server - a simple web server that shows the value of the analog input pins.
 using a WiFi shield. This example is written for a network using WPA encryption. For
 WEP or WPA, change the Wifi.begin() call accordingly.

 Circuit:
 * WiFi shield attached
 * Analog inputs attached to pins A0 through A5 (optional)

 created by dlf (Metodo2 srl)
 modified by Tom Igoe

 */

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "yourNetwork";      // your network SSID (name)
char pass[] = "secretPassword";   // your network password
int keyIndex = 0;                 // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if ( fv != "1.1.0" )
    Serial.println("Please upgrade the firmware");

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
  server.begin();
  // you're connected now, so print out the status:
  printWifiStatus();
}

void loop() {
  // listen for incoming clients
  WiFiClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("<br />");
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);

    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

/* ================================================================== */

Challenge:
Instead of the iPad, use your iPhone or Kindle tablet  to control the homodruino robot.




Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 

Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled iHackRobot. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: Biotronics: The Silver Species, Joey Lawsin, 1988, USA.

================================================================== 
The Homotronics® and Homodruinos® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®

L.A.W.S.I.N. Educational Production
 ================================================================== 







Wednesday, November 18, 2015

Robot controlled by Ethernet

How to build a Robot on an Arduino that can be controlled remotely online:
by J.B. Wylzan
The Web Server



This robot is controlled using your web server.




ARDUINO SKETCH:

/* ===============================================================
      Project Homotronics: Robot controlled by Ethernet
      Author: J. B. Wylzan with some help from the Arduino community
      Website: http://www.ihackrobot.blogspot.com
      Abstract: Control a robot via the ethernet.
================================================================== */
#include <SPI.h>
#include <Ethernet.h>

const int MLWF = 4;             
const int MLBB = 7;  
const int MRYF = 6;             
const int MRRB = 5;  

byte mac[] = { your mac address };   
byte ip[] = { your ip address  };                      
byte gateway[] = { 192, 168, x, x };                  
byte subnet[] = { 255, 255, x, x };                 
EthernetServer server(80);                             //or 8081     
String gString;

void setup() {

  Serial.begin(9600);

  pinMode(MLWF, OUTPUT);  
  pinMode(MLBB, OUTPUT); 
  pinMode(MRYF, OUTPUT); 
  pinMode(MRRB, OUTPUT);
  
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();
  Serial.print("my server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  
  EthernetClient client = server.available();
  if (client == true) {
    while (client.connected()) {   
      if (client.available()) {
        char c = client.read();
        if (gString.length() < 100) {
          gString = gString + c;
         }

         if (c == '\n') {          
           Serial.println(gString); 
     
           client.println("HTTP/1.1 200 OK"); 
           client.println("Content-Type: text/html");
           client.println();     
           client.println("<!DOCTYPE HTML>");
           client.println("<HTML>");
           client.println("<HEAD>");
           client.println("<TITLE>iHackLab</TITLE>");
           client.println("</HEAD>");
           client.println("<BODY bgcolor='#ff4d4d'>");
          client.println("<center>");
           client.println("<H1>iHackLab Homotronics Website</H1>");
           client.println("<hr />");
           client.println("<br />");  
           client.println("<H2>Robotics with Arduino Ethernet Shield</H2>");
           client.println("<br />");  
           client.println("<a href=\"/fwd\"\">Move Forward</a>");
              client.println("<br />");   
               client.println("<br />");  
           client.println("<a href=\"/rvs\"\">Move Backward</a><br />");   
           client.println("<br />"); 
            client.println("<br />");  
           client.println("<a href=\"/rht\"\">Turn Right</a>");
              client.println("<br />");   
               client.println("<br />");  
           client.println("<a href=\"/lft\"\">Turn Left</a><br />"); 
           client.println("<br />");     
           client.println("<br />"); 
           client.println("<br />");    
           client.println("<a href=\"/stp\"\">Stop</a><br />"); 
           client.println("<br />");     
           client.println("<br />"); 
           client.println("<br />");   
           client.println("<hr />");
           client.println("<www.thearduinosketch.blogspot.com>"); 
           client.println("<hr />");
           client.println("<br />"); 
           client.println("</center>");
           client.println("</BODY>");
           client.println("</HTML>");
     
           delay(1);  //page loading delay
           client.stop();
          Serial.println("client disconnected");

           if (gString.indexOf("fwd") >0){
               Serial.println("Forward");
        digitalWrite(MLBB, 0);        
    digitalWrite(MLWF, 255);
    digitalWrite(MRRB, LOW);        
    digitalWrite(MRYF, HIGH);
           }
           if (gString.indexOf("rvs") >0){
                Serial.println("Reverse");
         digitalWrite(MLBB, 255);         
    digitalWrite(MLWF, 0);
    digitalWrite(MRRB, HIGH);        
    digitalWrite(MRYF, LOW);
           }
           if (gString.indexOf("lft") >0){
                 Serial.println("Left");
        digitalWrite(MLBB, 0);        
    digitalWrite(MLWF, 255);
    digitalWrite(MRRB, LOW);        
    digitalWrite(MRYF, LOW);
           }
           if (gString.indexOf("rht") >0){
              Serial.println("Right");
         digitalWrite(MLBB, 0);        
    digitalWrite(MLWF, 0);
    digitalWrite(MRRB, LOW);        
    digitalWrite(MRYF, HIGH);
           }
           if (gString.indexOf("stp") >0){
               Serial.println("Stop");
        digitalWrite(MLBB, 0);        
    digitalWrite(MLWF, 0);
    digitalWrite(MRRB, LOW);        
    digitalWrite(MRYF, LOW);
           }
            gString="";  
           
         }
       }
    }
}

/* ================================================================== */
 Circuit: (optional)

 * Ethernet shield prepares to be attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5
 * On-board SS micro-SD card slot must be on pin 4 

The shield contains a number of informational LEDs: 
  • PWR: indicates that the board and shield are powered 
  • LINK: indicates the presence of a network link and flashes when the shield transmits or receives data
  • FULLD: indicates that the network connection is full duplex 
  • 100M: indicates the presence of a 100 Mb/s network connection (as opposed to 10 Mb/s) 
  • RX: flashes when the shield receives data 
  • TX: flashes when the shield sends data 
  • COLL: flashes when network collisions are detected.



Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 


Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled iHackRobot. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: Biotronics: The Silver Species, Joey Lawsin, 1988, USA.

================================================================== 
The Homotronics® and Homodruinos® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®

L.A.W.S.I.N. Educational Production
 ==================================================================