Wednesday, June 24, 2015

Neopixels and ATTiny 85 Arduino shields

This semester the grade 12s had to come up with a unique application of Neopixels using their own ATTiny 85 Arduinos that they built at the start of the semester. The application is implemented on an ATTiny 85 shield that the students design and etch in the classroom.  The shield interconnects the ATTiny 85 Arduino, a strip of 12 Neopixels and a DC Wall adapter type power supply. The shield uses a 9 pin header to connect to the home brew Arduino and screw terminals to connect the power supply and the Neopixel strip.

In earlier blogs I described the very successful ATTiny 85 home brew Arduino my students build in their high school classroom and some grade 12 challenges involving the design and construction of Arduino shields. Last semester the students built motor driver Arduino shields to operate two stepper motors extracted from surplus CDROM drives. The motors were used to drive a CNC pencil built on a simple wooden frame.  Another common challenge I have used in the past is a traffic light simulator built onto a shield. While very successful units were built the students could not work further with their shields unless they purchased their own Arduino Uno.  This year the students could put together their own ATTiny 85 Arduino with a shield to build a project that they can take home.

The shield needs to

  1. provide 5V power to the Neo pixel strip and the ATTiny 85 Arduino.
  2. provide a connection point for the Neopixel strip data and power
  3. contain a 9 pin header to connect to the ATTiny 85 Arduino.
  4. provide connections or house some kind of input such as a momentary push button, light sensor etc.
1. Power. 
The shield needs to support the large 1000 uF capacitor along with a 7805 regulator that takes anywhere from 5 to 25 volts input and keeps the output pin at 5V. C2 provides rf filtering at 0.1 uF. In the photo above you can clearly see the 7805 in front of the large 1000uF capacitor. 6, 7.5 and 9 volt adapters, 200mA or more worked best. 12 and 15 volt adapters caused the 7805 to reach temperatures of 140 degrees C when all 12 pixels were on at full power - white. A couple of students worked directly from 5 volt adapters and had no problems. 5 V switching power supplies are recommended. 30 Neopixels can draw a whopping 2 A current.

2. Connection point.

J1 and J2 are power in and 5V power out. By combining the 2 ground screws into one screw we can use the last unused screw terminal for the data - out to the Neopixel shield. Many of the student designed shields also provide connection points for external sensors.  The shield shown above contains 2 push buttons and between the 7805 and the capacitor is a 3 pin header providing power and data to and from any Arduino compatible sensor. This is the layout for the board shown above done in Fritzing. Soldering wires to the Neopixel strip proved to be a little difficult. Too much stress on the connection will cause the copper to delaminate from the plastic and break off. We glued the pixels down with double sided tape to help prevent this from happening.

3. 9 pin header

The 9 pin header connects our shield to the ATTiny 85 as shown in the photo above. In the diagram the top pin is 0, ground.
1 is unused. On the ATTiny 85 Arduino pin 1 is the reset button.
2 is an extra input for an analog sensor - logical Pin 3.
3 S1 (pushbutton) - logical Pin 4.
4 is unused. It is another ground.
5 Neopixel data - logical Pin 0. In the next revision I will add a 300 ohm resistor in series between the header and the screw terminal to help protect the Neopixels from excessive current on the data line.
6 is unused.
7 S2 (pushbutton) - logical Pin 2.
8 5V power.

4. I soldered in a small 3 pin female 0.1" header so that I could easily connect a sensor that provides an analog or digital voltage.  From top to bottom: data, +5V, gnd.

Here are some examples of the boards and functions the students came up with.

A game using counters.

Light pattern selected by pushbuttons.

Light pattern controlled by a single push button.

Other projects included:
- tic tack toe
- lights controlled via bluetooth from a smart phone
- lights controlled via an ultrasound ping detector
- lights controlled by a temperature sensor