Introduction: HackerBox 0053: Chromalux

Greetings to HackerBox Hackers around the world! HackerBox 0053 explores color and light. Configure the Arduino UNO microcontroller board and IDE tools. Connect a full-color 3.5 inch LCD Arduino Shield with touchscreen inputs and explore touch paint demo code. Wire up an I2C color sensor to identify the frequency components of reflected light, display colors on addressable LEDs, solder up an Arduino prototyping shield, and explore a variety of input/output components using a multifunction Arduino Experimentation Shield. Hone your surface mount soldering skills with an LED Chaser PCB. Take an introductory look into artificial neural network technology and deep learning.

This guide contains information for getting started with HackerBox 0053, which can be purchased here while supplies last. If you would like to receive a HackerBox like this right in your mailbox each month, please subscribe at HackerBoxes.com and join the revolution!

HackerBoxes is the monthly subscription box service for hardware hackers and enthusiasts of electronics and computer technology. Join us and live the HACK LIFE.

Step 1: Content List for HackerBox 0053

  • TFT Display Shield 3.5 inch 480x320
  • Arduino UNO Mega382P with MicroUSB
  • Color Sensor Module GY-33 TCS34725
  • Multifunction Experiment Shield for Arduino UNO
  • OLED 0.96 inch I2C 128x64
  • Five 8mm Round Addressable RGB LEDs
  • Arduino Prototype PCB Shield with Pins
  • LED Chaser Surface Mount Soldering Kit
  • Man in the Middle Hacker Sticker
  • Hacker Manifesto Sticker

Some other things that will be helpful:

  • Soldering iron, solder, and basic soldering tools
  • Computer for running software tools

Most importantly, you will need a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.

There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we really appreciate your taking a few minutes to read the FAQ.

Step 2: Arduino UNO

This Arduino UNO R3 is designed with easy of use in mind. The MicroUSB interface port is compatible with the same MicroUSB cables used with many mobile phones and tablets.

Specification:

  • Microcontroller: ATmega328P (datasheet)
  • USB Serial Bridge: CH340G (drivers)
  • Operating voltage: 5V
  • Input voltage (recommended): 7-12V
  • Input voltage (limits): 6-20V
  • Digital I/O pins: 14 (of which 6 provide PWM output)
  • Analog input pins: 6
  • DC current per I/O Pin: 40 mA
  • DC current for 3.3V Pin: 50 mA
  • Flash memory: 32 KB of which 0.5 KB used by bootloader
  • SRAM: 2 KB
  • EEPROM: 1 KB
  • Clock speed: 16 MHz

Arduino UNO boards feature a built-in USB/Serial bridge chip. On this particular variant, the bridge chip is the CH340G. For the CH340 USB/Serial chips, there are drivers available for many operating systems (UNIX, Mac OS X, or Windows). These can be found through the link above.

When you first plug the Arduino UNO into a USB port of your computer, a red power light (LED) will turn on. Almost immediately after, a red user LED will usually start to blink quickly. This happens because the processor is pre-loaded with the BLINK program, which we will discuss further below.

If you do not yet have the Arduino IDE installed, you can download it from Arduino.cc and if you would like additional introductory information for working in the Arduino ecosystem, we suggest checking out the online guide for the HackerBox Starter Workshop.

Plug the UNO to your computer using a MicroUSB cable. Launch the Arduino IDE software.

In the IDE menu, select "Arduino UNO" in under tools>board. Also, select the appropriate USB port in the IDE under tools>port (likely a name with "wchusb" in it).

Finally, load up a piece of example code:

File->Examples->Basics->Blink

This is actually the code that was preloaded onto the UNO and should be running right now to blink the red user LED. Program the BLINK code into the UNO by clicking the UPLOAD button (the arrow icon) just above the displayed code. Watch below the code for the status info: "compiling" and then "uploading". Eventually, the IDE should indicate "Uploading Complete" and your LED should start blinking again - possibly at a slightly different rate.

Once you are able to download the original BLINK code and verify the change in the LED speed. Take a close look at the code. You can see that the program turns the LED on, waits 1000 milliseconds (one second), turns the LED off, waits another second, and then does it all again - forever. Modify the code by changing both of the "delay(1000)" statements to "delay(100)". This modification will cause the LED to blink ten times faster, right?

Load the modified code into the UNO and your LED should be blinking faster. If so, congratulations! You have just hacked your first piece of embedded code. Once your fast-blink version is loaded and running, why not see if you can you change the code again to cause the LED to blink fast twice and then wait a couple of seconds before repeating? Give it a try! How about some other patterns? Once you succeed at visualizing a desired outcome, coding it, and observing it to work as planned, you have taken an enormous step toward becoming an embedded programmer and hardware hacker.

Step 3: Full Color TFT LCD 480x320 Touch Screen

The Touch Screen Shield features a 3.5 inch TFT display with 480x320 resolution at 16bit (65K) rich color.

The shield plugs directly onto the Arduino UNO as shown. For easy alignment, just line up the 3.3V pin of the shield with the 3.3V pin of the Arduino UNO.

Various details about the shield can be found at the lcdwiki page.

From the Arduino IDE, install the MCUFRIEND_kvb library using the Library Manager.

Open File > Examples > MCUFRIEND_kvb > GLUE_Demo_480x320

Upload and enjoy the graphics demo.

The Touch_Paint.ino sketch included here uses the same library for a brightly colored paint program demo.

Share what colorful applications you cook up for this TFT Display Shield.

Step 4: Color Sensor Module

The GY-33 Color Sensor Module is based on the TCS34725 color sensor. The GY-33 Color Sensor Module operates on 3-5V supply and communicates measurements over I2C. The TCS3472 device provides a digital return of red, green, blue (RGB), and clear light sensing values. An IR blocking filter, integrated on-chip and localized to the color sensing photodiodes, minimizes the IR spectral component of the incoming light and allows color measurements to be made accurately.

The GY33.ino sketch can read the sensor over I2C, output the sensed RGB values as text to the serial monitor, and also display the sensed color to a WS2812B RGB LED. The FastLED library is required.

ADD AN OLED DISPLAY: The GY33_OLED.ino sketch shows how to also display the RGB values to a 128x64 I2C OLED. Simply wire up the OLED to the I2C bus (UNO pins A4/A5) in parallel along with the GY33. Both devices can be connected in parallel since they are at different I2C addresses. Also connect 5V and GND to the OLED.

MULTIPLE LEDs: The unused LED pin in the diagram is "Data Out" if you wish to daisy-chain two or more of the addressable LEDs together simply connect Data_Out form LED N to Data_In of LED N+1.

PROTOTYPE PCB SHIELD: The GY-33 Module, the OLED display, and one or more RGB LEDs can be soldered to the prototyping shield to construct a color sensing instrument shield that is easily attached to and detached from the Arduino UNO.

Step 5: Multifunction Arduino Experimentation Shield

The Multifunction Arduino Experimentation Shield can be plugged onto the Arduino UNO for experimenting with a variety of components including: red LED indicator, blue LED indicator, two user input buttons, reset button, DHT11 temperature and humidity sensor, analog input potentiometer, piezo buzzer, RGB LED, photocell to detect the light brightness, LM35D temperature sensor, and an infrared receiver.

The Arduino pin(s) for each component are shown on the silkscreen of the shield. Also, details and demo code can be found here.

Step 6: Surface Mount Soldering Practice: LED Chaser

Did you have luck constructing the freeform LED Chaser from HackerBox 0052?

Either way, it is time for another SMT soldering practice session. This one is the same LED Chaser circuit from HackerBox 0052 but constructed using SMT components on a PCB instead of using freeform/deadbug components.

First, a pep talk from Dave Jones in his EEVblog on Soldering Surface Mount Components.

Step 7: What Is a Neural Network?

A neural network (wikipedia) is a network or circuit of neurons, or in a modern sense, an artificial neural network, composed of artificial neurons or nodes. Thus a neural network is either a biological neural network, made up of real biological neurons, or an artificial neural network, for solving artificial intelligence (AI) problems.

Check out this series of four videos on Neural Networks and Deep Learning.

The videos are inspired by the free online book, Neural Networks and Deep Learning.

The web page for the book links to a code repo allowing us to play with the examples in detail.

We can even run a simple neural network on an Arduino. That demo shows that even the humble Arduino UNO can train and converge a simple neural net. However, we quickly run out of RAM for representing hidden layer nodes of even modestly complex nets. Of course, there are other embedded computing platforms with a lot more memory than the simplest Arduino boards, so stay tuned...

Soundtrack: Brain Eno, Nerve Net

Step 8: Hack the Planet

We hope you are enjoying this month's HackerBox adventure into electronics and computer technology. Reach out and share your success in the comments below or on the HackerBox Facebook Group. Also, remember that you can email support@hackerboxes.com anytime if you have a question or need some help.

What's Next? Join the revolution. Live the HackLife. Get a cool box of hackable gear delivered right to your mailbox each month. Surf over to HackerBoxes.com and sign up for your monthly HackerBox subscription.