Broken Down Bus

Previously, a ring of wires and photocells were soldered together to create a literal external bus. On this page, we’re going to see how the sensors are read.

Sixteen is a lot of sensors for a microcontroller to read directly. The ATtiny861V microcontroller has a plentiful eleven analog inputs, but that’s still inadequate. So, the purpose of the two-half circle six wire perimeter is to permit multiple sensors to be read by the same analog input. This is called “multiplexing”.

The first eight sensors are on one side of the circle. The second eight sensors follow the same pattern. Four of the bus wires lead to the analog inputs, and two wires enable or disable ground. Enabling one ground wire activates a set of four sensors at a time.

Sun Tracker multiplex wiring diagram

Sun Tracker multiplex wiring diagram

In the above image, current flows through fixed resistor R4, which divides the voltage with sensor R5, which is read by ADC0. Enable A is ground and the other enable wires are electrically disconnected (HiZ/input state). If Enable A was not ground, no current could flow through R5. Or, at least that was my theory.

It turns out, current can flow through the “disabled” sensors because they are all tied together on one end. When that end is not grounded, the current can flow back into any of the ADC lines, altering the reading of the selected sensor. For example, pretend R9, R10, R11, and R12 are dead shorts (0 ohms) because the sun in going supernova. Essentially, that gives us R1, R2, R3, and R4 in parallel with R5.

Sun Tracker multiplex unintended path

Sun Tracker multiplex unintended path

To prevent current from passing in an undesired direction, each of the sensors needs to be desoldered and given a diode on one leg. As is, false sensor readings make this useless to determine the brightest direction.

Central Hub

The Sun Tracker motherboard is fairly simple.

Sun Tracker motherboard with BJT transistor H bridge

Sun Tracker motherboard with BJT transistor H bridge

The motherboard contains (from left to right):

Lastly, a pushbutton has been bodge-wired onto a spare pin to debug what was going wrong with the sensors.

On the next page, we’re going to see the hot little Maxon motor selected for tracking the sun, and how the mounting bracket was created.