To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 18834
18833  |  18835
Subject: 
i2c protocol with the rcx (was Brainstorms)
Newsgroups: 
lugnet.robotics
Date: 
Sat, 31 Aug 2002 15:46:49 GMT
Original-From: 
Ralf Krause <rkra@&AvoidSpam&gmx.de>
Viewed: 
1080 times
  
Hi,

I tested the RCX-to-I2C-board from Elector Electronics. I think it's very
good for educating and experimenting where the user learns very much about
the protocol and function of the i2c bus.

There is a description including PCB and parts list of how to make an RCX to
I2C interface in the Elector Electronics magazine No. 309, APRIL 2002:
http://www.elektor-electronics.co.uk/ln/ln.htm

Article overview:
I2C Interface for Lego RCX 'Brick' (Parts List)
It has, by now, become well known that the Lego RCX-module is eminently
suitable for experimenting with such things as robotics. But once the designs
grow beyond simple experimentation it quickly becomes obvious that the number
of inputs and outputs that this control module provides, are rather
insufficient. That's why Elektor Electronics presents the I2C-interface for
this Lego brick. An entirely new world is opened up: in principle, no fewer
than 128 I2C-devices may be connected to the bus!

Yes, it's right .... you can use the RCX to connect 128 devices.
I tried to program a knight rider with 8 leds. For the needed outputs you
only use one PCF8574P device that has 8 i/o pins and brings enough output
power to drive 8 leds. This fact is great ... a good idea to expand the RCX.

But it's truely not usable for robots!!! The protocol routines are running
very slowly on the RCX .... very too slow for a robot. The protocol is so
slowly that a complete run throw all 8 leds of my knight rider needs about 3
seconds.

If you try to drive a robot with a sensor that returns only two signals per
second then it would not drive very professional. ... yes, you can read 8
touch sensors at the same time but you only get 2 following value in 1
second.

I have not tried to optimize the protocol routines but I think that it's
impossible the control the i2c devices much faster. If you look into the
program you can see the the author simulates the i2c protocol by switching
the rcx sensor input type.

clock line
#define SCL_Lo() SetSensorType(SCL, SENSOR_TYPE_LIGHT)
#define SCL_Hi() SetSensorType(SCL, SENSOR_TYPE_TOUCH)

data line
#define SDA_Lo() SetSensorType(SDA, SENSOR_TYPE_LIGHT)
#define SDA_Hi() SetSensorType(SDA, SENSOR_TYPE_TOUCH)

i2c is a serial data protocol with 8 bit devices.
For sending one data byte you have to send 18 bits ... a start bit and 8
address bits and 8 data bits and at last 1 stop bit. For every bit you have
to set the data line to 0 or 1 and then to change the clock line from lo to
hi and then back from hi to lo. So you have 3 sensor commands for only one
transmitted bit.

Normally the frequency on the clock line is 100 kHz. If you get 2 complete
transmitted data bytes per second with the rcx you will have 36 transmitted
bits (18 for each data byte). If the rcx would get 40 transmitted bits per
second then a normal rcx device is about 2500 times (calculate 100000/40)
faster than the rcx .... a great difference of speed!!

I already wrote that the software is very educational ... you will learn a
lot about the data communication protocol used by i2c devices. But the
simulation of the i2c protocol on the rcx is running very too slow for
robotic control.

The software can be downloaded for free from Elector Electronics magazine
http://www.elektor-electronics.co.uk/dl/dl.htm (use the link to April 2002).
If you get the software written with NQC you can have a look to all the
protocol and the driver functions.

Hope I could help ...
Ralf



--
________________________________________________

Ralf Krause
Bertha-von-Suttner-Gesamtschule
Marie-Schlei-Strasse 6
41542 Dormagen
Germany

http://www.bvsdormgen.de
________________________________________________



Message is in Reply To:
  SV: Brainstorms
 
There is a description including PCB and parts list of how to make an RCX to I2C interface in the Elector Electronics magazine No. 309,APRIL 2002: (URL) overview: I2C Interface for Lego RCX 'Brick' (Parts List) It has, by now, become well known that (...) (22 years ago, 31-Aug-02, to lugnet.robotics)

53 Messages in This Thread:
























Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR