HackerBox 0033: Toys of Summer

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

It's that time of the year when tens of thousands of hackers descend upon Las Vegas for DEF CON, Black Hat, and BSidesLV.

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!

HACKERBOXES MEETUP

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

  1. 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.
  2. 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.
  3. 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.
  4. Nine of the components (R1-R7, IC1, and X1) are purely ornamental. They can be populated in any direction or omitted entirely.
  5. Flush-cut all component leads after soldering.
  6. Attach the Exclusive HackerBoxes Lanyard into the large hole near the top of the PCB.
  7. Insert the coin cell.
  8. 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!

Share

    Recommendations

    • Plastics Contest

      Plastics Contest
    • Audio Contest 2018

      Audio Contest 2018
    • Optics Contest

      Optics Contest

    3 Discussions

    0
    None
    dragondad22Pete Lefferson

    Answer 2 months ago

    There's a typo in the code. Use:

    import dht
    import machine
    d = dht.DHT11(machine.Pin('Y4'))
    d.measure()
    d.temperature()
    d.humidity()

    0
    None
    Pete Lefferson

    Tip 2 months ago on Step 8

    HackerBoxes 0033

    To make a script run in piboard:

    1. Copy script for your editor.

    2. Inside piboard ctrl c ctrl E

    3. Right click to past script to piboard

    4. ctrl D to run the script.

    Is there another way to do this? I would like to learn it.