Showing posts with label Microcontroller. Show all posts
Showing posts with label Microcontroller. Show all posts

Wednesday, July 1, 2015

Hacking – Robosapien V1 – Comprehensive Robosapien V1 hex codes

Dear All,
the Inventors:Force is currently having fun with hacking the Robosapien V1.
Our first objective is to hack the Robosapien V1 in a way that we can use an Arduino and/or a Raspberry Pi to control the Robosapien via program code which should send the Robosapien V1 command hex code to the motherboard.

While doing so we identified the challenge to find a  comprehensive Robosapien V1 hex codes list – as we might not be the only one looking for it we decided to share the list below – this is an extract from our working Arduino sketch defining variables with the related hex code and description.
Please select the code below and copy/paste it into your Arduino sketch. We have documented the commands and that’s the reason the code is so wide to the right ;-)

We hope this code is useful to you.

We will share at a later stage the hardware modification instructions and program code for the Robosapien V1 we are doing.
All the best,
Ralf

// Ralf Fickert - Inventors:Force Project  "Hack the Robosapien V1 for Arduino"
// Date: June 2015
// Email: rfickert@st3am.com
//
// References/Sources:
// ===================
// http://www.aibohack.com/robosap/ir_codes.htm
// Many thanks to this reference I found the most complete list of
// Robosapien V1 hex Codes

//////////////////////////////////////////////////////////////////////
// Hacking - Robosapien V1 - Comprehensive hex command codes
//////////////////////////////////////////////////////////////////////

// LED RED - Just press buttons without using the SELECT - Basic Movement Commands
//
//Variable                       HEX-Code    Comment
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//

#define RSTurnRight               0x80      // turn right                                   - Send command to turn right on the spot
#define RSRightArmUp              0x81      // right arm up                                 - Send command twice to fully raise arm up 
#define RSRightArmOut             0x82      // right arm out                                - Send command twice to fully turn arm outwards
#define RSTiltBodyRight           0x83      // tilt body right   
#define RSRightArmDown            0x84      // right arm down                               - Send command twice to fully lower arm down
#define RSRightArmIn              0x85      // right arm in                                 - Send command twice to fully turn arm inwards
#define RSWalkForward             0x86      // walk forward                                 - Send command twice to move forward slowly
#define RSWalkBackward            0x87      // walk backward                                - Send command twice to move backwards slowly
#define RSTurnLeft                0x88      // turn left                                    - Send command to turn left on the spot
#define RSLeftArmUp               0x89      // left arm up                                  - Send command twice to fully raise arm up 
#define RSLeftArmOut              0x8A      // left arm out                                 - Send command twice to fully turn arm outwards
#define RSTiltBodyLeft            0x8B      // tilt body left
#define RSLeftArmDown             0x8C      // left arm down                                - Send command twice to fully lower arm down
#define RSLeftArmIn               0x8D      // left arm in                                  - Send command twice to fully turn arm inwards
#define RSStop                    0x8E      // stop                                         - Send command at any time to end a command


// Programming Commands (no shift)
#define RSMasterCMDPRG            0x90      //P (Master Command Program)                    - Send command to set Robosapien into program mode - Robosapien beeps - you can now program up to fourteen steps
//                                                when 14 steps reached Robosapien will automatically repeat the programmed sequence. If you have less then 14 steps then you need to close
//                                                the program by sending once the RSProgramPlay command. To clear the program and return to the default program send the command RSMasterCMDPRG
//                                                followed by the command RSProgramPlay. Turning off the Robosapien will clear any previous set program. The seep (RSSleep) mode will
//                                                keep Robosapiens memory for up to 2 hours. Please keep this in mind when writing the code.

#define RSProgramPlay             0x91      //P>> (Program Play, the one on the bottom)

#define RSRightSensorPRG          0x92      //R>> (Right sensor program)                    - Send command to set Robosapien into program mode - Robosapien beeps - you can now program up to six steps
//                                                when 6 steps reached Robosapien will automatically repeat the programmed sequence. If you have less then 6 steps then you need to close
//                                                the program by sending once the RSProgramPlay command.To trigger the sensor: touch a long finger, or a toe/heel sensor on the right side.
//                                                Alternative send command RSExecuteRightSensorPRG. To clear the program and return to the default program send the command RSLeftSensorPRG
//                                                followed by the command RSExecuteLeftSensorPRG. Turning off the Robosapien will clear any previous set program. The seep (RSSleep) mode will
//                                                keep Robosapiens memory for up to 2 hours. Please keep this in mind when writing the code.

#define RSLeftSensorPRG           0x93      //L>> (Left sensor program) )                   - Send command to set Robosapien into program mode - Robosapien beeps - you can now program up to six steps
//                                                when 6 steps reached Robosapien will automatically repeat the programmed sequence. If you have less then 6 steps then you need to close
//                                                the program by sending once the RSProgramPlay command.To trigger the sensor: touch a long finger, or a toe/heel sensor on the left side
//                                                Alternative send command RSExecuteLeftSensorPRG. To clear the program and return to the default program send the command RSRightSensorPRG
//                                                followed by the command RSProgramPlay. Turning off the Robosapien will clear any previous set program. The seep (RSSleep) mode will
//                                                keep Robosapiens memory for up to 2 hours. Please keep this in mind when writing the code.


#define RSSonicSensorPRG          0x94      //S>> (Sonic sensor program)                    - Send command to set Robosapien into program mode - Robosapien beeps - you can now program up to six steps
//                                                when 6 steps reached Robosapien will automatically repeat the programmed sequence. If you have less then 6 steps then you need to close
//                                                the program by sending once the RSProgramPlay command. To put robosapien into SONIC RESPONSE mode send command RSListen. The Robosapien
//                                                waits now for a sharp sound or tap on his body and then will run through your programmed routine. To clear the program and return to the default
//                                                program send the command RSSonicSensorPRG followed by the command RSProgramPlay . Turning off the Robosapien will clear any previous set program.
//                                                The seep (RSSleep) mode will keep Robosapiens memory for up to 2 hours. Please keep this in mind when writing the code.

//LED GREEN - Press SELECT once - Combination Moves
#define RSRightTurnStep           0xA0      // right turn step                              - Send command to turn 45 degrees to the right
#define RSRightHandThump          0xA1      // right hand thump                             - Send command to lift right arm up and press downwards
#define RSRightHandThrow          0xA2      // right hand throw                             - Send command to throw object which is in Robosapiens right hand
#define RSSleep                   0xA3      // sleep                                        - Send command to send Robosapiens to sleep. All sensors are inactive. Send RSStop or RSWakeUp to wake him up. After 2 hours of
//                                                uninterrupted sleep the Robosapien will automatically power off.
#define RSRightHandPickUp         0xA4      // right hand pickup                            - Send command to let Robosapien pickup object (bucket) next to his right foot.
#define RSLeanBackward            0xA5      // lean backward                                - Send command to let Robosapien lean backwards and to open his arms
#define RSForwardStep             0xA6      // forward step                                 - Send command to let Robosapien take two steps forward
#define RSBackwardStep            0xA7      // backward step                                - Send command to let Robosapien take two steps backwards
#define RSLeftTurnStep            0xA8      // left turn step                               - Send command to turn 45 degrees to the left
#define RSLeftHandThump           0xA9      // left hand thump                              - Send command to lift left arm up and press downwards
#define RSLeftHandThrow           0xAA      // left hand throw                              - Send command to throw object which is in Robosapiens left hand
#define RSListen                  0xAB      // listen                                       - Send command to set Robosapien into listen mode - Robosapien responds to a sound or tap on his body with a default grunt, or a Sonnic Sensor Program
//                                               sequent as programmed by you.
#define RSLeftHandPickUp          0xAC      // left hand pickup                             - Send command to let Robosapien pickup object (bucket) next to his left foot.
#define RSLeanForward             0xAD      // lean forward                                 - Send command to let Robosapien lean forward and to close his arms
#define RSReset                   0xAE      // reset                                        - Send command to reset Robosapien to his default positions
#define RSExecuteMasterPRG        0xB0      // execute master command program               - Send command to play program routine.
#define RSWakeUp                  0xB1      // wakeup                                       - Send command to wakeup Robosapien. Robosapien goes through his wakeup routine.
#define RSExecuteRightSensorPRG   0xB2      // right sensor program execute                 - Send command to play right sensor routine
#define RSExecuteLeftSensorPRG    0xB3      // left sensor program execute                  - Send command to play left sensor routine
#define RSExecuteSonicPRG         0xB4      // sonic sensor program execute                 - Send command to play left sensor routine

// LED ORANGE Press SELECT twice - Combination Move
#define RSRightHandStrike3        0xC0      // right hand strike 3                          - Send command to perform an outside strike with the right hand
#define RSRightHandSweep          0xC1      // right hand sweep                             - Send command to knock things forward with a sweeping right arm and waist action
#define RSBurp                    0xC2      // burp                                         - Send command to burp ;-)
#define RSRightHandStrike2        0xC3      // right hand strike 2                          - Send command to perform an open right hand strike with a powerful Hoy-hah oOOo
#define RSHigh5                   0xC4      // high 5                                       - Send command to let Robosapien strech up on the right side for a big high 5 and to say Aaay
#define RSRightHandStrike1        0xC5      // right hand strike 1                          - Send command to perform an inside strike with the right hand with a Hi-yah
#define RSBulldozer               0xC6      // bulldozer                                    - Send command to push forward 8 steps
#define RSFart                    0xC7      // oops                                         - Send command to let Robosapien fart ;-)
#define RSLeftHandStrike3         0xC8      // left hand strike 3                           - Send command to perform an outside strike with the left hand
#define RSLeftHandSweep           0xC9      // left hand sweep                              - Send command to knock things forward with a sweeping left arm and waist action
#define RSWhistle                 0xCA      // whistle                                      - Send command to let Robosapien do a wolf whistle ;-) 
#define RSLeftHandStrike2         0xCB      // left hand strike 2                           - Send command to perform an open left hand strike with a powerful Hoy-hah oOOo
#define RSTalkBack                0xCC      // talkback                                     - Send command to let Robosapien Grunt and gestures ;-)
#define RSLeftHandStrike1         0xCD      // left hand strike 1                           - Send command to perform an inside strike with the left hand with a Hi-yah
#define RSRoar                    0xCE      // roar                                         - Send command to let Robosapien lift both arms and roar
#define RSAllDemo                 0xD0      // All Demo                                     - Send command to let Robosapien execute all 3 pre-programmed demos (Demo 1, Demo 2 and Dance)
#define RSPowerOff                0xD1      // Power Off                                    - Send command to power off completely the Robosapien.Drop snow-globe and say "Rosebud" - On/Off Button is required to turn him on again.
#define RSDemo1                   0xD2      // Demo 1                                       - Send command to let Robosapien do Karate chopping
#define RSDemo2                   0xD3      // Demo 2                                       - Send command to show off attitudw 
#define RSDance                   0xD4      // Dance 

 

Friday, October 24, 2014

Lab1 Material : Solderless Breadboards



Using Solderless Breadboards in our Labs is the best approach to provide the maximum flexibility, which allows us to adapt and change the circuits while we are experimenting and thus see if our ideas would work in a real world application.


Solderless Breadboards MB-102 connections by Ralf Fickert


The holes in the numbered columns are connected together on the underside of the board. I marked the row 1 to 5 with orange arrows to show how the holes are connected.  As you can see 5 holes a - e and f - j are connected on each side of the gap. The yellow arrows are showing you how the power rail holes (Blue ‘– ‘ and Red ‘+’) are connected. Therefore when you connect a power supply to a hole of the power rail then the power is available at all connected holes of this power rail. Power rails are located on the top and bottom of the breadboard.

Multiple breadboards can be joined if required to provide more space for experimenting.


We use the Breadboard Model: MB-102 (Ever-muse electronic) within our Labs:  

  • Ideal for high frequency and low noise circuits
  • Interconnect any components with 20-29 AWG (0.3-0.8 mm) wire
  • Special designed spring clip over 5,000 insertion cycles
  • Specifications: 830 points
  • Size: 16.5 x 5.4 x 0.9 cm 
  • Net weight: 77 g

I hope this is useful for you,
Ralf

Tuesday, October 14, 2014

Lab1 Material : Microcontroller ATmega168 Pinout

Microcontroller AVR Pinout for ATmega168 by Ralf Fickert


Here is an extract from the Atmel datasheet for the ATmega  48A/PA/88A/PA/168A/PA/328/P

Please follow this link to access the complete Atmel datasheet document:


VCC
Digital supply voltage.

GND
Ground.

Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit. Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as chip clock source, PB7...6 is used as TOSC2...1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.

Port C (PC5:0)
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The PC5...0 output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running.

PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the clock is not running.

Port D (PD7:0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.

AVCC
AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter.
Note that PC6...4 use digital supply voltage, VCC.

AREF
AREF is the analog reference pin for the A/D Converter.

ADC7:6 (TQFP and QFN/MLF Package Only)
In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.

All the best,
Ralf