profmason.com

December 2, 2007

USBCar Dream Cheeky driver

Filed under: Robotics — profmason @ 9:26 pm

dreamcheekysoftware.JPGPreviously I took apart my new Dream Cheeky USB RC car. Now I want to develop a driver that will allow me to control it from my own software. I knew that it followed the HID device protocol because USBHID was included in the installation.

If you are new to HID devices, you should check out Jan Axelson’s page. Jan’s books have been inspirational for me for years! (Starting with the serial port book years ago)

I started with a program called SimpleHIDwrite which will let me write raw values to a HID device.

On opening SimpleHIDWrite the Dream Cheeky USB car shows up as a device called the “Rocket Baby” Pretty funny.

The device returns the following information from a info request:

PID 0A81
VID 0702

When the car is in the charger and the car is charging the driver returns:

RD 00 05

When the car is fully charged the driver returns:

RD 00 85

When the car is out of the charger the driver returns nothing.

Writing a 01 to the driver causes the car to go forward (That was a surprise!)

Here is a table with the rest of the commands in HEX

$01 Forward

$02 Right

$20 Left

$04 Backward Right

$08 usbcar.JPGBackward

$10 Backward Left

$00 STOP!

Thats it! Now if I can talk the roborealm folks into changing their Dream Cheeky driver to include this I will be set. Otherwise I will have to start coding……

Ok, so I started coding a little bit. I downloaded Jan’s VB6 HID module and got it working with the USB car. I have to stop working on this or I will be up all night!

So I wrote a simple windows program to control the Car. It uses Jan Axelson’s HID module and has a simple mouse interface to drive the car. There really were other things I should have been doing tonight! Download the program here! usbcar.exe

Dream Cheeky USB car

Filed under: Robotics — profmason @ 8:20 pm

usbcar-transmitter.jpgThe Dream Cheeky USB car is a small remote control car that can be controlled from you PC. Taking apart the transmitter side there is a single chip covered in potting compound and two crystals, one at 12Mhz and the other at 27.2 Mhz. There is an antenna wrapped around the enclosure, but this antenna is to short to be an effective 1/4 length antenna for either frequency. The antenna is about 30 cm long which would correspond to a frequency of 260 Mhz. Here is a picture of the transmit side. The potted in chip is on the other side of the board along with a bunch of surface mount resistors. The first hack was to run the transmit antenna straight up in a drinking straw. This increased the range of the car out to about 1.4 meters.

inside-usbcar.jpgI then took the car apart. There are a couple of transistors used to drive the motors. There is a small pot that can adjust the receive frequency. The steering is done by energizing a small electromagnet that drives the front wheels and there is a small gear motor in the back which drives the rear wheels. A small battery provides power and is wired to the two contacts in the back for charging. The cars antenna is wound up inside the top of the car. I unwound its antenna and ran it up a drinking straw. Now the range increased to about 2.4 meters. These seem like small changes, but they dramatically effect the performance of the car.

The next task is to figure out how to control the car from some application other then the provided dream cheeky software. The driver uses the USBHID dll so it should be pretty easy to take over. There is some amount of documentation on the net about another dream cheeky product “Dream Cheeky USB missile launcher” so that might be a starting point for writing software for this device.

Ultimately I would like to control this car from Roborealm.

Here is a short video of the car driving controlled from the computer station several meters away.

USB CAR.MOV

Here is a picture of the finished product.

usbcarantennamod.jpg

H

November 29, 2007

Controlling Robosapien from Roborealm

Filed under: Robotics — profmason @ 1:26 am

robofield.jpgAfter completing the PicAXE based Robosapien control unit, I wanted to interface it to Roborealm. Since the PC Robosapien interface I built just takes serial commands and sends out Robosapien IR, it was pretty straight forward to get it working using the serial module at 4800 8N1. I put together a quick arena to provide a good surface and background for the Robosapien and started working on implementing the path planning module to design a path based on an overhead camera looking at a series of waypoints, in this case the Robosapiens bowling pins. The biggest problem right now is that the Robosapien moves around so much from side to side it is difficult to track his orientation relative to the path.

Here is a video of the Robosapien moving under roborealm control. robosapien.avi

There is an excellent tutorial on path planning on the Roborealm website.

There is much more work to be done on this.

November 27, 2007

39.2 Khz signal modulated at 1200baud for Robosapien

Filed under: PicAXE, Robotics — profmason @ 12:41 am

irtransmitter.jpgThis is a work in progress. (It now works!)

I setup the pwmout to provide close enough to 39.2 kHz and feed that into an AND gate. The other input of the AND gate is an output from the picaxe. I send T1200 signals out from the output and into the AND gate which results in a 39.2 Khz carrier modulated at 1200 baud. Great so far!

BUT! The Wowee protocol wants a header that looks like this %11111111 followed by a time spaced pattern where a high is 0001 and a low is 01. If I code up a typical pattern for say “Walk forward” or $86 it looks like %11111111,%000101010,%01010001,%00010100

It took me the longest time, but I think I know what isn’t working. Looking at the output on a scope there is a single low to high transition between each 8 bit transmission. This is messing up all my timing. I assume this is the “1 stop bit” in the 8n1. I don’t know where to go from here. Maybe if I sleep on it I will have some ideas in the morning. Otherwise, I will have to give up on the Picaxe for this project.

UPDATE:

After learning that the V2 protocal is 12 bits long, (From building a receiver and tying it to a scope) and getting an idea from Hippy on the Picaxe forum the project is now working. Here is the code

  • ‘RoboSapien IR control using picaxe 08M
    ‘Pass commands at 4800 baud 8N1 from your terminalsetfreq m8′IR is modulated by channel 1
    symbol IR = 1
    ‘This is a dummy variable to make pulsout work
    symbol dum = 4′These are values to make the timing work
    symbol duration = 88
    symbol start = 1203
    symbol highbit = 560
    ’start the pwm module
    pwmout 2,50,100
    main:
    low ir
    ‘refresh the pwm module
    pwmout 2,50,100
    pause 50
    ‘Get a value from the terminal
    serin 4,N2400,b0
    pause 10′Init and WAKEUP sequence
    high IR
    pulsout dum,start
    ‘RSV2 header is always 0011 0
    low IR
    pulsout dum,duration
    high IR
    pulsout dum,duration
    ‘This bit is low 0
    low IR
    pulsout dum,duration
    high IR
    pulsout dum,duration
    ‘This bit is high 1
    low IR
    pulsout dum,highbit
    high IR
    pulsout dum,duration
    ‘This bit is high 1
    low IR
    pulsout dum,highbit
    high IR
    pulsout dum,duration
    ‘END HEADER

    ‘logic

    if bit7 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit6 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit5 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit4 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit3 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit2 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit1 = 0 then
    gosub lowsignal
    else
    gosub highsignal
    endif
    if bit0 = 0 then
    goto finallowsignal
    else
    goto finalhighsignal
    endif

    goto main

    highsignal:
    ‘This bit is high 1
    low IR
    pulsout dum,highbit
    high IR
    return

    lowsignal:
    ‘This bit is low 0
    low IR
    pulsout dum,duration
    high IR
    return

    finalhighsignal:
    ‘This bit is high 1
    low IR
    pulsout dum,highbit
    high IR
    pulsout dum,2
    goto main

    finallowsignal:
    ‘This bit is low 0
    low IR
    pulsout dum,duration
    high IR
    pulsout dum,2
    goto main

A quick note on the IR transmitter stage. I adapted this from the robotroom. He has a nice writeup on using a 555 to drive a IR transmitter. However, the PicAxe pwmout gives a reasonable alternative.

irdriver.JPGdso.jpg

Finally just for fun I tried taking pictures of the oscilloscope screen with the digital camera. This is not of any particular signal, but it works better then I expected! I remember using a special adapter to take Polaroids of Oscope screens back in the day…..

Because this project was such a pain, I bought a new scope written about elsewhere. I love it! Here is a wowee signal on the new scope. Where was this a few weeks ago! Note that the 0011 header followed by the device command. In this case it is 10010000 This corresponds to the master program command (Or the D button on the remote)

woweeir.jpg

November 23, 2007

Vex Competition 11/22/07 LA Valley College

Filed under: Robotics — profmason @ 8:09 pm

The Mt. Sac society of physics students mentored a team to the Small Manufacturers association Vex Robotics competition. Here is a picture of the team:

vex1.jpg
Not pictured are advisors Ben Chu and Profmason.

The competition is supposed to run five rounds with the best win/loss and point ratio being ranked into the top eight at the end of the competition. This competition had 46 teams! This meant there were approximately 250 people actively competing! The large number of competitors made it difficult for the event organizers, but the did a great job of keeping the event moving and organized.

Each round consists of four robots in two teams of two. The round starts with a twenty second autonomous navigation period, is scored and then there is a two minute remote control period. Rules for the competition are available here.

vexround1.jpg

Here you can seem Team Wacbot with their alliance partners. Their alliance partners was one of several all girl teams mentored by the Girl Scouts of America. I can barely wait to sign my daughter up for girl scouts!

Unfortuately, during the autonomous navigation round, WacBot got caught up on a ring and wasn’t responding to controls. It spent the entire round sitting stuck on the ring.

vexmotorrebuild.jpg

The students did a terrific job of problem solving and ended up tearing out, rebuilding and reinstalling the stripped motor in less then twenty minutes! The students decided to make some substantial design changes to the robot to prevent this problem from happening again!

vexredsign.jpg

Unfortunately their chief programmer didn’t make it to the competition. (He had been up all night the night before coding the autonomous mode!) The vex control box with the program installed had stopped responding on two channels. The students swapped in a different control box, but this lacked the autonomous programming.

wacbotgood.jpg

After the modifcations, Wacbot was hot! With Kevin driving they racked up ring after ring on the high tower, setting the competition record for rings on the high tower! They triumphed their next two rounds and ended up in 9th place out of a field of 46!

Then they were struck by disaster again. The arm pivot had been doing such yeoman work hoisting rings that it stripped out in the middle of a match! The students tore the pivot mechanism apart and rebuilt it.

armpivot.jpg

They finished the rebuild and rushed to the competition stand. Then they found out that the last rounds had been canceled due to time constraints! The organizers had done their best, but there were so many teams that they couldn’t run five rounds.

Here is a picture of the winning robot in the individual rankings.

1stplacevex.jpg

Despite being getting zero points the first round and loosing the arm in another round, the team still finished 27 out of a field of 46!

Here is a picture of a championship round to give you a feel for what the competition looks like. Four robots battling it out!

championshiprnd.jpg

Overall the team did a terrific job, especially of diagnosing problems on the fly and finding appropriate solutions. This is a great competition and the organizers, Marty and Ralph from the Small Manufacturers Association deserve major Kudos for putting on an event that inspires so much creativity, ingenuity and hard work!

teamgood.jpg

Team WacBot is hoping to get a spot in the finals at Cal State Northridge in December!

« Newer PostsOlder Posts »

Powered by WordPress