What I Did With My Summer Vacation
We just returned from ten days away on Salt Spring Island doing not a lot. It was one of those holidays where we didn’t have any plans except to relax, drink some wine, read some books, and enjoy ourselves. Except that I kept myself busy with a couple of electronics projects and my ever-expanding library of robotics-related code.
I’ve become really interested in using the Controller Area Network technology to have multiple processors communicating together. While researching the options I found this project: CAN-CAN. I liked the simplicity of using the Microchip MCP2515 and it’s less expensive than using one of the Atmel processors with built-in CAN support. And this project really made it easy, I starting thinking it was something I could probably do. So I did! Here is the schematic for my version.
My first project used two separate ATMega8 processors talking to each other over a CAN bus. I read through the source code from the original project but figured I could build my own version, integrated into my own library of code for my robots. I made a number of improvements, making it easier to configure for different hardware. The main program sends a short text string from one processor to the other, where the case is reversed (uppercase to lowercase and vice versa) and a reply is sent back. Here is a picture of what it looks like in action on the screen.
I spent part of my holiday cleaning up the code and implementing interrupt-driven TX and RX. The fun didn’t stop there though. I wrote a second program that “sniffs” the CAN bus and pretty-prints out each message. This has turned out to be very useful while developing other programs with the library (more on this later).
I’ve packaged up my entire library plus these two demonstration programs and made it available for download here. There isn’t a lot of instructions but I’ll probably try to put together something in the future (maybe my next holiday?).
I haven’t been playing with this LCD for too long, but the Atmel code you’ve written for the CFAX is really helping me. I got the LCD from Sparkfun for a project, and this is insanely helpful 😉
Comment by Crash — October 11, 2007 @ 10:15 amHey! Glad you found the code useful, and if you have any suggestions or improvements to feed back I’d be grateful.
Comment by Bob — October 11, 2007 @ 6:22 pm[…] had a long interest in using Controller Area Network (CAN) to communicate between different components such as sensors […]
Pingback by random scribblings»Blog Archive » Overo + Controller Area Network — April 15, 2010 @ 7:20 pm[…] Overo. At the time I was confident of success because I was successfully receiving messages from my AVR setup. It was only recently that I discovered that in fact although reception was ok, transmission was […]
Pingback by random scribblings»Blog Archive » Overo + Controller Area Network (Revisited) — August 12, 2010 @ 7:42 pmHey Bob,
Just wanted to say I’m using your connection for connecting two micros together.. My overall experience is that CAN is quite hard, but I hope I can learn something by how you’ve done it.
I’ve seen the CAN-CAN project before, but I wasn’t sure on how it all should be connected, even though I had a guess. But now when I found your page I unpacked my electronics to give it a go 😉
Anyhow, hope you’re doing well and still interested in electronics! I’m coming back to check on your robot electronics in the coming weeks.
Comment by Chris Fredriksson — June 16, 2011 @ 10:42 amThanks Chris, glad to hear you found it useful! I’m still using the MCP2515 with this code in my robot projects. Please let me know if you have any suggestions or improvements. I’ve recently discovered Atmel’s ATMega16m1 with an integrated CAN controller. I will likely be trying to use one in a new project soon.
Comment by Bob — June 16, 2011 @ 7:09 pm