LED rings are a good way of lighting up vision targets with green light. They are also a good way to show off other status of your robot.
The LED strip and LED ring are Adafruit Neo-pixels. I use an Arduino to control them. I really don’t want either the Roborio or Raspberry Pi to worry about controlling the LEDs, and this is a perfect place to use an Arduino.
The Arduino I decided to use is the Arduino Nano Every. This is a very small Arduino and can fit in a lot of small places. The downsides to this Arduino is that the mounting points are tiny. Smaller than 2mm. This is a big problem for mounting it. On the camera mount for the Microsoft Life Cam I tried to use 2mm screws, however I needed to trim off the corners of the board. For the Realsense camera mount, I put two slots in the camera mount and I just use two zip ties to hold the board to the camera mount.
The Arduino is controlled by commands sent through I2C. The loop looks at the last command sent with i2c and sets the LEDs to that color and spin patterns. The user can select all off, or red, blue, green, yellow, or white. The user can also select if the LEDs are solid or if they spin.
The Arduino opens up the I2C using address 0x30. The i2c comunication is just one byte and it’s what the user wants. The values for the bytes are:
const uint8 ALL_OFF = 0x20; const uint8 SOLID_GREEN = 0x30; const uint8 SOLID_WHITE = 0x32; const uint8 SOLID_BLUE = 0x34; const uint8 SOLID_YELLOW = 0x36; const uint8 SOLID_RED = 0x38; const uint8 SPIN_GREEN = 0x40; const uint8 SPIN_WHITE = 0x42; const uint8 SPIN_BLUE = 0x44; const uint8 SPIN_YELLOW = 0x46; const uint8 SPIN_RED = 0x48;