Project: Ichi

Project: Ichi

Project Ichi is my first attempt at building a robotic device.  Ichi means one in Japanese and represents my first attempt.  Ichi is hybrid manually controlled toy rover that will also implement some autonomous systems.  The main goal of this project is to learn more about Arduino and sensor systems to lay the groundwork for eventually constructing an outdoor rover.

IMG_1696

Project Specs:

  • Rover Design
  • Arduino based control system
  • Ability to take weather measurements
  • Obstacle Avoidance using ultrasonic range-finding
  • Wireless Control
  • Onboard Display

Components:

  • Tamiya Dual Motor Drive
  • Tamiya Track System
  • Arduino Uno R3
  • Arduino Motor Shield R3
  • HC-SR04 Ultrasonic Range-Finder

Status:

The temperature and humidity sensor is currently operational as is the rangefinder.  I’m now waiting on some mounting hardware to lock everything done and begin the motor coding.

I ran in to a problem with the motor drive which is documented in another post.  I seem to have found a solution with an error in the code and need for a better power supply.  I’ll update once the new parts come in.

Arduino Code:


/*
Weather Bot
*/

//Library Inclkudes
#include
#include "Ultrasonic.h" //included but not implemented

dht11 DHT;
Ultrasonic ultrasonic(5, 6);

#define DHT11_PIN 2

//Motor A Config
const int
PWM_A = 3,
DIR_A = 12,
BRAKE_A = 9;

//Motor A Config
const int
PWM_B = 11,
DIR_B = 13,
BRAKE_B = 8;

//---------------------------------------------------------------------------

// the setup function runs once when you press reset or power the board
void setup() {

int chkDHT;

// initialize digital pin 13 as an output for Heartbeat.
pinMode(13, OUTPUT);
Serial.begin(9600);
delay(1500); // Delay to make sure serial monitor is clean
Serial.println();
Serial.println("Ichi System Test");
Serial.println("--------------------------------------------------");

Serial.print("HC-SR04 Ultrasonic Rangefinder: \t");
if (ultrasonic.Ranging(INC))
Serial.println("OK\t");
else
Serial.println("Unknown error\t");

Serial.print("DHT11 Temperature and Humidity Sensor: \t");
chkDHT = DHT.read(DHT11_PIN); // READ DATA
switch (chkDHT){
case DHTLIB_OK:
Serial.println("OK\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.println("Checksum error\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.println("Time out error\t");
break;
default:
Serial.println("Unknown error\t");
break;
}

Serial.print("DHT11 LIBRARY VERSION: ");
Serial.println(DHT11LIB_VERSION);

Serial.println();
Serial.println("DHT11\tHumidity (%)\tTemp. \t\tRange");
Serial.println("--------------------------------------------------");

}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

// Temperature / Humidity Check
int chk;
chk = DHT.read(DHT11_PIN); // READ DATA
switch (chk){
case DHTLIB_OK:
Serial.print("OK\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error\t");
break;
default:
Serial.print("Unknown error\t");
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity,1);
Serial.print("% \t\t");
Serial.print(DHT.temperature,1);
Serial.print("C/");
Serial.print(Fahrenheit(DHT.temperature),1);
Serial.print("F \t");
Serial.print(ultrasonic.Ranging(INC));
Serial.println(" in.");

delay(1000);
}

// Functions
// -----------------------------------
double Fahrenheit(double celsius)
{
return 1.8 * celsius + 32;
}