Tags

, ,

I’m adding testing the RGB LED on the Healthy pH Shield.  I added the RGB  LED to provide a visual indication when the Healthy pH Shield is working or not working.  Given all the layers that come together in order to adjust the pH, a visual indication can go a long way in helping debug an uncooperating piece of hardware/software!

The Goal

The goal of this post is to provide text behind the RGB LED diagnostics tests to be run starting with Dev-Rev2 of the Healthy pH Shield.

Thanks to Those that Went Before

  • Arduino.cc ReadASCIIString Tutorial – I used some of the code to get the R,G,B values from the serial monitor.  Google is our friend!  Arduino.cc is a great resource.  Thanks folks on the Arduino team for the useful content and excellent hardware.  You have dramatically simplified my ability to poke around and see how this stuff works.

Additional Material

  • Design: I am currently working on Dev-Rev2 of the Healthy pH Shield.  The RGB LED is located on the Arduino schematic within the Healthy pH Shield schematic.  The kicad files are available at this GitHub location.
  • Test code: I am continuing my test harness to include an RGB LED test.  The code is located in LEDDiags.cpp.  The firmware source is located at this GitHub location.  

Common Anode RGB LED

RGB LEDs come in either common anode or common cathode.  The one used in the design of the Healthy pH Shield is a common anode RGB LED.  The reason for this was the ready availability of the LED that is used (link to BoM).  I’m used to common cathode RGB LEDs where the color red – for example – is 255,0,0.  Since the anode RGB LED shares V+, the RGB values for red is the reverse: 0, 255,255.  This could be a spot confusing to get used to at first.

RGB LED

Here is the data sheet for the RGB LED that I used.  The image below shows how to orient:

RGBLED

A small green patch on the LED locates the common anode:

RGB LED Common Anode

Here is an image of the RGB LED layout in PCBnew:

RGB  LED Layout

and in eeschema:

RGB LED Schematic

The Arduino pin to LED mapping:

 

Arduino Pin

LED Pad

Color

A2

1

blue

A4

2

red

A3

3

green

 

Simpson DOH


Looking at the layout relative to the data sheet, pins 1 and 2 are swapped on the footprint given the schematic symbol.  This means A4 and A2 needs to be swapped.  Also, the green color is not working…ok,…I’ll look in the next rev…



Swapping these pins:

Arduino Pin

LED Pad

Color

A2

2

blue

A4

1

red

A3

3

green

 

So now the pin numbers on the layout do not match the pin numbers on the data sheet.  But the colors are now aligned to the pins.

The Test

The diagnostic test is simple:

  • turn on the RGB LED passing in an RGB value in the form 0-255(red),0-255(green),0-255(blue).  For example, to turn the light green, 255,0,255 is entered on the serial monitor.
  • turn off the light.
Green is not working.  Pins for red and blue seemed swapped?

The code is found in LEDDiags.cpp (link).  It is straightforward so I won’t detail it here.

Additional Cleanup

The RGB LED is not working correctly:

  • the layout in PCBNew/schematic symbol does not match the pins in the data sheet.
  • the Green color does not work.
Perhaps more testing could determine why the green is not working.  However, I am not sure if the layout issue isn’t blocking the green color not working.  For that reason, I’ll clean this up for the next rev and test then.

What’s Next

The RGB LED diagnostic test is very simple.  It is included in a post for completeness.  The next test diagnostics will be for the temperature sensor.  I’m also hoping the Healthy pH PCBs arrive very soon so that I can solder on the parts and start testing!

 

 

Thanks for reading this far.   Please find many things to smile about.

Advertisements