Saving Floats, Longs, and Ints to EEPROM in Arduino Using Unions

The Arduino EEPROM library provides the read() and write() functions for accessing the EEPROM memory for storing and recalling values that will persist if the device is restarted or its operation interrupted.  Unfortunately, these functions only allow accessing one byte at a time.  The float, double (the same as float on most Arduinos), and long data types are all four bytes long, and the int data type is two bytes long, the same length as the word data type.  Some trickery is needed to easily store and recall these values.

Continue reading “Saving Floats, Longs, and Ints to EEPROM in Arduino Using Unions”

Patching pyserial to Fix Serial Baud Rate Limitations in Linux

I ran into an interesting issue when trying to connect to a new printer with my Linux laptop.  The printer firmware was set up for 250000 baud and for some reason I couldn’t connect to it.  After a little searching, I found that this was a known issue in pyserial with newer kernels and there’s a quick fix.

Continue reading “Patching pyserial to Fix Serial Baud Rate Limitations in Linux”

Arduino, 3D Printer, and USB Serial Device Permissions on Linux

When I first got started with Arduino under Linux, I quickly discovered that I had issues connecting to the Arduino to program it or talk to it via serial.  I later found the same issue when I started working with 3D Printers, when trying to connect the host application to the printer to operate it.

This was clearly a permissions problem, as all of these cases (and other USB serial devices) worked just fine when run as root (not a good practice, don’t do this).  This is just a quick post showing how to set yourself up with the permissions needed to use these devices as a normal user.

Continue reading “Arduino, 3D Printer, and USB Serial Device Permissions on Linux”

Assigning Static Device Names for USB Serial Devices (Including Arduinos)

I posted this on G+, but figured I’d post here as well with a little more depth.
I was working on a processing sketch that needs to communicate with several USB Serial devices (mostly Arduinos).  To make my life easier I wanted to find a way to make sure I could identify each one every time by the location of the port in the filesystem, which meant a static name for each.  This setup will give you the same name for the device in /dev every time you connect it.  This is particularly helpful if you have lots of devices to manage or want to hard-code a path to the port into a script or application (but only one that will only be running on your local machine).