InduinoX User Guide - Interfacing with the Simple Labs' Servo Shield

The Simple Labs' Servo Shield is a custom designed Shield to drive Servo Motors. The Shield Can drive upto 10 servo motors at a time. It was originally designed for our Quadbot Robot Kit (8 Servos) + Mini Pan and Tilt Kit (2 Servos). In addition to this, the servo shield has suitable pin outs to be able to Connect the Compound Eye IR Sensor.




Servo Motors - What are they?


Servo motors are dc motors with a servo mechanism that lets us control the precise position of the Shaft.

A servo mechanism is a error correction mechanism that senses the negative error and applies a correction accordingly.

There are many types of Servo Motors available - depending upon applications.
They are used in areas requiring position control. While the basic working of all the servo motors is almost similar, for the scope of this tutorial we shall stick to discussing RC Servo Motors or the type of Servo motors used in Robotics / Radio Control Projects.


A Servo motor constitutes of 4 parts - a DC motor, a Gear system, A Potentiometer(for sensing feedback) and a Control Circuit. Here the Control Circuit and the Potentiometer together form the Servo Mechanism.





So How do Servo Motors Work?

The Control Circuitry on the Servo motor drives the DC motor based on input signals it receives, The output shaft of the DC motor is connected to the gear assembly and the gear assembly is such that it moves the potentiometer when it rotates. The Control Circuitry gets feedback from this potentiometer and spins the DC motor to achieve the desired angle between 0 & 180 degrees. The range of movement of the potentiometer is mechanically restrained.

And How do we Control these Servo Motors?

To Control a servo we need to give it a pulse once every 20 milliseconds. The Duration of this pulse will determine the Servo Angle which we need to achieve. For most Servo's a Pulse duration of 1millisecond will set the shaft position to 0 degrees and a pulse duration of 2 milliseconds will set the shaft position to 180 degrees. 



Controlling Servos with an Arduino

Arduino provides us with a servo control library that lets us control servos with ease. The library provides us with an option of writing both microseconds value and angle values. You can find more information on the library here - > Arduino Servo Library

Overview of the Servo Shield

The Servo Shield has clear pin mappings and polarity mappings for the Servos. It has a screw terminal for connecting an external power supply for the Servos. Servos require 4.8-6Volts and consume around 300-500milliamps. The Servo shield requires to be powered from an External Source for it to drive your servos.



The servo shield has Servo control pins on Arduino Digital Pins D2, D3, D4, D5, D6, D9, D10, D11, D12 & D13. Refer to the TOP Legend on the board "D + - " for the Orientation of the Servo Connector Connection.

Connect a Servo to D9 and an external Supply to the Battery Connector as Shown a 4xAA Battery Connector is used here in the image. The Servo shown in the image is part of the Quadbot Kit. If you are looking for a servo, you can check out the Tower Pro SG-5010



The Program

With the above setup you can load the 'Sweep' Program from within the Examples. This program is located at

File -> Examples -> Servo -> Sweep (Inside the Arduino IDE!)


InduinoX User Guide - Working with NEC Remotes

The Simple Labs InduinoX Arduino Learners' Kit comes with a small remote, the kind of remote you would find with a MP3 Player / Audio Players. Owing to their size these remotes have spread fast and hence this tutorial on how to decode these manually without using the library. If you want to use the library, check out our previous post on this

These small remotes use the NEC protocol which is a 32-bit protocol and much different from the SIRC Protocol we saw earlier. Here's the signal train of the NEC protocol

The Start Bit is a 9 ms long pulse followed by 4.5 ms space. This is  followed by a burst of 32-bit data. The 32-bit data consists of 8-bits of command and 8-bits of address which are transmitted twice for reliability. The first transmission of 8 bits is inverted when it is being transmitted the next time for increased reliability.


Heres the Pulse Modulation of the NEC Protocol

The Logical '1' is represented by a 560us long 38khz pulse (MARK) followed by a 1690us long LOW signal (SPACE). The Total Duration for the Logical '1' is 2.25us.

The Logical '0' is represented by a 560us long 38khz pulse (MARK) followed by a 560us long LOW signal (SPACE). The Total Duration for the Logical '1' is 1.12us.

So How do we read this?

For our purpose, we can read this as a 16-bit data (8-bit address & 8-bit command)


To read this signal here are the things we need to do
  • Wait till be get the start bit
  • Read the time duration for the subsequent 32bits
  • Sort through the time duration in 4 parts of 8-bits each
  • Calculate 2 values, one from the bits 0-7 and 16-23 and one from bits 8-15 & 24-31
  • Check if these values are equal. If so take the value as valid. if not ignore the value.
Here's the code for a function to read NEC remotes. This function works for the InduinoX board.


int remote()
{
  int val1=0,val2=0, dur[32], i=0, j=0;
  if(pulseIn(15,LOW)>8000)
  {
    for(i=0; i<32;i++)
    {
      dur[i]=pulseIn(15,HIGH);
    }
    
//Value Calculation

    for(i=0,j=0;i<24;i++,j++)
    {
      if(i==8)
         i=16;
      if(dur[i]>1000)
          val1 = val1+ (1<<j);
           
    }
    for(i=8,j=0;i<32;i++,j++)
    {
      if(i==16)
        i=24;
      if(dur[i]<1000)
        val2 = val2+ (1<<j);    
     }
     Serial.println(val1);
     Serial.println(val2);
     if(val1==val2)
       return val1;
     else
       return 0;
  }
  
  return 0;
}




InduinoX User Guide - Interfacing with the Wireless Shield / BTBee

Bluetooth control seems to be the In-Thing! hook up your InduinoX with your Android phone over Bluetooth and zap you go... With a little bit of Android Expertise, you can double the potential of your Arduino Projects.



So How does one hook up the InduinoX over Bluetooth?

For this, we are going to use and Xbee shield and a Bluetooth Module - BTBee

The Xbee shield is a low cost arduino shield for plugging in any device with the XBee foot print. The shield offers the flexibility of using any of the digital pins for Rx/Tx through a jumper setting mechanism. In our case, we will stick to use the default Rx/Tx pins of the InduinoX. For those of you willing to explore further, check out Software Serial using arduino.

The BTBee is a low cost serial bluetooth module with the same footprint as an Xbee. The BTBee has 2 LEDS a Red led for Power and a Green led for status indication. The Green led will be constantly blinking till the device is paired. Beware! the BTBee has a lot of dummy pins just to match the XBee footprint. In effect, it uses only 5 pins


Pin  Description
1 VCC  Power supply
2 TX  Data output
3 RX  Data input
5 Reset reset
10 GND  Ground

Place the BTBee on the Xbee shield as shown in the video. Upload the following test program onto the InduinoX and then place the shield on top of the InduinoX board. Remember place the Xbee shield only after uploading the program as otherwise you might face an error. (Since we use serial communication for programming, if there are other devices attached to the default serial port, programming the microcontroller will throw up an error.)

The test program expects a serial character 'A' to turn ON the led on the 13th pin and another character 'B' to turn it OFF.

Next Download the following App for your android phone BlueTerm

The BlueTerm App is a terminal app for Android that can simulate a Serial Terminal over Bluetooth.

Power your InduinoX (you can use USB power), turn on Bluetooth on your phone and scan for devices. If this is the first time you are pairing with the BTBee module you will see a set of numbers (the device id) try to pair with this using the code '1234' once it is paired, it will show up as 'linvor'. Now open the app and connect to linvor. Once connected, the app will show a message as connected and the Green led on the BTBee will stop blinking and remain stable (ON) Now type in the characters and get control of the LED on the InduinoX!

Here's the sample code. Make fun with Bluetooth!

 void setup()  
 {  
  Serial.begin(9600);  
  pinMode(13,OUTPUT);  
 }  
 void loop()  
 {  
  if(Serial.available())  
  {  
   int val = Serial.read();  
   if(val == 65)  
   digitalWrite(13,HIGH);  
   if(val==66)  
   digitalWrite(13,LOW);  
   Serial.println(val);  
  }  
 }  

InduinoX User Guide - Interfacing with the LCD Shield

The LCD Shield eases the process of interfacing a LCD display with the Arduino. The shield fits on top of any Arduino and takes power from the Arduino. 


How to place the Shield on top of an Arduino?
The shield has one of set 8 pins and 1 set of 6 Pins. The trimpot on the shield is on the top left side. Now place the shield onto your arduino such that the eight pins are placed on top of pins 8,9,10,11,12,13,gnd & aref and the six pins are placed on top of pins Vin, gnd, gnd, +5V, +3.3V & reset


The LCD shield is designed to work with 16 pin LCDs with the following pin configuration.





LCD Pin Mappings for the Shield
The LCD shields provides a 4-bit mode interface to the Arduino. The Pins are connected as follows.
RS => 8
E => 9
D4 =>10
D5 =>11
D6 =>12
D7 =>13

You can run the Hello World Example under File->Examples->LiquidCrystal->Hello World, with the following changes
replace this line
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
with
LiquidCrystal lcd(8,9,10,11,12,13);



Character LCD - A Quick Overview
Here's an interesting Write up to get you understanding the working of the LCD
http://joshuagalloway.com/lcd.html

InduinoX - Getting Started Guide


-->
InduinoX Getting Started – For Windows XP / Windows 7
--> -->

  1. Download the latest version of Arduino for Windows from here => http://arduino.cc/en/Main/Software
  2. Unzip the downloaded file and remember its location
  3. Connect the InduinoX board to your PC using the usb cable provided. You should see the power (red) led go on on the InduinoX board.
  4. Windows will detect a new usb device. Ignore any options to install drivers and Do not let windows install any drivers automatically.
  5. Open windows device manager
You can open windows device manager by right clicking on 'My Computer' and choosing Properties. In the new Window, Click on Device Manager [In Windows XP, this can be found under 'Hardware Tab' of the Properties Window]
  1. Now Scroll Down the List of Devices in the Device Manager till you come to a Device 'FT232R USB UART'. You should see a warning icon next to it as the drives have not been installed. Right Click on this Device and Choose 'Update Driver Software...' option.
  1. Now, Windows will provide you two options, Choose the one that says “Locate and install drivers manually from a specific Location.”
  1. In the next screen, you will see a browse button, click on the button and browse to the location of the drivers folder[You will find the drivers folder inside the unzipped arduino folder] and then click 'OK'. Then Click 'Next'
  1. Now, Windows might throw a Security  warning, ignore it and click on next.
  1. The Device will be installed as a USB Serial Converter
  1. Now Windows will detect a USB Serial Port and ask you for drivers. Follow the exact same process as we did earlier, choosing the same driver location as earlier.
In case Windows doesn't ask you, scroll through the Device manager and find the listing called 'USB Serial Port' and follow the above steps.
  1. Once everything is finished, You should be able to see a new device 'USB Serial Port (COMXX)'. Make a note of this Number.

  2. Now go the unzipped Arduino folder and run the arduino.exe file
  3. The Arduino IDE will open up
  4. In the Arduino IDE open the blink example program by clicking on it from under File -> Examples -> Basics
  5. Now select the board by going to Tools -> Boards -> and selecting 'Arduino Diecimila or Arduino Duemilanove w/ Atmega168' ARDUINO UNO
    If you have one our recent board InduinoX with ATmega328, Select Arduino UNO as the board

  6. Now select the Serial Port by going to Tools -> Serial Port -> and selecting the 'COM port that was earlier shown in the device manager'

  7. Now Click on the Upload button. In a moment, you should see 2 LEDs Rx & Tx blink on your InduinoX indicating the program being uploaded. Once the program is uploaded, you will see the White LED[13th Pin] on the InduinoX Blink
Thats it! We are Done!