Saturday, April 18, 2009
EYE-FI card acquisition
First transmission
Changes made to the structure
We considered this to be a very good choice, because besides getting rid of unnecessary weight, the structure itself looked a lot nicer than the trash can we planned on using.
The circuitry, as well as the camera and the battery, will be set on the different levels of our structure. In the bottom part we will attach the transmissions.
Battery exchanged
Luckily, while we were working on the Networking Lab, we found a similar battery, whose weight is around 1/3 of the weight of the previous one. This battery gives us 12V and 4A. We thank engineer Raime Bustos the loan of this battery for the development of our project. The battery has been set on the structure in the following way:
Sensor module demonstration
This module is part of the surveillance robot. It will be in charged of the ultrasonic sensor (SRF08) and infrarred sensors (GP2D15). For their control, we used a microcontroller PIC18F452. The programming was written in C with the CCS compiler. This module will communicate with the central module, who will be in charge of making the needed changes to the path.
Sensors module
Hardwork on springbreak
Our team seized the awaited spring "break" to work day and night on the project.
Some of the things achieved during this week were the development of the sensors and obstacle detection system.
We decided to get a new infrarred sensor, to make our system more complete.
The system to program the movement and trajectory was finished, as well as a wireless module, so now it is not even necessary to make the connection to a PC to program the path to follow.
Talking about the transmission design, considerable achievements were made, this will be shown in the following entries of our blog.
The structure suffered several modifications for our team's convenience. We will follow a similar structure to the one of the EOS robot. This structure is still on process.
Tuesday, April 7, 2009
Control System.
The wheels direction is also controlled by the microcontroller using a DC motors driver (L293) which has the capability of controlling the direction of two motors. Then, a power stage is placed to avoid that the driver burns and feed the current necessary to move the engines.
Structure, Traction System and Trajectory Control
There are going to be two levels inside the structure. On those levels the battery and the robot control circuitry will be stored.
The traction system will be conformed by two DC motors of 12V. They will give traction to the robot with a crazy wheel to give stability and facility of movement to it.
The aproximated weight of the robot is 5.5 Kg and for this reason a reductive transmission will be located to reduce the motors revolutions and increase the torque that will be transmitted to the traction wheels of the robot.
At the beginning we propose to use a transmission made from polyethylene and composed by bands and pulleys to make the revolutions reduction, but we found that in some cases at the moment of taking the transmission to forced jobs and find break points or skid of the material, the robot stoped moving or the plastic bands blow out. This is why we decided to implement a transmission composed by gears to avoid shuffles between components inside it.
The first transmission tests were done with transmissions that contained three gears with the purpose of having one gear that was the product of the movement, which goes directly to the rotor´s DC motor. The second gear is conected to the rotation axis of the wheels. The third gear is located between the other two and it has the function of transmitting energy and it´s also a fuse gear which aviods that the motor overheating burns the motor or the circuitry.
Due to the complexity of this system we decided to make a simple two-gear transmission with a ratio of 3 to 1. The final system will be a gear on the rotation axis of the wheel and another on the DC motor´s rotor. This means that the gear that goes into the axle of the wheels is approximately 3 times bigger than the one that goes on the motor´s rotor.
The transmissions´ gears were molded with resistant plastic to prevent fractures caused by friction when the robot is moving. Since the gears will be interacting directly with each other, the rotor´s gear of the DC motor is made of heat resistant plastic, with a total of 19 teeth on its circumference, the gear that is placed on the axis of the rim is made of lightweight plastic to make it easier to spin the wheels with a total of 60 teeth on its circumference. The robot´s wheels diameter is 2.5 inches and they are made of hard plastic and coated with soft plastic to cushion the bounce that is caused by the irregularities of the terrain.
Monday, April 6, 2009
Interface for the Record of the Trajectory
User Interface
This second code is the interface code. On it, the user can predefined the trajectory and send the signal to the microcontroller so it can play it. This program is made in LabWindows CVI.
Code
#include "Trayectoria.h"static int panelHandle;
int SendAsciiString (int comport, char *send_ASCII);
int GetSerialMessage (int comport, char *readdata);
char readBuffer[256];
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "Trayectoria.uir", PANEL)) <
loopexit =" 0;" x="0;" error =" -1;" x="0;" begin =" Timer();"
seconds =" 0.003;" inbuffer =" GetInQLen"> 2) {
ComRd (comport, readdata, InBuffer);
LoopExit = 1;
error = 0;
break;
}
SyncWait (Begin, Seconds);
}
if (x == 500)
break;
} while (LoopExit == 0);
return error;
}
First Phase of the Trajectory Planning Program
/*********************************************************************/
/* Project Name: Treyectory */
/* Source fle name: RTC.c */
/*********************************************************************/
/* Robotecnicos */
/*********************************************************************/
/*********************************************************************/
/* Code for QE128 MCU's */
/* Module: Trayectory */
/* The code was developed and tested on CodeWarrior 6.0 version */
/* */
/* Description: To learn the trayecory to be followed */
/* */
/*********************************************************************/
/* */
/* Date: 07/03/2009 */
/* Robotecnicos */
/* ITESM */
/*********************************************************************/
#include /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
/*********************************************************************/
/* Globals */
/*********************************************************************/
#define RECORDING 1
#define LOOP 2
#define RESET 3
#define UP 1
#define DOWN 2
#define RIGHT 4
#define LEFT 8
#define PHOTO 16
typedef unsigned char UINT8;
unsigned char edo_past = 0;
unsigned char begin= 0;
unsigned char finish = 0;
unsigned char in = 0;
unsigned int count = 0;
unsigned int direction = 0;
unsigned int elements = 0;
unsigned int i = 0;
unsigned char state = RECORDING;
unsigned int trayectory[5][2];
/*********************************************************************/
/* Function declarations */
/*********************************************************************/
void MCU_Init(void) {
SOPT1 = 0x23; /* Watchdog disable. Stop Mode Enable. Background Pin enable. RESET pin enable */
SCGC1 = 0x01; /* Bus Clock to the SCI1 module is enable */
SCGC2 = 0x04; /* Bus Clock to the RTC module is enable */
}
void GPIO(void) {
PTAPE = 0x0C;
PTADD = 0x00; // Configure Port A as inputs
PTDPE = 0x0C;
PTDDD = 0x00; // Configure Port D as inputs
PTCDD = (PTCD 0x3F); /* Configure PTC0-PTC5 as outputs */
PTEDD = (PTED 0xC0); /* Configure PTE6 and PTE7 pins as outputs */
PTCD = 0x3F; /* Put 1's in port C in order to turn off the LEDs */
PTED = 0xC0; /* Put 1's in port E port in order to turn off the LEDs */
}
// To print data in the LEDs of DEMOQE
void display(byte x){ /* LEDS low power active */
x = ~x;
PTED = (x & 0xC0); /* Move the adquired ADC value to port E */
PTCD = (x & 0x3F); /* Move the adquired ADC value to port C */
}
void RTC_configuration (void) {
RTCSC = 0x08; /* RTCPS configure prescaler period every 1s */
RTCMOD = 0x00; /* RTCMOD configure to interrupt every 1s */
}
void SCI_configuration (void) {
SCI1C1 = 0x00; /* 8-bit mode. Normal operation */
SCI1C2 = 0x2C; /* Receiver interrupt enable. Transmitter and receiver enable */
SCI1C3 = 0x00; /* Disable all errors interrupts */
SCI1BDL = 0x1A; /* This register and the SCI1BDH are used to configure the SCI baud rate */
SCI1BDH = 0x00; /* BUSCLK 4MHz */
/* Baud rate = -------------------- = ------------ = 9600bps */
} /* [SBR12:SBR0] x 16 26 x 16 */
/*********************************************************************
* Main Function *
*********************************************************************/
void main(void) {
MCU_Init(); /* Function that initializes the MCU */
GPIO(); /* Function that initializes the Ports of the MCU */
RTC_configuration(); /* Function that initializes the RTC module */
SCI_configuration();
EnableInterrupts; /* enable interrupts */
/* Enable RTC interrupt */
for(;;) {
// in = ((~PTAD) & 0x0C);
// in = in >> 2;
// in = in ((~PTDD) & 0x0C);
switch (state){
case RECORDING:
if (finish == 0x01){
finish = 0x00;
begin = 0x00;
trayectory[elements][0] = direction;
trayectory[elements][1] = count;
count = 0;
elements ++;
//if (elements == 5) state = LOOP;
}
if(begin == 0x00) {
edo_past = in;
switch(in){
case 1 : PTCD_PTCD0 =0; RTCSC_RTIE = 1; begin = 0x01; direction = UP; break;
case 2 : PTCD_PTCD1 =0; RTCSC_RTIE = 1; begin = 0x01; direction = DOWN; break;
case 4 : PTCD_PTCD2 =0; RTCSC_RTIE = 1; begin = 0x01; direction = RIGHT; break;
case 8 : PTCD_PTCD3 =0; RTCSC_RTIE = 1; begin = 0x01; direction = LEFT; break;
case 16: PTCD_PTCD4 =1; RTCSC_RTIE = 1; begin = 0x01; direction = PHOTO; break;
default: PTCD = 0xEF; RTCSC_RTIE = 0;
}
}
break;
case LOOP:
PTED_PTED6 = 0;
RTCSC_RTIE = 1;
break;
case RESET:
elements = 0;
PTCD_PTCD0 =1;
PTCD_PTCD1 =1;
PTCD_PTCD2 =1;
PTCD_PTCD3 =1;
PTCD_PTCD4 = 0;
break;
}
} /* loop forever */
/* please make sure that you never leave this function */
}
/*********************************************************************
* Interrupt Service Routines *
*********************************************************************/
void interrupt VectorNumber_Vsci1rx SCI_RX_ISR(void) {
SCI1S1_RDRF = 0; /* Receive interrupt disable */
// display (SCI1D); /* Display on PTE the received data from SCI */
switch (SCI1D){
case '0': in = 0; break;
case '1': state = RECORDING; break;
case '2': state = LOOP; break;
case '3': in = 1; break;
case '4': in = 2; break;
case '5': in = 4; break;
case '6': in = 8; break;
case '7': in = 16; break;
case '8': state = RESET; break;
}
while (SCI1S1_TDRE == 0); /* Wait for the transmitter to be empty */
//SCI1D = '1'; /* Send a character by SCI */
}
void interrupt VectorNumber_Vrtc RTC_ISR(void) {
RTCSC = RTCSC 0x80; /* Clear the RTC flag */
PTED_PTED7 ^= 1; /* Toggles PTE7 pin */
// in = ((~PTAD) & 0x0C);
// in = in >> 2;
// in = in ((~PTDD) & 0x0C);
switch(state){
case RECORDING:
count++;
if(edo_past != in){
finish = 0x01;
RTCSC_RTIE = 0;
}
break;
case LOOP:
if (count == trayectory[i][1]){ PTCD_PTCD0 =1; PTCD_PTCD1 =1; PTCD_PTCD2 =1; PTCD_PTCD3 =1; PTCD_PTCD4 = 0; i++; count = 0;}
count ++;
if(i == elements) i = 0;
direction = trayectory[i][0];
switch(direction) {
case UP : PTCD_PTCD0 =0; break;
case DOWN : PTCD_PTCD1 =0; break;
case RIGHT : PTCD_PTCD2 =0; break;
case LEFT : PTCD_PTCD3 =0; break;
case PHOTO : PTCD_PTCD4 =1; break;
default: PTCD = 0xFF;
}
break;
}
}
Tuesday, March 10, 2009
External trigger CHDK
The diagram to use is really simple.
A USB mini B port is needed to connect it to the camera, while the other side can be connected to a female port connected to the microcontroller or we can cut directly the cable and apply the voltage difference right there.
The program we used to detect the usb port is really simple
@title Remote button
while 1
wait_click 1
if is_key "remote" then shoot
wend
end
It is an infinite cycle (while 1) that waits for some button to be pushed (wait_click 1). If the "button" is in reality the voltage difference in the usb (remote) then it triggers itself and repeats the cycle, if it is any other button then it repeats the cycle without triggering.
The voltage applied to the camera depends on the model. In our case it is enough with 3.75V, however other models require more voltage while others require less.
The CHDK notices the USB port as another button, which means that you can use it to modify the behavior of the program and not just to trigger the camera., today in class we will try to make the camera take pictures in certain time intervals, and when it gets a signal from the microcontroller it will take pictures when it senses movement.
Friday, March 6, 2009
Robot's structure
Thursday, March 5, 2009
Tuesday, March 3, 2009
EYE-FI props. Price
Thursday, February 26, 2009
Welcome to the english version of our blog!
On this semester, we are working on a project for our robotics class. The project involves designing and building a surveillance robot. This robot will be created with educational purposes.
We had created a spanish version of the blog, the contents are pretty much the same, but you can find the original entries to the blog in the following webpage:
http://robotecnicos.blogspot.com
Take a look at the things we have been working on. Feel free to follow our steps and do your own creations.
WELCOME!
Tuesday, February 24, 2009
First test code for the PIC16F877A
ROBOT ELECTRONICS - 1st rule of Robotics: Have fun!
In this webpage we could find a variety of examples to control our SRF08. The owners of this code samples allows us to use them for educational purposes, but not commercial ones.
We found the following program, which would be the first in our set of tests with the PIC16F877A.
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [Vladimir Kornienko] *
'* Notice : Copyright (c) 2006 [ARMORED DOLPHIN] *
'* : All Rights Reserved *
'* Date : 12/1/2006 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
'PIC16f872
'---------------- Definitions---------------------------------------------
define OSC 20
'------------- Define LCD registers and bits------------------------------
DEFINE I2C_HOLD 1
define I2C_SLOW 1
Define LCD_DREG PORTB 'Set LCD data port
Define LCD_DBIT 0 'Set starting data bit
Define LCD_RSREG PORTB 'Set LCD register select port
Define LCD_RSBIT 4 'Set LCD register select bit
Define LCD_EREG PORTB 'Set LCD enable port
Define LCD_EBIT 5 'Set LCD enable bit
define DEBUG_REG PORTC 'Set DEBUD port
DEFINE DEBUG_BIT 1 'Set DEBUG pin
DEFINE DEBUG_BAUD 2400 'Set DEBUG baud rate
DEFINE DEBUG_MODE 0 'Set DEBUG mode
DPIN var PORTc.4 ' I2C data pin
CPIN var PORTc.3 ' I2C clock pin
bearing var word ' word size bearing value 0 - 359
bearing1 var byte ' byte size bearing value 0 - 254
Main:
i2cread dpin,cpin,%11000000,2,[bearing.Highbyte,bearing.lowbyte]
lcdout $fe, 1,"BEARING ",DEC BEARING/10
i2cread dpin,cpin,%11000000,1,[bearing1]
lcdout $fe, $c0,"Bearing ", dec bearing1
DEBUG " Compass Bearing ", # bearing,13,10
pause 20
goto main
Microcontroller PIC16F877A (to control the sensors)
The microcontroller to be used to control our sensors is the PIC16F877A, this one has the particularity of having the necessary pins to communicate in the I2C protocol, making it the best option to our case. The following are the main characteristics of this model:
- Operation Speed: 20Mhz
- More than 8K x 14 words of memory FLASH
- More than 368 x 8 bytes of data memory (RAM)
- More than 256 x 8 bytes of data memory EEPROM
- Low energy comsumption.
- Serial Synchronic Port (SSP) with SPI (Master Mode)
- I2C (Master/Slave)
Ultrasonic sensor SRF08 specifications
This is a high performance distance range sensor. It communicates in the protocol I2C, which is available in the PIC microcontroller to be used to this application.
The SRF08 behaves in the same way than series 24XX eeprom's, except that the adressing in I2C is handled differently.
Some specifications of the sensor:
Voltage: 5v
Current: 15mA Typ. 3mA Standby.
Frequency: 40KHz
Range: 3cm -6m.
Standard Connection I2C Bus.
Light sensor
Units range reported in uS, mm or inches.
Dimensions: 43 x 20 x 17mm height
Weight: 11 g.
Guide to install the CHDK
The following are materials needed to install the CHDK:
Φ SD card
Φ Powershot Canon Compatible Camera. (aqui)
Φ SD card reader
Φ Program CARDTRIKS for Windows users
Φ Hexadecimal editor of your choice
The first thing you have to do is check what FIRMWARE version is included in your camera. For this, we create a Dummy file called vers.req which doesn't need any special contents (It can be a 0 Kb file) It is really important for this step, and for all of them, to have a card reader that recognizes our card as an external disc (or as a standard USB flashcard). If you use the USB cable of the camera, you won't have access to the highest level directory of the card, just to the picture folder.
The file vers.req is copied to the card and after that we need to insert the card in the camera. Turn on the camera in the display mode and press SET for one second. After this, press the DISP button without releasing the SET button, this will cause our FIRMWARE version to appear on the display. In our case, our camera has the GM1.00A.
Once you know the firmware version, download CHDK for the right camera. (http://mighty-hoernsche.de/)
Before installing CHDK on the SD card, we need to set it as we previously described. Windows users will use the program we already mentioned. Mac and Linux users (among other OS based on UNIX) can use the command line to do it. In this case, we formatted the card as FAT16 (just for cards with storage of less than 4gb).
After the command line in the terminal (for Mac users) you use the command dd if=/dev/diskXsX of=BootSector.bin bs=512 count=1 where diskXsX is changed for the card id (something like disk1s1) and this gets copied to your computer in the running sector of the card. The instruction in ubuntu would be dd if=/dev/sdx1 of=BootSector_G9.bin bs=512 count=1 where sdx1 is the card id. This will create the file Bootsector.bin in the "home" file of the user you are currently being at the time.
After this step, you open the file that was copied to the hard disk with an hexadecimal editor and in the 40hexadecimal sector (64 in decimal system) you add the word BOOTDISK, save the file and then do the inverse procedure: You should copy the file to the memory, (in the running sector) in Windows you can use a program for this, in Mac you use a command line in terminal similar to the one used before: dd if=BootSector.bin of=/dev/diskXsX bs=512 count=1 where diskXsX gets replaced by the identifier of the disk, like disk1s1 is. The command line in ubuntu is dd if=BS.bootable of=/dev/sdx1 bs=512, where sdx1 is the card id.
IMPORTANT: in case some of the instructions show you an error message like “dd: /dev/disk1s1: Resource busy” it means that the card is being used by the operating system, so you need to "unmount it," in UBUNTU you can do this from the command line, in MAC you need to go to DiskUtility and select UNMOUNT, it is important to notice that this is not the same thing as ejecting the disc, if you eject the card this will lose the conection to the computer, in this case all we are doing is unplugging the controller that allows the OS to perform actions on the card (like copying files or explore its contents) but the card keeps having a conection to our computer.
Once our card is ready you can install CHDK, the first thing you need to do is decompress the file that was downloaded and place it on the card, all the program goes inside of a folder known as CHDK on the card's root. Once done, you insert the card to the camera but watch out! The LOCK switch on it (Image to the left) must be activated. This switch shows that you can't write files on the card and it is necessary because, in theory, you cannot write on the disk you are using to run the software, but the CHDK overwrites with software this function so the card can also be used to take pictures.
Finally, we just need to turn on the camera and enjoy the CHDK functions.
If you want to use an extra program, go to:
http://chdk.wikia.com/wiki/UBASIC/Scripts
In this webpage they offer a series of extra functions programmed for the CHDK. A really interesting script is the one that senses movement, the demonstration of this program will be done in class.
http://chdk.wikia.com/wiki/UBASIC/Scripts:_Multipurpose_Motion_Detection
To use this scripts, you just need to copy them to the card and load them from the CHDK menu.
Friday, February 20, 2009
Protocol I2C summary
To solve this problem, Phillips developed Inter-IC or I2C in the 80s. I2C is a short distance, low bandwidth protocol. All of the devices connect to the network by 2 cables. We already mentioned that we will be using the SRF08 ultrasonic sensor, which is designed to communicate through this protocol.
The following are some of the most important characteristics of this protocol:
•It needs only two lines, the serial data and serial clock (SDA and SCL)
•Each device connected to the bus has an address code that you can choose by software. There is permanently a Master/Slave relationship between the microcontroller and the devices connected to the network
•The bus allows the connection of several masters, since it includes a collision detector.
•The data and address transference protocol allows us to design systems completely defined by software
•Data and address are transmited in 8bit words.
The lines SDA and SCL transport information between the devices connected to the bus. Every device is recognized by its own code or address and it can operate as a transmitter or receive data. Besides, every device can be considered as master or slave. The master is the device that starts the transference in the bus and generates the clock signal. The slave is the addressed device.
The lines SDA(serial Data) and SCL (serial Clock) are bidirectional, connected to the positive voltage through the pull-up resistors. When the bus is free, both lines are on logical high level.
The serial bidirectional data transmission (8-bits)can be done at 100Kbits/s in the standard mode or at 400 Kbits/s in the fast mode.
The quantity of devices that can be connected to the bus is limited, only, by the maximum capacitance allowed: 400pF.
Tuesday, February 10, 2009
Friday, February 6, 2009
Wednesday, February 4, 2009
EYE FI
We found some pictures on Flickr where they opened the EYE FI card, in this way, we can notice how the card is built from the inside. We see that we have a SAMSUNG memory chip, the wireless chip is ATHEROS (the ROCm that is used in cellphones with WI-FI). We also have the GPS chip that is only available on the most expensive version of the card.
http://www.flickr.com/photos/sniperninja123/3245581254/in/photostream/
Here is a webpage where they explain in detail what is every chip and its specifications.(http://www.ikontools.com/articles/eyefi-dissected)
Tuesday, February 3, 2009
Wednesday, January 28, 2009
WIFIBOT
WIFIBOT is a french company that manufactures robots with cameras and WiFi conections. Even though it is a small company, it has some interesting robots, including some that besides cameras, have robotic arms.
In this video, we see how someone created a client for the Sony console (PSP) to send the robot video through a wireless network. The processing limitations caused that the transmission was slow and the frames per second received is really low.
This video shows the potential of today's technologies.
Tuesday, January 27, 2009
The technicians
Aracely– a leader by nature, she knows how to movitvate a team to accomplish their objectives besides she has a lot of knowledge in the area of power electronics.
Leslie-Beautiful and dangerous, when she is not soldiering circuits, she defies the laws of gravity building inverted pendules.
Michelle- Expert in math and algorithms, she took advanced courses in the university of San Angelo in the area of matrices, including solving jacobine matrices of more than 2 dimensions.
Adrián-Expert programmer, he knows assembly and C. He has been given several national awards in the area of electronics.
Oscar- He has a lot of experience in the industry. He has unusual abilities, a wide knowledge on pieces design and computational modeling.
Tito-Expert in sensor handling, has deep bonds with diferent national and international providers of electrical components.
Julio- Guru in the area of analog electronics. He knows better than no one the handling of filters and the functioning of op-amps.
Diego- Master in the area of digital signal processing and with an extreme curiosity that guides him to be able to program Fourier Transoforms in even the most basic microcontrollers.
#algunas de las habilidades fueron exageradas con motivo humorístico.
Battery
Thursday, January 22, 2009
Friday, January 16, 2009
Let's begin
Our project consists on the development of a surveillance robot that will take pictures at certain amount of time and will follow a defined path during the night.