Intro: HackerBox 0033: Toys of Summer
This month, HackerBox Hackers are exploring MicroPython on the PyBoard and assembling the 2018 HackerBoxes Conference Badge Kit. This Instructable contains information for working with HackerBox #0033, which can be purchased here while supplies last. Also, 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!
Topics and Learning Objectives for HackerBox 0033:
- Understand the context and use of MicroPython
- Explore the PyBoard through REPL and Scripts
- Wire and query sensors from MicroPython
- Wire and control RGB indicators from MicroPython
- Assemble the 2018 HackerBoxes Conference Badge
HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. We are the dreamers of dreams. HACK THE PLANET!
Step 1: HackerBox 0033: Box Contents
- HackerBoxes #0033 Collectable Reference Card
- MicroPython PyBoard v1.1
- Exclusive HackerBoxes 2018 Badge Kit
- Exclusive HackerBoxes Lanyard
- DHT11 Temperature and Humidity Module
- RGB Sick with Eight WS2812 LEDs
- Passive Piezoelectric Buzzer
- Mini Black Solderless Breadboard
- Jumper Wire Set (65 pieces)
- CR2032 Coin Cells
- MicroPython Decal
- Exclusive HackerBoxes Ace of Spades Decal
- Exclusive Hack The Planet Iron-On Patch
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, DIY spirit, and hacker curiosity. Hardcore DIY electronics is not a trivial pursuit, and HackerBoxes are not watered down. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from learning new technology and hopefully getting some projects working. We suggest taking each step slowly, minding 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.
Step 2: Hacker Summer Camp
The summertime theme of HackerBox #0033 is inspired by Hacker Summer Camp. HackerBox #0033 even includes the HackerBox Conference Badge Kit.
If you will be at Summer Camp, please look for HackerBoxes at the HACKERBOXES MEETUP, in the DEF CON VENDORS ROOM, or at the HARDWARE HACKING VILLAGE. We really look forward to once again meeting so many members in person!
Where: Caesars Palace - Forum Food Court
When: Thursday, August 9, 2018 at 8pm
What: Meet other HackerBoxers, Hardware Hackers, and anyone else who wants to stop by, say hi, or hang out.
HACKERBOX BADGE KIT SALES
August 9th - Randomly around Caesars Palace. Follow HackerBoxes on Twitter to receive realtime notifications.
August 9th - Some badges might pop up at the HACKERBOXES MEETUP.
August 10th - DEF CON 26 Vendors Room (if supplies last).
August 11th - LOL.
SEE YOU IN LAS VEGAS!
Step 3: MicroPython
MicroPython is a lean and efficient implementation of the Python 3 programming language. MicroPython is a full Python compiler and runtime that runs on micro-controller hardware. The user is presented with an interactive prompt (the REPL) to execute supported commands immediately. Included are a selection of core Python libraries and modules which give the programmer access to low-level hardware.
Step 4: MicroPython PyBoard V1.1
The PyBoard is a compact and powerful electronics development board that runs MicroPython. It connects to a computer over a standard microUSB cable. The PyBoard provides a USB flash drive for saving Python scripts as well as a serial Python prompt for instant programming via a Read–Eval–Print Loop (REPL) interface. The PyBoard works with Linux, OSX, and Windows.
The video embedded above is a nice, quick overview of the PyBoard.
Check out the PyBoard Quick Reference.
Step 5: Measuring Temperature and Humidity
The DHT11 (datasheet) is a high performance temperature and humidity sensor.
Enter the following demo from the REPL prompt.
import dht<br>import machine d = dht.DHT11(machine.Pin(‘Y4’)) d.measure() d.temperature() d.humidity()
Step 6: RGB LED STICK
This RGB LED module includes eight WS2812s wired together in a chain.
There is a repo featuring MicroPython drivers for this type of LED device.
Grab the file ws2812.py and copy it to the PyBoard.
Then enter the following demo from the REPL prompt.
from ws2812 import WS2812 chain = WS2812(spi_bus=1, led_count=8) data = [(99, 0, 0),(0, 99, 0),(0, 0, 99)] # 3 LEDs RGB chain.show(data)
You'll notice that the first LED gets skipped. Props to Gene Denney for sharing this easy fix: Edit the ws2812.py file, search for the text "phase=1", and change it to "phase=0".
Step 7: HackerBox 2018 Badge Kit
The 2018 HackerBoxes Badge is a simple, but stylish, art badge. Instead of featuring any processors or wireless interfaces, it simply looks cool. This affords minimal demand for battery power allowing the badge to operate using only a single coin cell.
BUT HOW DOES IT WORK?
Magic! Actually, components D1-D6 may look like simple LEDs, but they are actually self flashing LED modules. Each module contains three LEDs (red, green, and blue) and a tiny oscillating control circuit. The outer plastic lenses come in various sizes, shapes, and opacities. The controller circuits come in various speeds (often designated as simply "slow" and "fast") and various "spectrums" or color cycling patterns. The badge kit includes three modules with fast RGB-cycling controllers and three modules with slow rainbow-cycling controllers. All six modules feature 3mm, round, diffused lenses. The RGB-cycling controllers only turn on one of the three LEDs (red, green, and blue) at a time. In contrast, the rainbow-cycling controller uses weighted combinations of multiple colors to display a much richer light palette. Combining modules with differing speeds and spectrums creates some cool visual effects while maintaining minimal component count and power consumption. Over time, the color-cycling oscillations will drift out of sync, adding variety to the light show. Self-flashing LED modules are a lot of fun and are super easy to work with. They do not even require current limiting resistors. They are increasingly easy to pick up from Adafruit, Amazon, eBay, etc for use in any project where you might want a little extra bling.
KIT ASSEMBLY NOTES
- Only the coin cell clip goes on the back side of the PCB. All of the other components go on the front side of the PCB.
- Solder the coin cell clip first. Tin all three square pads for the coin cell clip. Include a very slight bump of solder on the center pad to ensure good contact with the battery.
- For the six LEDs (D1-D6), note that there is a “FLAT SIDE” on the PCB silkscreen. It can be a little hard to see on the PCB, so it is also shown in the image here. The shorter pin of the LED goes into the hole near this flat side marking.
- Nine of the components (R1-R7, IC1, and X1) are purely ornamental. They can be populated in any direction or omitted entirely.
- Flush-cut all component leads after soldering.
- Attach the Exclusive HackerBoxes Lanyard into the large hole near the top of the PCB.
- Insert the coin cell.
The DIP switches labeled S1 turn power to the self-flashing LED controllers ON and OFF.
If you want to see more hacker conference badges, check out some of the Cool Hardware Badges of DEF CON 25 from last summer.
Step 8: HACK THE SUMMER
If you have enjoyed this Instrucable and would like to have a cool box of hackable electronics and computer tech projects descend upon your mailbox each month, please join the revolution by surfing over to HackerBoxes.com and subscribing to the monthly surprise box.
Reach out and share your success in the comments below or on the HackerBoxes Facebook Page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes!