Computer Science Color Blindness

I wrote this post to give others some idea how I overcame a handicap in life I’ve had from birth and that is color-blindness or color-challenged. The National Eye Institute has an informative description on their website. To add to their description, all my life I’ve known I could never do certain things related to my color vision limitations that includes Interior Design, Fashion Design, Piloting a Plane, Healthcare, Computer Graphics, Appliance Repair, Painting, Cooking, and Electrical Engineering. All of these careers require a person to determine the difference between red and green shades that I cannot differentiate. The key word is “shades,” meaning slight variations in colors.

Instead, I chose a career in computer programming and learned a few languages over a 25 year career that includes Basic, C, Pascal, and finally Python. I was able to configure a server to run a web app to display pages across the internet but I could not do anything electrical due to color coded wires and components like capacitors, diodes, inductors, and resistors.

Recently, I migrated my SlideShow app from an Android tablet to a Raspberry Pi (RPi) 3B and learned how to manage a version of Raspbian Linux that ran the computer to migrate my Python app. Then I learned there were companies that sold add-on boards that simply plug into the RPi main processor board. With Python, I could communicate with the board to have it run motors that could automate a pan/tilt camera gimbal and to stream video, remotely.

As I delved into the many options, I concluded the RPi could do many things at once and would be an interesting hobby to learn components and apply what I had learned in my motion picture classes at Valencia College. There, I learned the basics of electricity in both lighting and audio classes. Although electricity is measured in absolute values, shown below, there are variations that occur due to many factors; however, the base values give the most important aspects when configuring and integrating circuitry.

W = V x A

(many people write it so it looks like West Virginia or W=VA)

So, if you’ve got the Watts ((W)) and Amps (A), you can calculate the Voltage (V) by dividing both sides of the equation with A as such W/A=V. Conversely, if you have V and A, one simply multiply V times A and determine the Wattage. These values are pervasive across the platform/computer; however, the difficulty comes when integrating batteries and solar panels sufficient enough to become mobile.

One point about these measurements needs to consider that power is provided as a source for a device or component to draw from. An online page from newelectric.com explains it this way:

Think of electricity as water flowing through a pipe [to] help understand amps, volts, and watts. Amps would be the volume of water flowing through a pipe. The water pressure would be the voltage. Watts would be the power (volts x amps) the water could provide (think back to the old days when water was used to power mills).

In the power mill case, the blades on the wheels rotate using the water and do not consume the total amount of water flowing in the stream. It only draws a portion of the energy that it needs to turn the wheels to run the mill. As long as the water remains constantly flowing the same amount of capacity to turn the wheel, everything continues to operate consistently. There can even be times when the water level decreases but there is still enough water to turn the mill’s wheel. However, should there be an overabundance of water, such as during a flood crisis, the mill is at risk of being damaged or overloaded with water and destroying parts or the whole structure.

That’s about how it goes with electronic circuitry.

After my partner and I experimented with aerial drones from several manufacturers in 2014 through 2016, we learned battery life cycles. Prosumer models could fly for a max of 30 minutes while streaming video over Wi-Fi and being remote controlled while constantly spinning four propellers. Some used Python to run the vehicle but aerodynamics and flight was not something I wanted to attempt, so I decided to build a remote controlled ground rover to do the similar photography as an aerial drone.

That’s when I learned that from some vendors, they don’t offer assembled board so they can be used in an educational environment to teach basics. One of the boards I attempted to use required soldering three head connectors with a total of 64 pins and a couple terminals with dual pins. Each of these connectors has a standard number of pins that can be in rows of two with a total of 40 pins or rows of three with a total of 12 pins, all within millimeters of each other.

40PinGPIO-PWM

This was when I learned the term “soft solder” that means the connection is not reliable in all circumstances, like when being installed on another board or removed. In these cases, the conductivity can become inconsistent or short out other boards. As it turned out, my solder job was considered soft and it indeed shorted out two boards, my RPi and the board sitting on top of the RPi.

What was beneficial to me was the manufacturer refunded my money and pointed me to different distributors that sold pre-assembled boards that avoided soldering. I knew then the art of soldering is reserved for those with steady hands and microscopic sight. It is not easy to wear magnifying glasses, hold a soldering iron in one hand, and the solder flux in the other while focusing within about 3 inches or 8 centimeters in front of one’s eyes.

Color Blindness

I learned that resistors are color coded but they are also sold with their measurement values in ohms so I could purchase the correct electrical value and the resistor can be installed in either direction because polarity does not matter. That means the only reason for the color on a resistor is to identify its ohm value, and as long as I keep them labeled, I can get the circuitry to work. In the other cases, like capacitors and diodes, it’s essentially the same situation although polarity is required but other indicators or markings other than color make that determination.

Polarity is the other side of electricity where electricity flows through circuits. There is always a positive and ground when connecting boards to power. Some boards have forgiving circuitry that prevents short-circuiting themselves. Others, mostly smaller components, do not and as shown below where I accidentally reversed positive and ground that fried it.

Servo-board

One important part of automation are motors. They are what make pan/tilt and motion work. There are different motor varieties based on the application such as pan/tilt mechanisms. Because the controls are pushing buttons, or using a joystick type interface, these motors, also called servos, act on a commanded using Pulse Width Modulation (PWM) where a button can be pre-programmed to a specific degree around its axis. That means, for a pan to a certain location around the 180 degree axis that these servos recognize, a program can send the value that matches that location.

These same servo motors are limited to 180 degrees around that axis but not 360 degrees, which is a full circle and pointing towards the back side of the rover’s rig. This was where I designed a switch that is triggered when a 360 degree motor is used instead of a PWM 180 degree servo motor. Using a switch that connects a circuit to set high another pin off the main board, I can stop a 360 degree servo motor once it gets a full 360 and turns no more in that direction.

The other variety of motors are not PWM commanded at all and are primarily used for continuous motion in one or the other direction, typically used for wheels on mobile devices like the rover I am creating as a prototype. These are typically called Direct Current (DC) motors and can be attached to a PWM board as long as you add yet another small board to filter the power for the motor.

For the rover’s DC motors, I purchased an Adafruit DRV8871 that I attached to an Adafruit 16 Channel PWM Servo Driver board that plugged on top of the RPi. While working with a support rep to get this to work, my RPi started to take multiple power cycles to boot, then it stopped booting all the time. It was apparent I had a short somewhere in my solder job that finally fried the RPi.

So, after burning a few boards, I finally found a pre-assembled board vendor that had both DC and PWM connectors. This removed a board from my configuration and proved to be the final solution for the rover. But the power requirement still lurked behind some of the most complicated electrical configuration issues and that is battery and solar panel. Here’s why.

Batteries need to be rechargeable or we just keep filling the landfills with a bunch of used alkaline batteries. Rechargeable batteries have been in the news over the last few years because of cheap ones used or abused start fires. Many of the cheap batteries are also bags of chemical fluids that retain electrical charges. These can leak and cause fires along with the other circuits in the product.

Metal rechargeable batteries, such as Nickel Cadmium batteries, or Ni-Cad for short, are not as likely to cause fires but must still be handled with extreme caution because of the amount of charge they contain. Also to note in the US, all rechargeable batteries must be disposed of at special sites that recycle or properly dispose the battery components. Examples of these are Home Depot and Batteries Plus.

When integrating the battery into a configuration, Voltage and Amperage are the values used to determine what is required to drive a board. Normally, a RPi runs using a micro-USB connector that has a transformer to convert US 120V Alternating Current (AC) into 5 Volt DC power with around 1 or 2 amps. This is where boards start to have variations and options.

Battery-Config

For the rover configuration, there is the RPi board that needs 5V power and the motor driver board needs to run two 6V DC motors, along with the two micro-servo motors for the gimbal. Because it will be rare when these motors run constantly for any amount of time, there will be little impact to motion because the amount of motor Amp loads are low and a 12V (two DC motor loads) with 2 Amp power supply or battery is sufficient to run the rover smoothly.

What makes it difficult is when adding a solar panel to run the rover 24 hours, 7 days a week, and it all has to do with Mother Nature.

Solar panels must be directly exposed to the sun to get optimum power. That means, no clouds or branches can be in the way to reduce panel exposure and artificial light from bulbs do not charge solar panels. Since direct exposure happens only on clear sky days and requires being out from anything that can reduce exposure, solar panels will vary during the day and stop charging altogether at night.

So to handle sun outage times, the battery attached to a solar panel needs to be able to retain enough charge to run the components that are running continuously 24/7. On my rover, that was going to include streaming video, Wi-Fi, and any user’s night activity and roaming. Night or after-hours cruising would consume a majority of the battery so this load requirement meant a minimum of 7 Amp and the full system required 12 Volts. The folks at All Spectrum Electronics wrote up an excellent description of the 24/7 solar panel electrical system for the Raspberry Pi that I reposted HERE (in case they move their page).

When I found a base line voltage at 12V, a quick search resulted in a brick wall, as in the size and weight of the battery: 2.6 x 5.9 x 4 inches and about 4 pounds. That would mean the battery would be grossly overweight for the aluminum chassis and would require a large amount of space defeating the purpose of the camera rover. So, the design had to change to be a temporary battery-operated vehicle without solar panels. After this prototype tests, the next rover can be designed to support solar power and batteries.

As for the color blindness with wires, a simple solution presented itself when wiring to configure and integrate circuit with pre-soldered components. That is, typically ground is colored black or green and power is white or red. So I chose to use these colors exclusively for power and ground and all the rest could be any color, as long as I could tell one was different than other wires in a bundle. It also helped to label the wires with a small piece of electrical tape marked with GPIO pin or other named destination.

As for electrical variations, I learned that board can be smart enough to recognize the environment where it’s installed. For instance, some boards can be powered with a range of DC voltages such as 5-9V, 5-12V, or 12-30V. What’s also interesting is that these same board can retain or “remember” a certain configuration, but if you change that, say changing the power supply from 12V to 5V, the board needs to be reset so it learns the new environment and operates in that new power configuration.

But the most difficult part with any of these microscopic components, wires, and connectors is having patience to make mistakes and wait for solutions. Sometimes I would give up too soon then would revisit a problem to find it was just a really tight fit but worked when wiggled into place. Burning up boards meant waiting for replacement parts coming from around the world. UPS lost one order of parts from Canada that I was using to create the remote control and amazon.com refunded my money immediately after the carrier started tracking my return package.

Today I wait for my credit card refunds for returned parts before I order the remote control parts again. I also returned the DC/PWM HAT after I installed it with metal separators because the PWM no longer operated and the LED light dimmed and flashed. I couldn’t find a plastic separator solution other than ordering 210 piece packages.