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.

4 People Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

31 Discussions

0
None
GreatDreamerTimGTech

Reply 5 weeks 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.

1
None
TimGTechGreatDreamer

Reply 5 weeks 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
eburmanTimGTech

Reply 19 days ago

I tried your code but I get an error message saying that the sketch is too big.

1
None
TimGTecheburman

Reply 18 days ago

Hmm... I just downloaded the .ino that I posted just to make sure it was ok. It uploaded just fine. It till does take up a fair amount of room and its possible you might get a low memory warning, but it should not be too big.

This i my result after uploading:
Sketch uses 27940 bytes (86%) of program storage space. Maximum is 32256 bytes.
Global variables use 1510 bytes (73%) of dynamic memory, leaving 538 bytes for local variables. Maximum is 2048 bytes.

Do you have the Arduino/Genuino selected as your board?

Also, try commenting out this line:
// display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
If you did not follow the other steps regarding the skull image that could be the cause.
This code is dependent on having done that but commenting out this line should work around it.

0
None
eburmanTimGTech

Reply 16 days ago

Got it! You were right, I didn't follow your instructions carefully at first. It took me a while to figure out exactly what, where and how to cut and paste your bitmap example, but I persisted and ultimately I prevailed! Thanks for the tutorial. Now I need to give the image converter program a try!

0
None
eburmanTimGTech

Reply 15 days ago

Thanks for making this more simple and showing the way. Playing around with images and text now.

IMG_2407.jpegIMG_2408.jpeg
0
None
TimGTecheburman

Reply 18 days ago

Try this: Go back here: https://bit.ly/2lLSJZ3
Download the hb_hack_life_epd.ino file.

This will simply display "Hacker Boxes Hack Life" and no images. It should fit with no problem.

0
None
misterfishHackerBoxes

Reply 26 days ago

That link is dead too. Looks like most 18650 cells are gone from Amazon. That can't be good... ;)

0
None
eburmanmisterfish

Reply 18 days ago

It seems that the sources on Amazon are fleeting. Using the information that HB gave me, I was able to select appropriate 18650 cells, they took several weeks to arrive but they are working great. The seller is already gone or else I'd provide a link. I was lucky I guess. I didn't go for the cheapest. The cheaper they are the more likely they are to be junk/counterfeit.

0
None
HowardW29HackerBoxes

Reply 5 weeks 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 5 weeks 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 5 weeks 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
misterfish

Question 26 days ago

When the box arrived, the preset text on the epaper screen was very readable. After trying various tutorials, I *finally* got the screen to do anything at all by using the info posted by Blun7 and TimGTech (thanks!).

My issue is that the red color is VERY faded. Any combination of black and white is just fine, but red is unusable (GxEPD_RED). It slowly fades into view but never comes to full strength. Interestingly, just before the display starts to refresh, it looks like red "pops" to full power for a fraction of a second, but never displays at that intensity when the write is finished. Red is defined in GxEPD as 0xF800

It's almost like an old mono LCD calculator when viewed off-axis; the text is there, but not really visible. Running on the included UNO until I get more experience.

?

Update: The same is true when running a Waveshare image demo via RasPi/Python, red just never "comes in." Thinking I got a bad display.

2019-09-18 14.25.40.jpg2019-09-18 14.26.52.jpg2019-09-18 14.28.05.jpg2019-09-18 14.27.25.jpg2019-09-19 21.13.28-1.jpg
1 answer
0
None
TimGTechmisterfish

Answer 18 days ago

I have the same issue with the red being very faint. I think that's just the way it is unfortunately, I have tried all sorts of stuff and still no better.