Converts commands received on the serial interface to i2c commands. The HexTerm program in the vb_HexTerm directory is a simple client for the I2cMaster serial protocol. Default setup is for an ATMega8-16 with an 14.7456MHz crystal, serial port at 8-N-1 115200 baud.

Serial Transmission Protocol

Each message is terminiated with an 0x0a byte, 0x0a is a newline character (‘\n’, decimal 10). The backslash (‘\’) character is used as escape character. Unlike normal c-style escaping the second character needs to be the inverse of the character to be transmitted. So, if 0x0a appears in the message itself it is escaped as: 0x5c 0xf5. Here is 0x5c the backslash character (‘\’, decimal 92) and 0xf5 the bit inverse of 0x0a. The backslash character is escaped as 0x5c 0xa3, a backslash followed by the bit inverse of a backslash.

This protocol was chosen because it can be easily encoded and decoded and it allows for quick resync when a transmission got corrupted. For the sake keeping things simple and for saving processor time no error checking was included.

Serial commands

The following commands can be sent over the serial interface.

s
Perform a i2c bus scan, returns an ‘s’ message for each device found on the i2c bus.

Example: i2c bus scan
Transmit serial data to i2cMaster: 73 0A
73 is ‘s’, instructs i2cMaster do a i2c bus scan.
0A terminates the message.

Received reply from i2cMaster: 73 AC 53 65 72 76 6F 31 36 20 20 32 2E 30 30 33 0A
In ascii: 73=’s’ AC=slave-address “Servo16 1.003″ 0A=end-of-message
In words: at slave address AC is a Servo16 module with version 1.003 connected.

w <SLA> <cmd> [arg1] [arg2] [arg3] [arg4] [arg5] [arg6] [arg7] [arg8]
Write cmd and arguments to slave SLA, the arguments are optional

Example: Set servo 2 to center position
Transmit serial data to i2cMaster: 77 AC 02 80 0A
77 is ‘w’, instructs i2cMaster to write to the i2c bus.
AC is the slave address of the servo module.
02 selects servo 2.
80 sets servo 2 to position 128.
0A terminates the message.

Received reply from i2cMaster: 77 AC 02 80 0A
This is the echo of the command sent.

The actual data send over the i2c bus is “start AC 02 80 stop”.

r <SLA> <cmd> [arg1] [arg2] [arg3] [arg4] [arg5] [arg6] [arg7] [arg8] <ReadLen>
Read <ReadLen> bytes from slave SLA, the arguments are optional
Reply: r <CmdLen> <SLA> <cmd> [arg1] [arg2] .. [arg7] [read1] [read2] .. [read(ReadLen)]
The issued read command is echoed back, with the read bytes appended. CmdLen is the length of the issued read command (not counting <ReadLen>.

Example: Get the servo position of servo 3 and 4
Transmit serial data to i2cMaster: 72 AC 03 02 0A
72 is ‘r’, instructs i2cMaster to read from the i2c bus.
AC is the slave address of the servo module.
03 selects servo 3.
01 read two bytes.
0A terminates the message.

Serial data received from i2cMaster: 72 02 AC 02 40 50 0A
72 is ‘r’
02 number of bytes in the read command.
AC is the slave address of the servo module.
02 the module command sent.
40 first read byte, position of servo 3.
50 second read byte, position of servo 4
0A terminates the answer.
Also servo 3 is at position 40 hex and servo 4 is at 50 hex.

The actual data send over the i2c bus is “start AC 03 repeated-start AD 40 50 stop”.


See modSonar.c source for details.

This website is not associated with iRobot. The information presented here applies to Roomba Red Item #4100, Roomba Item #4105, Roomba Discovery Item #4210, and Roomba Discovery SE Item #4220, it does not apply to the original Roomba series.

iRobot New Roomba Hacking

Introduction

This website is dedicated to reverse engineering the new Roomba by iRobot and is not associated with iRobot. The information presented here applies to Roomba Red Item #4100, Roomba Item #4105, Roomba Discovery Item #4210, and Roomba Discovery SE Item #4220, it does not apply to the original Roomba series.

Other Roomba Hacking Links

Disassembly Instruction Original Roomba
Original Roomba with New Brain
Roomba Red Diagnostic Mode

Microcontroller


Motorola MC9S12DG256C CPV – datasheet (pdf 2.7M)
HC12 16 bit microcontroller, equivalent to MC9S19DP256
112 pin LQFP package, 20x20x1.4mm, 0.65mm pin spacing
Clocked with a 6 MHz Xtal
256K flash ROM
12K RAM
4K EEPROM
2x UART (pin89 RXD0, pin90 TXD0, pin91 RXD1, pin92 TXD1)
2x SPI
8x timer
2x 16 channel 10bit ADC
8x PWM
89x I/O channels
2x CAN 2.0A/B
1x I2C

The Roomba uses a tick timer with 4096 ticks per minute, this corresponds to the 67 times per second that the robot evaluates its state mentioned on the box.

Microcontroller Functional Pinout

Pin	Name	I/O	Cat.	Description
3	PWM1	O	nav	Motor R Control1. H=on
4	PWM0	O	nav	Motor R Control2. H=on
9	IOC0	I	nav	Motor R Encoder
10	IOC1	I	nav	Motor L Encoder
12	IOC3	I	vac	Side Brush Overcurrent = H
15	IOC4	I	nav	Motor R Overcurrent Sensor. H=overcurrent
16	IOC5	I	nav	Motor L Overcurrent Sensor. H=overcurrent
17	IOC6	I	vac	Main Brush Overcurrent = H
23	PB0	I	vac	Side Brush Motor Control. H=on
25	PB1	I	vac	Vac Motor Control. H=on
26	PB2	I	vac	Main Brush Motor Control. H=on
27	PB3	I	pow	Aux Power Control. H=on
28	PB4	O???	pow	??? Charger Enable
29	PB5	O	pow	Charger Control. H=enable charging
30	PB6	O	nav	Floor and Side Sensors Control. H=on
32	KWH7	I	ui	Input Pin on Serial Connector
33	KWH6	I	nav	Wheel-Up Switches. H=ok
34	KWH5	I	ui	Spot Button. L=pressed
35	KWH4	I	ui	Unconnected Button. L=pressed
49	KWH3	I	ui	Clean Button. L=pressed
50	KWH2	I	pow	Any Charger Connected (AC or Floor). H=yes
51	KWH1	I	ui	IR-Receiver
52	KWH0	I	ui	Power Button. L=pressed
57	PA0	I	vac	Dust Sensor1
58	PA1	I	vac	Dust Sensor2
59	PA2	I	nav	Bump Sensor L
60	PA3	I	nav	Bump Sensor R
62	PA5	I	pow	AC Charger Connected. H=yes
63	PA6	O	sys	Reset Watchdog Timer (1.6 sec timeout)
64	PA7	O	pow	??? Charger Safety Board. H=charger ok
67	AN00	I	pow	Bat Voltage. V(mV) = ADC * 28.1
68	AN08	I	vac	Vac Motor Current. I(mA) = ADC * 5
69	AN01	I	pow	Bat Temperature. T(degC) = 25 + (512 - ADC) / 9
70	AN09	O	pow	??? Bat Temperature Sense Enable. H=Enable
71	AN02	I	pow	Bat Current. I(mA) = (ADC - 512) * 6.523. Positive = charging, negative=discharging
73	AN03	I	nav	Floor Sensor L Back
75	AN04	I	nav	Floor Sensor L Front 
77	AN05	I	nav	Floor Sensor R Back 
79	AN06	I	nav	Floor Sensor R Front 
81	AN07	I	nav	Side Wall Sensor
87	PM7	O	ui	Power Led Green. H=on
88	PM6	O	ui	Power Led Red. H=on
91	RXD1	I	ui	Serial Port
92	TXD1	O	ui	Serial Port
100	PM5	O	ui	Status Led Green. H=on
101	PM4	O	ui	Status Led Red. H=on
102	PM3	O	ui	Dust-Detect Led Blue. H=on
103	PM2	O	ui	Spot Led Green. H=on
104	PM1	O	ui	Unconnected Led. H=on
105	PM0	O	ui	Clean Led Green. H=on
111	PWM5	O	nav	Motor L Control1. H=on
112	PWM4	O	nav	Motor L Control2. H=on

PCB Frontside


(click to enlarge)

Connectors Top Left to Right

J1 purple/purple – speaker, gray/white – left motor down switch
J3 – main brush motor
J4 – left motor and encoder (32 pins per revolution)
J9 – dirt sensors
J10 – to top panel, right side IR wall sensor
J16 – right motor and encoder
J17 black/red – vacuum motor in dust container
J18 black/green – side brush motor
J19 black/yellow – right motor down switch
J15 black/red – battery charger connector

Connector Bottom

J11 7 pin serial port connector 57600 baud 8-N-1

PCB Backside


(click to enlarge)

Connectors Left Top

J7 red/white/black – battery
J25 – bottom battery recharge pads
J2 – stairs sensors

Connectors Left Bottom

J22 green/green = front wheel down switch, purple/purple – front wheel down sensor
J8 – front bumper board

Connector Right Top

J24 – stair sensors

Connector Right Bottom

J23 red/blue/black – front bumper board, IR receiver: red – vcc, blue – IR signal, black – grd

Hidden under plastic cover above the charger plug is a serial port connector. iRobot does not provide support for the serial port, the following quote is from the FAQ section on the iRobot.com website:

Does iRobot provide any codes or specifications for the port?
No, iRobot does not provide this information.
Attempting to alter Roomba’s programming voids the warranty.

Serial Port Specification

The serial port runs at 57600 baud 8N1 with 5 Volt levels. To connect the Roomba port to a PC you have to use a level converter, to convert the 0 and 5 Volt levels of the Roomba port to the approximate -10 and 10 volt levels of the PC port. For level converters see: Simple RS232C Level Converter using Transistors or MAX232 ic.

Serial Connector Pinout

   ___
  |6 7|
 /4   5\
 \1 2 3/
  -- --  


pin1 black – microcontroller pin32 (PH7) via 1K resistor R236, internally pulled up to +5V
pin2 brown – GRD
pin3 red – GRD
pin4 orange – microcontroller pin91 (RXD1) via 1K resistor R239
pin5 yellow – microcontroller pin92 (TXD1) via 1K resistor R238 and 100ohm resistor R243
pin6 blue – battery (+15.6volt)
pin7 white – battery (+15.6volt)

Results

Power Connect

Inserting battery pack displays: ( [^C] is control-C character hex 03 )

bl-start[^C]2004-05-26-1037-L   [^C]Roomba by iRobot!
MC9S12DP256
2004-07-30-1026-L
battery-current-quiescent-raw 525  battery-current-zero 511
 
2004-07-30-1026-L
 
processor-sleep

Hex dump of reply:

0000:62 6C 2D 73 74 61 72 74 bl-start
0008:03 32 30 30 34 2D 30 35  2004-05
0010:2D 32 36 2D 31 30 33 37 -26-1037
0018:2D 4C 20 20 20 03 52 6F -L    Ro
0020:6F 6D 62 61 20 62 79 20 omba by 
0028:69 52 6F 62 6F 74 21 0D iRobot! 
0030:0A 4D 43 39 53 31 32 44  MC9S12D
0038:50 32 35 36 0D 0A 32 30 P256  20
0040:30 34 2D 30 37 2D 33 30 04-07-30
0048:2D 31 30 32 36 2D 4C 20 -1026-L 
0050:20 20 0D 0A 62 61 74 74     batt
0058:65 72 79 2D 63 75 72 72 ery-curr
0060:65 6E 74 2D 71 75 69 65 ent-quie
0068:73 63 65 6E 74 2D 72 61 scent-ra
0070:77 20 35 32 35 20 20 62 w 525  b
0078:61 74 74 65 72 79 2D 63 attery-c
0080:75 72 72 65 6E 74 2D 7A urrent-z
0088:65 72 6F 20 35 31 31 0D ero 511 
0090:0A 0D 0A 32 30 30 34 2D    2004-
0098:30 37 2D 33 30 2D 31 30 07-30-10
00A0:32 36 2D 4C 20 20 20 0D 26-L    
00A8:0A 0D 0A 70 72 6F 63 65    proce
00B0:73 73 6F 72 2D 73 6C 65 ssor-sle
00B8:65 70 0D 0A             ep 

Power On

Switching power on (turning on green battery led) displays:

key-wakeup
slept for 764 minutes 1091 ticks
 
2004-07-30-1026-L
battery-current-quiescent-raw 525  battery-current-zero 511

Power Off

Switching power off (turning off green battery led) displays:

processor-sleep

Button Press

Pressing a button on top of the Roomba while power is off displays: (nothing is displayed if power is on)

key-wakeup
slept for 765 minutes 3995 ticks
 
2004-07-30-1026-L
 
processor-sleep

Serial Port Pin Input

Grounding pin1 while power is off displays:

key-wakeup
slept for 763 minutes 1841 ticks
 
2004-07-30-1026-L
device-detect
2004-07-30-1026-L
 
processor-sleep

Grounding pin1 while power is on displays:

device-detect
2004-07-30-1026-L

Reset via Serial Port

While on, sending control-G resets the roomba as if the battery pack was just inserted:

bl-start[^C]2004-05-26-1037-L   [^C]Roomba by iRobot!
MC9S12DP256
2004-07-30-1026-L
battery-current-quiescent-raw 525  battery-current-zero 511
 
2004-07-30-1026-L
 
processor-sleep

Charging the Battery

While the battery is being charged the serial port reports every second the charge time, battery voltage, current and temperature. Below is the part of the serial output where the charger is shut off because of reaching the battery temperature limit.

bat:   min 240  sec 57  mV 16921  mA 572  deg-C 60  
bat:   min 240  sec 58  mV 16921  mA 579  deg-C 60  
bat:   min 240  sec 59  mV 16921  mA 572  deg-C 60  
charging-done: temperature max allowed @ minutes 241
do-charging-wait-for-trickle @ minutes 241
bat:   min 241  sec 0  mV 16866  mA 26  deg-C 60  
bat:   min 241  sec 1  mV 16810  mA -27  deg-C 60  
bat:   min 241  sec 2  mV 16782  mA -27  deg-C 60  

Factory Self Test

Hold down Spot and Clean, then press Power briefly and the LED lights will begin to flash. You can now cycle between the diagnostic modes by using Clean to advance in the sequence, and Spot to return to the diagnostic mode before. For more details see: Roomba Red Diagnostic Mode. Below is the output on the serial port during self test/diagnostics:

factory-test 0  leds
wait: false
 
 
factory-test 1  bumpers
(bump-left?) PASS
(bump-right?) PASS
 
 
factory-test 2  cliffs-side
wiff: cliff-left on 3627  off 3640  signal 13  on? 0
wiff: cliff-front-left on 3628  off 3633  signal 5  on? 1
wiff: cliff-front-right on 3644  off 3644  signal 0  on? 1
wiff: cliff-right on 3644  off 3644  signal 0  on? 1
wiff: wall on 3652  off 3652  signal 0  on? 0
(cliff-left?) PASS
(cliff-right?) FAIL
 
 
factory-test 3  cliffs-front
(cliff-front-left?) FAIL
 
 
factory-test 4  wheel-drop-and-wall
(wheel-drop?) FAIL
 
 
factory-test 5  rcon-receiver
(rcon?)
 
factory-test 6  battery-sensors
(battery-voltage-ok?) PASS
(battery-temperature-ok?) PASS
(baseline-current-ok?) mA -92  min -202  max -14  mV 16309  degrees-C 58 PASS
 
 
factory-test 7  left-wheel
not left-wheel-stall PASS
(baseline-current-ok?) mA -92  min -202  max -14  mV 16309  degrees-C 58 PASS
(drive-speed-ok? left forward) PASS
(drive-speed-ok? right stopped) PASS
(left-drive-current-ok?) mA -183  min -326  max -118  mV 16253  degrees-C 58 PASS
not left-wheel-stall PASS
wait: left-wheel-stall
 
 
factory-test 8  right-wheel
not right-wheel-stall PASS
(baseline-current-ok?) mA -92  min -202  max -14  mV 16281  degrees-C 58 PASS
(drive-speed-ok? left stopped) PASS
(drive-speed-ok? right forward) PASS
(right-drive-current-ok?) mA -183  min -326  max -118  mV 16226  degrees-C 58 PASS
not right-wheel-stall PASS
wait: right-wheel-stall
 
 
factory-test 9  wheel-encoders
(drive-speed-ok? left stopped) PASS
(drive-speed-ok? right stopped) PASS
(drive-speed-ok? left reverse) PASS
(drive-speed-ok? right reverse) PASS
 
 
factory-test 10  stasis
wait: (not (stasis?))
 
 
factory-test 11  main-brush
not brush-motor-stall PASS
(baseline-current-ok?) mA -92  min -202  max -14  mV 16281  degrees-C 58 PASS
(brush-current-ok?) mA -287  min -599  max -241  mV 16226  degrees-C 58 PASS
not brush-motor-stall PASS
wait: brush-motor-stall
 
 
factory-test 12  debris
(debris-left?)
 
factory-test 13  vacuum
not vacuum-motor-stall PASS
(baseline-current-ok?) mA -92  min -202  max -14  mV 16281  degrees-C 58 PASS
not vacuum-motor-stall PASS
(vacuum-current-ok?) mA -7  min -352  max -176  mV 16281  degrees-C 58 FAIL
 
 
factory-test 14  side-brush
not side-brush-motor-stall PASS
(baseline-current-ok?) mA -92  min -202  max -14  mV 16281  degrees-C 57 PASS
not side-brush-motor-stall PASS
(side-brush-current-ok?) mA -7  min -248  max -53  mV 16281  degrees-C 57 FAIL
 
 
factory-test 15  int-charger-prep
not (int-charger-available?) PASS
wait: (int-charger-available?)
 
 
factory-test 16  int-charger-on
wait: (int-charger-available?)
 
 
factory-test 17  int-charger-trickle
wait: (int-charger-available?)
 
 
factory-test 18  ext-charger-prep
not (ext-charger-available?) PASS
wait: (ext-charger-available?)
 
 
factory-test 19  ext-charger-on
wait: (ext-charger-available?)
 
 
factory-test 20  ext-charger-trickle
wait: (ext-charger-available?)
 
 
factory-test 21  bootloader
(bootloader-ok?) PASS
 
 
factory-test 22  complete
 
 
 
SUMMARY: START
SUMMARY: DATE-TAG 2004-07-30-1026-L   
SUMMARY: (baseline-current-ok?) PASS   mA -92  min -202  max -14  mV 16281  degrees-C 57
SUMMARY: (left-drive-current-ok?) PASS   mA -183  min -326  max -118  mV 16253  degrees-C 58
SUMMARY: (left-drive-stall-current-ok?) untested   
SUMMARY: (right-drive-current-ok?) PASS   mA -183  min -326  max -118  mV 16226  degrees-C 58
SUMMARY: (right-drive-stall-current-ok?) untested   
SUMMARY: (brush-current-ok?) PASS   mA -287  min -599  max -241  mV 16226  degrees-C 58
SUMMARY: (brush-stall-current-ok?) untested   
SUMMARY: (side-brush-current-ok?) FAIL   mA -7  min -248  max -53  mV 16281  degrees-C 57
SUMMARY: (side-brush-stall-current-ok?) untested   
SUMMARY: (vacuum-current-ok?) FAIL   mA -7  min -352  max -176  mV 16281  degrees-C 58
SUMMARY: (vacuum-stall-current-ok?) untested   
SUMMARY: (int-charging-current-ok?) untested   
SUMMARY: (int-charging-trickle-current-ok?) untested   
SUMMARY: (ext-charging-current-ok?) untested   
SUMMARY: (ext-charging-trickle-current-ok?) untested   
SUMMARY: (bump-left?) PASS   
SUMMARY: (bump-right?) PASS   
SUMMARY: (cliff-left?) PASS   
SUMMARY: (cliff-right?) FAIL   
SUMMARY: (cliff-front-left?) FAIL   
SUMMARY: (cliff-front-right?) untested   
SUMMARY: (wheel-drop?) FAIL   
SUMMARY: (wall?) untested   
SUMMARY: (rcon?) FAIL   
SUMMARY: (any-remote-opcode?) untested   
SUMMARY: (battery-voltage-ok?) PASS   
SUMMARY: (battery-temperature-ok?) PASS   
SUMMARY: left-wheel-stall PASS   
SUMMARY: (drive-speed-ok? left forward) PASS   
SUMMARY: (drive-speed-ok? right stopped) PASS   
SUMMARY: right-wheel-stall PASS   
SUMMARY: (drive-speed-ok? right forward) PASS   
SUMMARY: (drive-speed-ok? left stopped) PASS   
SUMMARY: (drive-speed-ok? left reverse) PASS   
SUMMARY: (drive-speed-ok? right reverse) PASS   
SUMMARY: (stasis?) untested   
SUMMARY: brush-motor-stall PASS   
SUMMARY: (debris-left?) FAIL   
SUMMARY: (debris-right?) untested   
SUMMARY: vacuum-motor-stall PASS   
SUMMARY: side-brush-motor-stall PASS   
SUMMARY: (int-charger-available?) PASS   
SUMMARY: (ext-charger-available?) PASS   
SUMMARY: (bootloader-ok?) PASS   
SUMMARY: END

Klassische Auto-Race Spiel auf einem Deskjet 520.

AVI video (1.5MB) von einen Race.

Klick auf ein Bild um das 4-Megapixel Orginalbild anzuzeigen (1.5MB)


Das Parkur-Papier (in diese Fall zwei A4 lang) wird geladen durch die Joystick nach vorne zu drucken.


Wenn der Parkur geladen ist zeigt das LCD “Positionieren”, jetzt kann der Deskjet-Pilot sein Bolide im Position bringen mit Joystick links/rechts. Der Race startet sobald der Joystick nach forne bewegt wird. Solange das Auto auf dem Parkur ist sind hohe Geschwindigkeiten moechlich. Sobald jedoch das Auto von Parkur abkommt, verringert sich die Hoechstgeschwindigkeit. Ziel ist jetzt den Parkur so schnell wie moeglich zu absolvieren.
Es gibt auch ein AVI video (1.5MB) von einen Race.


Beim erreichen des Ziels schaltet der Deskjet ab, und…


Die Rennzeit wird im Display angezeigt.

Bauanleitung


Oeffne ein Deskjet der 500er Reihe (hier 520).


Auf dem Haupplatine wirden folgende Leiterbanen abgetrennt und umgeleitet zum Microkontroller auf dem Breadboard:
- links-oben: Ground Leitung und +5Volt Leitung.
- links-mitte: 4x Stepper Motor Controller Leitungen
- links-unter: 2x Druckkopf Positions Encoder, und 1x “Papier-Aus” Sensor.
- rechts-oben: 3x Druckkopf DC Motor Controller Leitungen.


Der Papierfeederteil wird wieder installiert, wobei es wichtig ist das Druckkopfkabel (weisse Flachkabel unter-mitte) wieder anzuschliesen fuer die Druckkopf Position und “Papier-Aus” Sensoren. Auch werden zwei Holzkloeze installiert die die Bewegungsfreiheit des Druckkopfes auf die Papierbreite beschraenken.



Aus einem Phototransistor und Infrarot LED wird der (licht-dunkel) Parkursensor gebaut. Ein kleines Stueck Plexiglass haelt den Sensor auf ein4er fixen Hoehe ueber dem Papier, so kann der Sensor Ausgangswert kalibriert werden.


Im oberen Gehaeuse-Teil sind die Anschluesse fuer dem Reset-Knopf und Power-On LED.


Die Druckkopfabdeckung vor dem Ausschnitt.


Der fertige Deskjet Racer!

Software

Das austausch Gehirn des Deskjets ist ein ATMega8 Microkontroller (Einzelhandelspreis Euro 3.50). Mit einem, im gcc programmiertem, Programm ist es moeglich Paperfeed Stepper motor und Druckerkopf DC Motor mit variabeler Geschwindigkeit zu steuern. Im Hauptloop des Programms wird die X und Y Position des Joysticks und der Photosensorwert ausgewertet und demensprechend wird die Geschwindigkeit der Motoren angepasst.

Microkontrollers Pin Benutzung:

Pin:Pinname Funktion
 1:RESET programmmer
 2:RXD   serial port
 3:TXD   serial port
 4:INT0  x position phase0
 5:INT1  paperout
 6:PD4   stepper phase0
 7:VCC   VCC
 8:GRD   GRD
 9:PB6   dc motor1
10:PB7   dc motor2
11:PD5   stepper phase1
12:PD6   stepper phase2
13:PD7   stepper phase3
14:PB0   x position phase1
 
15:OC1A  dc motor enable
16:PB2   lcd D4
17:PB3   lcd D5 / MOSI  programmer
18:PB4   lcd D6 / MISO  programmer
19:PB5   lcd D7 / SCK   programmer
20:AVCC  N/C
21:AREF  VCC
22:GRD   GRD
23:ADC0  joystick x
24:ADC1  joystick y
25:ADC2  light sensor
26:
27:PC4   lcd E
28:PC5   lcd RS

Microkontroller Resources:
- Interer Kalibrierte RC-Oscillator auf 8MHz.
- Drei ADC Kanaele: zwei fuer die Joystick-Position und eine fuer den Photosensor (schwarz-weiss).
- 8-Bit Timer2 wird benutzt zum Geschwindigkeit-Kontrolle des Paperfeed Stepper-Motor.
- 8-Bit Timer0 wird benutzt als Zeitbasis mit 4kHs Resolution.
- Interrupt0 wird benutzt zum Auswerten des Druckerkopfes Positions Enkoder.

Play poker over TCP internet connection

Download: PokerClient and PokerServer | VB6 Source Code

Description

For a quick demo on a single computer: run the test.bat file. This will
open the poker server and two clients. The clients will automatically
connect to the PokerServer running on the computer, login, and start a
game. Click on the cards to change them, then press the Done button.
Now place your bets.

To run over a network (or internet), run the PokerServer program on a
computer and make sure the filewall is configured to accept incoming
connection to port 9596.

On a different computer run PokerClient and enter the IP address (or
hostname) of the PokerServer computer when prompted. Select “New Game”
from the Game menu.

Run the PokerClient on up to 5 additional computers and select “Join
Game” from the menu and select game number 1.

Have Fun!

Screenshots



Poker Client Player 1


Poker Client Player 2, with Client-Server communication visible


Poker Server

TODO

  • Persistant useraccounts
  • Better “Join Game” dialog, showing available games
  • Better handling of lost connections / reconnects.

    License

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place – Suite 330, Boston, MA 02111-1307, USA.

  • OBD is a diagnostic interface a found on many build in 1996 or later. A description of the OBD protocol can be found below.

    RS-232 Serial Cable

    The interface depicted below can be used build a serial cable to connect the serial port of the computer to the 16-pin OBD-II connecter found in many cars build in 1996 or later. This interface only supports the ISO 9141-2 / ISO 14230-2 K-line tranfer mode. If in your ODB connecter pin 7 (K-Line) is present and pin 15 (L-Line) is missing then this interface will most likely work for your vehicle.
    The interface has been tested to work with GPL Linux scantool program freediag. A pre-compiled version can be downloaded here.

    OBD-II 16 Pin Connector
    Alternative ISO interface design: Opto-Coupler Schematic PDF | Jeff Noxon Website

    OBD-Microcontroller Interface

    This interface can be used to connect a microcontroller (AVR ATMega8 for example) to the OBD connecter in your car.

    OBD-II ISO 14230-2 Protocol Specification

    This document describes the OBD-II ISO 14230-2 serial interface protocol. It has been compiled from various public internet sources. I have been successful building an ODB interface with this information, but no guarantee can be given that this information is correct. Use at your own risk.

    Timing

    (in ms) 0-20 Inter byte timing in ECU response 25-50 Time between end of tester request and start of ECU response or between ECU responses 25-5000 Extended mode for "rspPending" 55-5000 Time between end of ECU response and start of new tester request, or time between end of tester request and start of new request if ECU doesn't respond */ 5-20 Inter byte time in tester request

    Initialization

    Fastinit: _________ _____ ____ ____ \_____/ \/\/\/\/ \/\/\/\/ 300ms 25ms 25ms packet response 1) Wait for 300ms with K line high. 2) Pull K line low for 25 +/- 1 ms 3) Let K line rise high and wait 25ms 4) init serial connection to 10400 baud, 8N1, 1=0Volt 0=12Volt, least significant bit first 5) send package c1 33 f1 81 66 33=dest, f1=our tester id, 81=start comms 6) wait for response 83 f1 01 c1 e9 8f ae 01=physical address, c1=response ok (7f=fail), e9=kb1, 8f=kb2 Slowinit: _________ S ___ 2 3 ___ 6 7 ___ ____ ____ \_/0 1\___/4 5\___/P \/\/\/\/ \/\/\/\/ 300ms 200 400 400 400 400 250 packet response 1) Wait for 300ms with K line high. 2) send a byte 33 hex at 5 baud. 200ms per bit startbit: 200ms low databit0,1: 400ms high databit2,3: 400ms low databit4,5: 400ms high databit6,7: 400ms low stopbit+pause: 250ms high 4) init serial connection to 10400 baud, 8N1, 1=0Volt 0=12Volt, least significant bit first 5) send package c1 33 f1 81 66 33=dest, f1=our tester id, 81=start comms 6) wait for response 83 f1 01 c1 e9 8f ae 01=physical address, c1=response ok (7f=fail), e9=kb1, 8f=kb2

    Packets

    Send command packet: header: [c0+cmdlen] [destination=33] [source=f1] data: [cmd0] [cmd1] ... [cmd(cmdlen-1)] checksum: [sum(header)+sum(data)] cmd0 = service ID cmd1 = PID Received response packet on success: header: [80+datalen] [destination=f1] [source=01] data: [40+cmd0] [cmd1] ... [cmd(cmdlen-1)] [result0] [result1] ... [result(datalen-cmdlen-1)] checksum: [sum(header)+sum(data)] Received response packet on failure: header: [80+datalen] [destination=f1] [source=01] data: [errorcode=7f] [cmd0] [Response Failure Code, see below] checksum: [sum(header)+sum(data)] Multibyte data is sent high byte first.

    Tester Commands

    request and response packet diagram format: cmd0 cmd1 ... -> result0 result1 ... comment Note: only the data of the request and only the result of the response are show. yy 00 -> xx xx xx xx bitmask of capabilities for mode yy, bit7 represents pid 1, bit6 pid 2, etc, if data4:bit0 is set then pid 20 contains capabilities for pid 21-40 00-0F: SAE J1979 Diagnostic Test Modes 01 00 -> xx xx xx xx capabilites 01 01 -> [b7: MIL light, b0-6: dtc count] [b4-7: readiness] [b5: o2monitoring] [b0-7: readiness] 01 03 -> xx xx Fuel System Status bitmap b0:Open, b1:Closed, b2:Open-Driving, b3:Open-Fault, b4:Closed-Fault 01 04 -> xx Calculated Load Value % x*100.0/255 01 05 -> xx Engine Coolant Temperature C x-40 01 06 -> xx Short term fuel trim Bank 1 % x*(100.0/128)-100 01 07 -> xx Long term fuel trim Bank 1 % x*(100.0/128)-100 01 08 -> Short term fuel trim Bank 2 % x*(100.0/128)-100 01 09 -> Long term fuel trim Bank 2 % x*(100.0/128)-100 01 0a -> Fuel Pressure kPaG x*3 01 0b -> xx Intake Manifold Pressure kPaA x 01 0c -> xx xx Engine RPM RPM x*0.25 01 0d -> xx Vehicle Speed km/h x 01 0e -> xx Ignition timing advance Cyl #1 deg X*0.5-64 01 0f -> xx Intake Air Temperature C X-40 01 10 -> xx xx Air Flow Rate gm/s X*0.01 01 11 -> xx Absolute Throttle Position % X*(100.0/255) 01 12 -> xx Commanded secondary air status 01 13 -> xx Oxygen sensor locations bitmap b0=sensor1, b1=sensor2, ..., b7=sensor8 01 14 -> xx yy Bank 1 Sensor 1 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 15 -> xx yy Bank 1 Sensor 2 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 16 -> Bank 1 Sensor 3 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 17 -> Bank 1 Sensor 4 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 18 -> Bank 2 Sensor 1 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 19 -> Bank 2 Sensor 2 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 1a -> Bank 2 Sensor 3 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 1b -> Bank 2 Sensor 4 Voltage/Trim V, % x*0.005, if y!=ff then y*(100.0/128)-100) 01 1c -> xx Auxiliary Input Status bitmap b0:PTO Active 01 20 -> xx xx xx xx capabilities 01 21 -> xx xx 02 00 00 -> xx xx xx xx capabilites SMART: 2 3 4 5 6 7 b c d 02 02 00 -> [dtc1h] [dtc1l] DTC that caused freezeframe 03 -> [dtc1h] [dtc1l] 00 00 00 00 05 00 00 -> xx xx xx xx capabilites 06 00 -> xx xx xx xx capabilites 06 yy -> [max=01,min=81] [valH] [valL] [limitH] [limitL] example 01 00 23 01 2c is value 23 (=35 dec) with limit maximum 12c (=300 dec) 06 01 -> xx xx xx xx xx ncms 06 02 -> xx xx xx xx xx ncms 06 09 -> 01 xx xx xx xx -> 81 xx xx xx xx ncms 07 -> 00 00 00 00 00 00 cms 08 00 00 00 00 00 00 -> xx xx xx xx capabilites SMART: none 09 00 -> 01 30 00 00 00 capabilites 5 bytes??? 10 Start Diagnostic Session 11 ECU Reset 12 Read Freeze Frame Data 13 Read Diagnostic Trouble Codes 14 Clear Diagnostic Information 17 Read Status Of Diagnostic Trouble Codes 18 Read Diagnostic Trouble Codes By Status 1A Read Ecu Id 20 Stop Diagnostic Session 21 Read Data By Local Id 22 Read Data By Common Id 23 Read Memory By Address 25 Stop Repeated Data Transmission 26 Set Data Rates 27 Security Access 2C Dynamically Define Local Id 2E Write Data By Common Id 2F Input Output Control By Common Id 30 Input Output Control By Local Id 31 Start Routine By Local ID 32 Stop Routine By Local ID 33 Request Routine Results By Local Id 34 Request Download 35 Request Upload 36 Transfer data 37 Request transfer exit 38 Start Routine By Address 39 Stop Routine By Address 3A Request Routine Results By Address 3B Write Data By Local Id 3D Write Memory By Address 3E Tester Present 81 -> xx xx Start Communication 82 Stop Communication 83 Access Timing Parameters 85 Start Programming Mode

    Response Failure Codes

    10 General Reject 11 Service Not Supported 12 Sub Function Not Supported - Invalid Format 21 Busy - repeat Request 22 Conditions Not Correct Or Request Sequence Error 23 Routine Not Complete Or Service In Progress 31 Request Out Of Range 33 Security Access Denied - security Access Requested 35 Invalid Key 36 Exceed Number Of Attempts 37 Required Time Delay Not Expired 40 Download Not Accepted 41 Improper Download Type 42 Can Not Download To Specified Address 43 Can Not Download Number Of Bytes Requested 50 Upload Not Accepted 51 Improper Upload Type 52 Can Not Upload From Specified Address 53 Can Not Upload Number Of Bytes Requested 71 Transfer Suspended 72 Transfer Aborted 74 Illegal Address In Block Transfer 75 Illegal Byte Count In Block Transfer 76 Illegal Block Trasnfer Type 77 Block Transfer Data Checksum Error 78 Request Correcty Rcvd - Rsp Pending 79 Incorrect Byte Count During Block Transfer 80 Service Not Supported In Active Diagnostic Mode C1 Start Comms +ve response C2 Stop Comms +ve response C3 Access Timing Params +ve response 81-8F Reserved 90-F9 Vehicle manufacturer specific FA-FE System supplier specific FF Reserved by document

    Sample scan obtained of a SMART FOR TWO car

    --wakeup 81 -> e9 8f --get capabilities 01 00 -> b2 3f f8 11 capabilities service 1: 1 3 4 5 6 7 b v d e f 10 11 12 13 14 15 1c 20 01 20 -> 80 00 00 00 capabilities service 1: 21 02 00 00 -> 7e 38 00 00 capabilities service 2: 2 3 4 5 6 7 b c d 05 00 00 -> 7f 05 11 capabilities service 5: none 06 00 -> ff c0 80 00 capabilities service 6: 1 2 3 4 5 6 7 8 9 a 11 08 00 00 00 00 00 00 -> 7f 08 11 capabilities service 8: none 09 00 -> 01 30 00 00 00 ???? expected 4 byte response... --get status 01 01 -> 01 07 69 00 MIL light off, 1 dtc, ready, no 02monotoring --get dtc's 03 -> 07 02 00 00 00 00 dtc P0702 --scan sensors 01 03 01 04 01 05 -> 3a engine coolant temp = 18C (3a=58 dec - 40 dec) 01 06 01 07 01 0b 01 0c 01 0d 01 0e 01 0f 01 10 01 11 01 12 01 13 -> 03 2 sensors 01 14 01 15 01 1c 01 20 -> 80 00 00 00 (always same: capabilities 21-40) 01 21 -> 00 37

    With this software you can simulate in 3D a mobile robot in a maze. Included are the maze layout and robot used in the c’t robot contest. Also included is a full installer/uninstaller.

    Download Robot Simulator (400kb)
    To install, run the downloaded file. To unistall, select uninstall from the Start menu.

    Screenshots



    Robot Simulator Uses’ Manual

    Manual updated to build 011023:003

    Robot Simulator Program Keys

    GENERAL

    ESC: Quit
    F12: Toggle full screen/window
    R: Reload scene configuration

    OBJECT MANIPULATION
    1-9,0: Select object, object 1 is the robot.
    Left/right arrow: Turn object left/right
    Up/down arrow: Move object forward/backward

    CAMERA CONTROL

    F1-F6: Select camera (keep pressed until view changes). Cameras can at a fixed position or can be mounted on a object.
    A/D: Turn camera left/right.
    W/S: Move camera forward/backward.
    Page up/down: Move camera up/down.
    Home/End: Turn camera up/down.

    Scene Configuration

    The scene configuration is stored in the text file config.txt in the working directory. The following commands can be used in the configuration file. A command is aways on a separate line and starts with the command name, followed by the command arguments. Units are in meters. Blank lines are ignored. Any characters appearing after the hash (#) character are considered comments.

    Configuration Commands

    Camera camno posx posy posz rotz lookup objno Define a camera at position and rotation. If objno>0 then the camera is bound the object with that objno. Last camera defined is the active camera upon startup.
    ObjectStart objectno Start an object definiton block. Last object defined is the active object upon startup.
    Position posx posy posz Set object positon
    Orientation rotx roty rotz Set object orientation
    Collision limit Turn on collision detection for this object. Limit is the radius within no other object can approach this object.
    PushMatrix Push current transformation matrix on stack
    Translate x y z Translate position
    Rotate deg axisx axisy axisz Rotate along axis
    Color r g b alpha Set color
    DrawBox sizex sizey sizez Draw box at current position
    DrawDisk radius thickness no_segments Draw a disk around the z-axis
    DrawBase width lenght height thickness Draw base plane in coloridx 0, with walls around it.
    DrawWall x1 y1 x2 y2 height thickness Draw a wall.
    PopMatrix Pop transformation matrix from stack
    ObjectEnd End object definiton

    Collision Detection

    The program uses 3D collision detection between objects and walls. Objects are represented for collision detection purposes by a sphere centered at objects Position, with radius set with the Collision command. Collision betweens between objects will move the object collided into in the same amount as the moving object.

    © 2018 Tech Toy Hacks Suffusion theme by Sayontan Sinha