Thursday, January 21, 2010

Building a bridge

I'm planning on helping with the MSU BCoE Summer Bridge program. I'm planning on a 10-day portion, having the students build a WareBot: a robot which follows line to deliver packages, avoiding obstacles along the way. There are two portions: the mechanical platform and the microcontroller. I'd like to develop a simple tracked mechanical platform to use DC motors, a servo and an IR distance sensor, and line sensors. I hope to have a student complete that for me this semester; the question of how difficult it is to build these remains. The microcontroller question is more complex. I could use a PIC24, but C programming for it would be painful. A second option is the BASIC Stamp; a third option would be some sort of Python-powered uC (perhaps an ARM).

Investigating the BASIC Stamp, I'd think that a BASIC Stamp II would be fine. It needs a serial connection to the PC at RS232 levels per the schematic (sigh), so just an FTDI cable doesn't work (here's an example of using an FTDI chip plus interfacing transistors). The USB Board of Education provides a nice setup, but the prototyping area is too small, plus it's somewhat expensive. I'd need to add an additional breadboard to this for the sensors/motors I've chosen. PBASIC is OK, but I'm not that excited about it. Their IDE is nice, and integrated with a bootloader, which is very good. However, it doesn't have any analog inputs, which is bad; an alternative is to use an RC delay to read an analog voltage.

The alternative would be Python running on a uC, supplemented by I/O libraries. That's a lot of work, especially if I'm not planning on using it elsewhere. However, it looks like I could buy one and follow the tutorial; the library looks reasonable.  However, I don't fully understand how to send it code / bootload it. I've downloaded the code and now need to update my Cygwin install to build it. Looks like more work, but also looks promising...

Update: UNIX builds are always painful. PyChip built fine, after I found the docs/src/BuildSystem.txt to help me. I needed docutils to built the html files, which was easy to install after finding it. make check fails with a compiler error on ut_dict.c, which wasn't encouraging. Reading the docs/src/InteractivePython.txt, it seems like the interactive mode does what I'd hoped: transforms source code to bytecode, sends it to the target, then prints the results of executing that code on the target. Given that the PIC24HJ64GP502 has 6K of RAM (plus 2K of DMA space), perhaps I could run on it; docs/src/FrequentlyAskedQuestions.txt recommends 8K of RAM, with 4K as an absolute minimum. Of course, I'd then need to wrap many of the C functions in Python, which would be a pain.

Hardware update: PyChip has some support for the a very nice STM32 board which costs just $25! However, it uses an RS-232 connection, which is a pain. I'm not sure if the TX and RX pins are accessible at TTL levels.

No comments:

Post a Comment