Wednesday, May 14, 2008

Fun With the Super Cricket

Learned a lot of stuff today testing components of the Super Cricket:
  • The difference between the photocell sensor and the infrared sensor is the former detects levels of ambient light while the latter is affected by light values reflected back to it. The photocell sensor would therefore be good for triggering processes in reaction to the room lights being turned on or off, while the ir sensor would be a good line follower or for triggering a sorting system. It's cool to see them at work using a little program to output their values to an LED bus and watch them change as you move them around:
to get-light
display sensora
wait 10

  • I also figured out how to store values and upload them to a text file. Here's the program:
to rec-data
repeat 10
[display sensora
record sensora
wait 10]
  • Once the data's recorded, uploading it is easy in Cricket Logo. Just click Cricket>Upload data, and in a few clicks you can upload it and save it as a text file that's easy to import into Excel.
  • It's really fun to play with the LED bus. After downloading a procedure that prepares it to receive the LED assignments, you can download any letters you want. Here's the prepping procedure:
to display-bits :d1 :d2 :d3 :d4
bsend $110
bsend 64
bsend low-byte :d1
bsend low-byte :d2
bsend low-byte :d3
bsend low-byte :d4
  • The values for :d1 :d2 :d3 :d4 have to be in hexadecimal format and they give a couple examples, such as that 'A' is $77. I had no idea how I was going to figure out what value each letter of the alphabet was, but my colleague wouldn't rest until he figured it out and he found this list someone at UMass had compiled. I'd like to know how they figured it out, brute force or programming. So my name is display-bits $7b $50 $30 $76.
  • After a little email correspondence with the fine folks (maybe just folk) at Gleason Research, I also learned that I can make our RCX temperature sensors work with the Cricket with a little hacking. They sell a 9V motor adapter, which connects the RCX lead to a motor plug on the cricket. So I thought maybe I could put sensor plugs on the 9V motor adapter instead (the only difference is the motor plug has two holes and the sensor plug has three.) and connect it to the temperature sensor lead. Apparently it will work but the values it returned have to be converted to real temperature values. To achieve this you have to find the values returned for some known temperatures, and in the words of Fred, "do a curve fit in Excel." I'll be talking to a math teacher to figure out how to translate that into a conversion formula. But it's great that we'll be able to use all these temperature sensors we have rather than buy new ones made for the cricket.

No comments :