HackerBox 0046: Persistence

Greetings to HackerBox Hackers around the world! With HackerBox 0046, we are experimenting with persistent electronic paper displays, LED persistence of vision (POV) text generation, Arduino microcontroller platforms, electronic prototyping, and rechargeable battery power banks.

This Instructable contains information for getting started with HackerBox 0046, 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 enthusiasts of electronics and computer technology - Hardware Hackers - The dreamers of dreams.

HACK THE PLANET

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Content List for HackerBox 0046

  • ePaper Module
  • Arduino UNO with MicroUSB
  • Two UNO Prototyping Shields
  • USB 18650 Battery Power Bank
  • Diffused Red 5mm LEDs
  • 560 Ohm Resistors
  • Male-Female DuPont Jumper Wires
  • 9V Battery Holder
  • Open Hardware Sticker
  • Exclusive Open Hardware Lapel Pin

Some other things that will be helpful:

  • 9V Battery
  • 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 instructions for the HackerBoxes 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: Electronic Paper Display Technology

Electronic Paper, ePaper, electronic ink, or e-ink technologies enable display devices that mimic the appearance of ordinary ink on paper. Electronic paper display are generally persistent in that the image remains visible even without power or with the control circuitry removed or shut down. Unlike conventional backlit flat panel displays that emit light, electronic paper displays reflect light like paper. This can make them more comfortable to read and provide a wider viewing angle than most light-emitting displays.

The contrast ratio approaches newspaper with newly developed displays (since 2008) being slightly better still. An ideal ePaper display can be read in direct sunlight without the image appearing to fade.

Flexible electronic paper uses pliable plastic substrates and plastic electronics for the display backplane. There is ongoing competition among manufacturers to provide full-color electronic paper support.

(Wikipedia)

Step 4: Multicolor EPaper Module

The MH-ET LIVE 1.54-inch ePaper Module can display both black and red ink. The module is referred to in the example and documentation as the black/white/red (b/w/r) 200x200 electronic paper display (EPD).

The display technology is Microencapsulated Electrophoretic Display (MED), which uses tiny spheres where the charged color pigments are suspending in the transparent oil and move into view depending on applied electronic charges.

The ePaper screen can display patterns by reflecting ambient light, so it operates without a backlight. Even in bright sunlight, the ePaper screen provides high visibility with a 180 degree viewing angle.

Use of MH-ET Module with Arduino UNO:

  1. Install Arduino IDE (if not already installed)
  2. Use Library Manager (Tools->Manage Libraries) to install Adafruit GFX Library
  3. Use Library Manager to install GxEPD (NOT GxEPD2)
  4. Open file->examples->GxEPD>GxEPD_Example
  5. Uncomment the line to include GxGDEW0154Z04 (1.54" b/w/r 200x200)
  6. Wire UNO to EPD: Busy=7, DC=8, Reset=9, CS=10, DIN=11, CLK=13, GND=GND, VCC=5V
  7. Set EPD Switches BOTH to “L”
  8. Download GxEPD_Example sketch from IDE to UNO as usual

Another library with demo code (supplied from the EPD manufacturer) can be found here. Note that these demos (and some other examples available online) have different pin assignments than those used above in the GxEPD example. Most notably, pins 8 and 9 are often reversed.

Step 5: Arduino UNO Prototyping Shield

An Arduino UNO Prototyping Shield fits directly onto an Arduino UNO (or compatible) board just like any other shield. However, the Arduino UNO Prototyping Shield has a general-purpose "perf-board" area in the middle where you can solder on your own components to construct your own custom shield. Simply solder the headers in at the outside rows of the shield such that it can plug right on top of the UNO. The plated holes next to the headers connect to the header signals so that the lines from the UNO can be easily connected into your custom circuitry.

Step 6: Seven LED Setup on Prototype Shield

An Arduino Prototype Shield can be used to support the illustrated circuit. The circuit has I/O pins 1-7 of the Arduino connected to seven LEDs. Each LED is wired in-line with its own current limiting resister, which in this example are 560 Ohm resistors.

Note that the short pin of each LED needs to be oriented towards the GND pin of the Arduino. The resistors can each be oriented in either direction. The 9V batter holder can be connected to make the project "portable" but must be wired to the Vin pin (not to 5V or 3.3V).

Once the circuit LEDs and resistors are wired up, experiment with the blink example sketch by changing the pin number to various values between 1 and 7.

Finally, try out the knight_rider.ino sketch attached here for a flashback from the 80s.

Step 7: Persistence of Vision

Persistence of vision [VIDEO] refers to the optical illusion that occurs when visual perception of an object does not cease for some time after the rays of light proceeding from it have ceased to enter the eye. The illusion is also described as "retinal persistence", "persistence of impressions", or simply "persistence". (wikipedia)

Try out the POV.ino sketch included here on the "Seven LED" hardware setup from the last step. In the sketch, experiment with different message text and timing parameters to get various effects.

Inspiration: Arduino POV Project from Ahmad Saeed.

Photo Credit: Charles Marshall

Step 8: USB 18650 Battery Power Bank

Just pop a 18650 Lithium-Ion cell into this baby to make your own rechargeable "Power Bank" for use with various 5V and 3V projects!

You can find these common 18650 Lithium-Ion cells from various sources, including this one from Amazon.

Power Bank Module Specifications:

  • Input (Charging) Supply: 5 to 8V via micro USB port up to 0.5A
  • Output power:
    • 5V via USB Type A port
    • 3 connectors to deliver 3V up to 1A
    • 3 connectors to deliver 5V up to 2A
  • LED Status Indicator
    • Green = battery charged
    • Red = charging)
  • Battery protection (overcharging or over-discharging)
  • ATTENTION: There is no reverse-polarity protection!

Step 9: Live the HackLife

We hope 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 HackerBoxes 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.

3 People Made This Project!

Recommendations

  • CNC Contest

    CNC Contest
  • Make it Move

    Make it Move
  • Teacher Contest

    Teacher Contest

15 Discussions

0
None
HowardW29HackerBoxes

Reply 9 days ago

The batteries have me confused. The battery shield looks a little too big for one batter, and a little too small for two. In addition, I went to an electronics retailer over the weekend and they had two different size items list as 18650 Lithium Ion. Is there some other characteristic I can use to be sure I'm getting the right item?

0
None
eburmanHowardW29

Reply 9 days ago

Same here. Whenever I search for 18650 Lithiums batteries there seems to be a multitude of sizes, voltages and AmpHours listed. It can be very uncertain. So, I've ordered some "18650's" from Amazon. They should be coming soon. If they fit then I'll post the link.

1
None
HackerBoxeseburman

Reply 9 days ago

"The 18650 (18mm by 65mm) battery is a size classification of lithium-ion batteries. If you have ever held one in your hand, you probably noticed it is the same shape, but a bit larger than a AA battery. AA batteries by comparison are sometimes called 14500 batteries, because they have a 14mm diameter and 50mm height." (batterybro)

Unlike a typical alkaline cell which is apx 1.5V, a single Li-Ion cell is typically 3.7V due to the cell chemistry (sum of the RedOx half reaction potentials). Note that other rechargeable chemistries, such as NiMH or NiCd, will have a different single cell voltage based on their RedOx reaction potentials.

https://www.khanacademy.org/test-prep/mcat/physical-processes/intro-electrochemistry-mcat/a/electrochemistry

Slightly related note: Top nerd points to know (and properly use) the difference between CELL and BATTERY. A cell is a single RedOx reaction pair. A battery is "a combination of apparatus for producing a single electrical effect - for example: a battery of generators" (miriam webster). In other words, the term battery should be used for two or more cells, not a single cell... We call AA, D, C, etc CELLS (not batteries) because each is ONE 1.5V cell, but a standard rectangular 9V Battery (not a cell) is SIX 1.5 cells together. It's a battery of 6 cells. Also looks at the corresponding schematic symbols for cell (one) and battery (many).

0
None
GreatDreamerTimGTech

Reply 9 days ago

How can i have just these images on here?
I have been able to put the other code and manipulate the text, but not the image.

0
None
TimGTechGreatDreamer

Reply 9 days ago

The image has to be converted to an array. (referred to as a data array, bitmap or image array, etc.). Here is what I did to make the skull.... (to my amazement it worked!)

I screen captured the skull from the Hackerboxes facebook page and saved as a jpg.

Then resize to 200 x 200. at https://resizepic.com

Download Image2Bitmap (Windows Binary) and convert image to byte array. https://github.com/FoxExe/Image2Bitmap

Then I copied the code and pasted it over the BitmapExample1 code in the BitmapExamples.h file. It is located in: Arduino\libraries\GxEPD-master\src\GxGDEW0154Z04 folder.

The Example code I leaned out to remove a lot of unnecessary stuff for using on the Uno to keep the sketch much smaller to conserve space.

You can get everything above from here: https://bit.ly/2lLSJZ3





0
None
HackerBoxes

13 days ago

Update from the manufacturer for using the MH-ET ePaper (EPD) with the Arduino UNO...

tldr: Wire 5V (from UNO) to VCC (on EPD) but then set the EPD's voltage switch to "L".

Even though that sounds wrong, it makes the voltage levels work out correctly. We will have some more detailed examples going onto the box guide today that cover this VCC issue along with some other interesting things we have learned about the EPD over the last few days.

Props to folks who have been exploring this "feature" along with us, especially b1un7 (renown inventor/developer of the Flying Electronic Quad-Copter Badge) and our friends in Shenzhen.
2 replies
0
None
TimGTechHackerBoxes

Reply 13 days ago

I've been playing around with this myself and found in some code somewhere the mentioning of this. I'm thinking I'll solder the header on and use those instead of the connector. That vcc doesn't have any level shifting going on there.

0
None
Blun7

17 days ago

EPD MH-ET LIVE Resources:

Reading/How-To/Video:
https://www.waveshare.com/wiki/1.54inch_e-Paper_Mo...

Code that worked:
- First import library (with Library Manager in Arduino): GxEPD (NOT GxEPD2)
- Code:
By xxlucas42:
https://gist.githubusercontent.com/xxlukas42/
Example File:
https://gist.github.com/xxlukas42/dab2cbd1202ce75b...
EDITS to example .ino file:
- UNcomment line:
#include <GxGDEW0154Z04/GxGDEW0154Z04.h> // 1.54" b/w/r 200x200
- Confirm proper pinning on lines just above SETUP Function:
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9);
GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7);
NOTE: PINS 8 AND 9 ARE REVERSED IN DIFFERENT CODE!! ENSURE YOU PINOUT CORRECTLY PER YOUR CODE!!!

I have posted the working code, with all edits, to MY Github page:
https://github.com/b1uN7/HackerBoxes/blob/master/README.md

1 reply
0
None
Racer1TNBlun7

Reply 14 days ago

I'm getting a compile font library error, Can't seem to locate what font library is needed.
Fonts/OpenSansBold12pt7b.h: No such file or directory

0
None
Blun7

17 days ago

SOLVED: Serial Printing "Busy Timeout!"
Problem: Serial Printing "Busy Timeout!"
Solution: RESET RIBBON CABLE GOING TO THE EPD!!

0
None
Blun7

17 days ago on Step 4

Having a heck of a time trying to get this to work!
My Chinese is just not that good...
Anyone having any luck?
I was able to get the images/text the epaper was sent with erased, but that’s it..

90883FBB-63F5-4FC9-9442-0C0E8951CA1F.jpeg