I’d Rather Be Building Robots

July 2, 2009

Release your inner evil scientist

Filed under: Uncategorized — Xander @ 08:49

This could be *you*Are you a budding evil scientist but lack the electronics skills to build your own sharks with laser beams?  Well, you no longer need to outsource your plans for world domination to second rate henchmen.  Now you can learn the skills needed to do this kind of thing yourself. HiTechnic have brought out the Experimenter’s Kit A, which consists of the solderless version of the Protoboard, a solderless breadboard, a whole bunch of electronic components, jumper wires and, of course, a handbook with quite a number of experiments.  Sample programs in NXT-G, LabView, NXC and RobotC (written by yours truly) are available for each experiment.  They’re easy to modify and expand on so the only limit is your imagination.

The experimenter's kit A

The kit allows you learn how to interface your NXT with more than just the pre-made sensors that are available on the market.  It includes push buttons, a temperature sensor, a magnetic sensor (plus magnet) and much more.  You can even build your own ambient cancelling light sensor!  That’ll give you a good idea of how the EOPD sensor works.  The handbook has plenty of drawings, photos and diagram, so you won’t be left in any doubt as to which components to place where.

When you’re done with the experiments in this kit, you’ll be well acquainted with interfacing non-Lego electronics with your brick and programming it to access their data.  How to make your own NXT controlled Death Star will be covered in the second edition of the handbook.

June 30, 2009

HiTechnic Sensor Hack

Filed under: Experiments, Sensors — Xander @ 08:57

Click for bigger version In two previous articles (here and here) I had tried to come up with a way to use IR light to gauge distances.  It wasn’t very successful, but such is the risk of trying something new.  So last night, whilst sitting at my laptop, I wondered if there was a way to emulate a $10 device (a Sharp IR Sensor) with more than $100’s worth of NXT sensors.  It seems there is.  I repurposed a HiTechnic IR Link and IR Seeker (v2) and turned them into a very limited IR distance sensor.

Click for larger version So how does it work? Well, remember I mentioned a few articles back how you could turn an IR Link into a beacon by pulsing it at 1200Hz? Well, instead of using the IR Seeker’s direction register to determine where the beacon is, you could, instead, just query the forward pointing sensor (sensor number 2) for signal strength.  Now if you put the IR Link next to the IR Seeker and point them at an object some of the beacon signal from the IR Link is bound to bounce back and be detected by the IR Seeker.  Using the contraption on the left, I set out to take readings at various distances.  The results surprised me a little.

Click for larger version

The first 3 points I expected to look that way, the surface was simply too close.  However, the linearity of the next couple of points really boggled me.  Did this actually work?  They are most likely highly inaccurate as the values bounced around a fair bit, even though the program was taking 10 readings and averaging them out before displaying them.  So there you go, a highly inaccurate, completely impractical IR distance sensor!  I think the EOPD is probably more suitable for this kind of thing but what would the fun be in that?

You can download the program here: [LINK].  Please note that you will need to use my driver suite, too.  You can pick that up here: [LINK].

June 23, 2009

Subsumption, all the cool kids are doing it

Filed under: Ramblings, Robots, Tutorials — Xander @ 21:05

Taken from http://roachnet.wordpress.com/ “Subsumption?” I hear you say, “What’s that?”  Subsumption is a form of behaviour based robotics where multiple behaviours can control a robot using a hierarchical system.  However, don’t take my word for it!  Check out Thom Roach’s great new blog.  He’s written some really ace articles on the subject without reverting to dry stuffy theory like you see in most research papers.  Using clear text and simple diagrams he shows us how you could make a simple robot that uses subsumption to get around.  Be sure to read them in reverse chronological order!

Released: RobotC Driver Suite RC5

Filed under: RobotC Drivers, Sensors — Xander @ 20:31

Some minor changes in this version and some bug fixes.

Changelog:

HTDIR-test1.c (0.2)

  • Partial rewrite by Dick Swan, waits a little longer for sensor initialisation
  • Nicer intro screen
  • Less screen flickering, only updated if there’s been a change in data.

common.h: (0.3.2)

  • makes use of the new alpha’s built-in clearI2CBus(). It is still defined for the older firmwares

MSLL-driver.h: (0.5)

  • Bug in LLreadSteering() fixed

HTPB-driver.h: (0.7)

  • Fixed a couple of function calls that had not been renamed.

TODO:

  • Add UART (RCX) functionality to HiTechnic IR Link driver.

The drivers’ website is here: [LINK]. The documentation can be found here: [LINK]. You can download the software from the Source Forge page here: [LINK].

June 19, 2009

SHOCKING: IR Seeker V2 exposed!!!

Filed under: Ramblings, Sensors — Xander @ 20:14

NXT IRSeeker V2Ever wondered what an IR Seeker V2 looks like on the inside but didn’t have a spare $50 you could just throw away?  Well wonder no more!  I was given a pre-production IR Seeker by HiTechnic to write a RobotC driver for it.  The lens cap on it wasn’t as clear as the production version so they sent me a replacement lens cap and sensor cover.  That meant I had to do some minor brain surgery on the sensor casing.  Armed with a sharp blade I went to work. 

Click me for a bigger versionAfter removing the white plastic cover, the lens cap came off smoothly after a bit of prodding and poking.  As you can see on the picture to the right, there are 5 IR sensors, each pointing in a different direction.  The rounded lens cover ensures that they can all receive an undistorted IR signal.  You can click on the picture for a bigger version which shows a bit more detail.

Click me for a bigger version I wasn’t satisfied with just slipping the new lens cover on and closing it all up.  No, I wanted to see it all.  Slowly I pulled the small printed circuit board (PCB) out of its cover. I was not disappointed when I turned it over.  The big chip roughly in the middle is the brains of the whole thing.  It’s a very powerful processor that does all the Digital Signal Processing (DSP) of the 5 sensor inputs.  It can detect both DC and modulated IR signals at 600 and 1200Hz.  The small silver rectangle next to the main processor seems to be an oscillator or crystal running at 10MHz.  I have no idea what the smaller IC does. You can click on the picture of the PCB to see a larger version.

So there you have it; the inside scoop.  The guts of the IR Seeker spilled all over your monitor in all of their glory.  Maybe not as shocking as the title led you to believe, but pretty cool none the less.

June 18, 2009

Released: RobotC Driver Suite RC4

Filed under: RobotC Drivers, Sensors — Xander @ 16:11

A new version of the RobotC Driver Suite has been released.  A driver for the Mindsensors LineLeader sensor was added.  The initial driver was written by Thom Roach and modified by me to fit better into the suite’s framework.  Thank you Thom for your work!

Changelog:

  • Many drivers had their API renamed subtly to be more consistent.  Check the individual drivers to see if they were affected.
  • Mindsensors LineLeader driver added (Thom Roach)
  • AT24C512 driver is now generic EEPROM driver
  • common.h now has a clip() function (Thom Roach)

TODO:

  • Add UART (RCX) functionality to HiTechnic IR Link driver.

The drivers’ website is here: [LINK]. The documentation can be found here: [LINK].  You can download the software from the Source Forge page here: [LINK].

June 17, 2009

Mindsensors support forums are live

Filed under: Ramblings — Xander @ 08:47

LineLeader SensorFor all your Mindsensors specific questions and ideas, you can now point your browsers to their own forums here: [LINK].  Right now it’s still a little quiet, but there’s a small but knowledgeable crowd of sensor beta testers and seasoned robotics programmers ready to answer (most of) your questions.

So come over, introduce yourself and ask away.

May 31, 2009

Released: RobotC Driver Suite RC3

Filed under: RobotC Drivers, Sensors — Xander @ 16:28

A new version of the RobotC Driver Suite has been released.  Two new drivers were added and some improvements were made in the I2C bus error handling.

Changelog:
  • NEW: Added driver for AT24C512 EEPROM chip.
  • NEW: Added Light Sensor driver with calibration!  You can use one of the test programs to calibrate for both white and black.  Calibration data is saved to a file which is read when the driver is first used. You can also use the API to write your own calibration program.
  • I2C bus error handling code added to common.h.  When an error occurs, the bus is now flooded with 5 dummy I2C packets.  This usually clears it up.  The original packet is then retransmitted. Note that this is done only once for each packet.
  • HTPB driver has error checking removed, this is now handled by common.h
  • The drivers will generate an error when compiled with a RobotC less than 1.46.
TODO:
  • Add Mindsensors Line Leader driver, waiting for firmware API to stabilise
  • Add UART (RCX) functionality to HiTechnic IR Link driver.

The drivers’ website is here: [LINK]. The documentation can be found here: [LINK].  You can download the software from the Source Forge page here: [LINK].

May 21, 2009

Control the world with the HiTechnic IR Link

Filed under: Sensors, Tutorials — Xander @ 20:53

IRLink Sensor The HiTechnic IR Link is capable of many things including controlling your Power Function devices.  The one thing you couldn’t do was transmit regular data.  That is, until now. 

The IR Link has several transmission modes, 0×02 for example is used for the PF functionality.  There is another mode 0×00, UART-mode, which can be used to transmit 8 bytes at a time at 2400 baud using a 38KHz carrier frequency.  It is also the mode that can be used for communicating with the RCX.

There are two ways you can use the IR Link to transmit your data.  The first method which can be used to send the same 8 bytes over and over again works by preloading the transmit buffer at 0×45 with the 8 bytes you wish to send, followed by the total message length (0×08) and the transmission mode to be used (0×00).  You can then trigger the IR Link to start transmitting by setting register 0×4F to 1 with another I2C message.  Care must be taken not to trigger a retransmission before the previous one is done or you’ll garble the currently transmitting message as it will immediately start transmitting from the first byte again.

If you don’t want to send just 8 bytes over and over again, you can also load up the transmit register at 0×45, followed by the message length (0×08), transmission mode (0×00) and the trigger (0×01). 

Due to the nature of UART-mode, the bytes are transmitted UART-style with odd parity.  That means that when you tell the sensor to transmit 0xAB (b10101011), the following is transmitted via IR:

Start B0 B1 B2 B3 B4 B5 B6 B7 Par Stop
1 0 0 1 0 1 0 1 0 0 0

Each data byte is preceded by a start bit which is always set to 1, then follows bits 0 through 7 of your data (least significant bit first), inverted (0 becomes 1, 1 becomes 0), the odd parity value and then a stop bit which is always 0.  Sounds complicated?  I agree, it took several edits of this blog entry to get this right!

For each bit set to 1, the IR Link’s transmitter goes high for 1/2400th of a second or about 0.42ms, that means that 2 consecutive bits set to 1 will mean an IR burst of a little more than 0.83ms. 

There is a gotcha with the IR Link’s transmission buffer;  its start register is counted backwards from 0×4D. That means that if you have an 8 byte message to send, the first data byte starts at 0×4D-0×08 = 0×45. So if you want to transmit the above sequence, you’ll have setup the IR Link’s buffer such that it looks like this:

Reg 0×45 0×46 0×47 0×48 0×49 0×4A 0×4B 0×4C 0×4D 0×4E 0×4F
Data 0xCC 0×76 0×66 0xFF 0xCC 0×00 0xAB 0xAA 0×08 0×00 0×01

Where:
0×4D is the number of bytes to be transmitted
0×4E is the transmission mode
0X4F is the transmission trigger
You will nee to skip the transmission trigger (0×4F) if all you want to do is preload the transmission buffers. 

Please note that there is no way for the IR Link to know if transmission was successful.  An easy way to check if your IR Link is sending *any* IR signals is to point it at a digital camera and look through the viewfinder.  The IR light should appear as a dot the small screen on the front of the sensor.  Most digital cameras are extremely sensitive to IR light.  This is also a good way to check if your TV remote is still working!

I’ve included two NXC programs, one which transmits the same message over and over again as fast as possible, the other sends a single message every 50ms.

IR Beacon: [LINK] Generates 1200Hz IR signal, can be used with IR Seeker V2
IR Messenger: [LINK]

The functionality to send messages via IR will be included in the next release of the 3rd Party RobotC Driver Suite, so I didn’t include any here.

May 15, 2009

New revamped RobotC Drivers project page

Filed under: Ramblings, RobotC Drivers — Xander @ 12:55

After a couple of hours of fiddling with HTML in Notepad, I’m proud to present the new and improved project page for the 3rd Party RobotC Driver project.  I’ll add more to it as time goes by.  For your tree killing pleasure, I’ve also added a PDF version of the documentation so you can print it out more easily.

You can now also donate to this project by clicking on the link at the bottom of that page.  Proceeds will be used to buy an additional NXT set to help with driver development.

Enjoy!

Next Page »

Blog at WordPress.com.