Sending J1939 CAN-BUS messages with Sparkfun CAN-BUS Shield

Keeping in the spirit of open-source, I have modified the libraries of the Sparkfun CAN-BUS shield. With these updated libraries we are now able to send messages using the standard identifier (11 bits) and also send messages with the extended identifier (29 bits).

I am running the following code in Arduino UNO. Keep in mind that this particular CAN-BUS shield does not work with the Leonardo Arduino board mainly because the SPI pins were moved around. There are workarounds, but they require some understanding of the SPI protocol and how different Arduino boards are mapped. This is fairly well explained in Exploring Arduino: Tools and Techniques for Engineering Wizardry.

Anyway, here is a simple Arduino program that continuously sends J1939 messages through the CAN network.



Screenshot of the sample arduino CAN messages captured with the program CANviaUSB

The updated MCP2515 libraries can be found at http://www.nunoalves.com/source/canbus_nca26_09_2012.zip. To install this library and use it with your Arduino projects just drop it in the appropriate sub-directory (e.g. ~/Documents/Arduino/libraries in macosx). For reference here is the data sheet for the MCP2515 SPI CAN transceiver. I found all the information in there.

Finally… a big thank you to Fabian Greif and his initial efforts on the MCP2515 library.

Automatically leveling your Castlevania character with an Arduino

I love playing video-games. Rarely play more than 1 hour a week these days… but when possible I log in my PS3 and put some time into old school PSone games… in particular Castlevania: Symphony of the Night. Phenomenal game! The only problem… is that there is some annoying grinding component to it.

Anyway, on the weekends I also love spending time with my son. Unfortunately, my son is 1.3 years old which means i can’t play with both at the same time. Time to optimize! I created a very simple system that repeatedly presses the same button over an over again. When the character is in an adequate location, it will repeatedly kill any enemies that are walking in his direction.


The point? I want to play the hard bosses and skip all the grinding. This simple contraption does the job. It is not pretty (all materials used were scavenged from here and there) but it works.

Here are two videos showing the machine in action…

And of course the Arduino source code… Everything was made, assembled and implemented in about 15 minutes. Automation FTW!