Introduction: HackerBox 0045: Spark Net
Greetings to HackerBox Hackers around the world! With HackerBox 0045, we are experimenting with Nordic nRF24 radio transceivers, programming and networking Digispark Pro modules, radio interfacing servo motors, motion detectors, and so much more. This Instructable contains information for getting started with HackerBox 0045, 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
Step 1: Content List for HackerBox 0045
- Three Digispark Pro ATtiny167 Modules
- Three Amplified NRF24L01 Modules
- Three Exclusive DigiProNRF Circuit Boards
- Three SMA Antennas
- Storage Box with 575 Resistors
- HC-SR501 PIR Motion Sensor Module
- Micro Servo with Hardware
- Linear 10K Ohm Potentiometer
- Female-to-Female DuPont Jumper Wires
- BadgeBuddy Intro to Soldering Kit
- Google Logo Sticker
- Exclusive HackLife 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, 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: Intro Soldering Kit - BadgeBuddy
The BadgeBuddy is simple and fun "introduction to soldering" kit. HackerBoxes is proud to have produced thousands of BadgeBuddy kits for promoting our hobby at DEF CON 27 in Las Vegas. BadgeBuddy kits will be available for free (as in beer) in the Hardware Hacking Village, in the Soldering Skills Village, and in the Vendor Room. The organizers and volunteers in the DEF CON Villages are dedicated to introduce and assist anyone interested in electronics and many other aspects of hacking and security research.
Of course, enough extra BadgeBudy kits have been sourced to make sure all HackerBox members could also get a BadgeBuddy kit in HackerBox 0045. You can share your BadgeBuddy with someone who wants to learn to solder, or you can just enjoy it for yourself!
The BadgeBuddy is a blinky mini-badge PCB that can be hung from a conference lanyard, backpack, purse, belt, etc using the included ball chain. The BadgeBuddy uses an improved style of self-cycling rainbow LEDs for a reduced BOM with no external control circuitry required. This makes for an interesting result that is still simple enough for a first time soldering project.
If you are coaching someone through this kit who is new to soldering, there are a lot of great guides and videos online about soldering. Here is one example. Keep in mind that local maker groups or hacker spaces often have soldering stations and expertise to share. Also, amateur radio clubs are always excellent sources of electronics experience.
BadgeBuddy Assembly Notes:
- TIN CENTER PAD UNDER COIN CELL CLIP WITH SOLDER TO MAKE A SLIGHT BUMP
- SOLDER COIN CELL CLIP ACCORDING TO OUTLINE ON BACK OF PCB
- ATTACH POWER SWITCH ONTO BACK OF PCB
- INSERT FLASHING LEDs INTO FRONT OF PCB WITH SHORT PIN CLOSEST TO THE FLAT SIDE OF THE LED OUTLINE ON THE PCB
- SOLDER LEDs
- WHILE WEARING SAFETY GLASSES, TRIM PINS FLUSH TO PCB
- INSERT COIN CELL
- CELEBRATE RAINBOW LED CYCLING SUCCESS
- ATTACH USING BEAD CHAIN
Step 3: Digispark Pro
The Digispark Pro uses the ATtiny167 microcontroller (datasheet), a nice upgrade from the ATtiny85 on the original Digispark.
The Digispark Pro can be programmed directly from USB without needing another Arduino or programmer module. USB code runs directly on the ATtiny167.
Compared to the original Digispark, the Pro is faster (16Mhz vs. 8Mhz), has more storage, and has several more I/O pins.
The Digispark Pro was originally introduced through a Kickstarter project.
Step 4: Programming the Digispark Pro
Before even soldering the pins onto the Digispark Pro, configure everything needed to program it and load example code to blink the onboard LED. This is an important confidence building step for working with the Digispark Pro and it's fun!
The information on the official Digistump Wiki walks us through installing the Arduino IDE (if not already installed), configuring the IDE for use with ATtiny167, and then loading our first program.
As usual, play around with modifying the timing (milliseconds) in the delay() function calls and then reflash the Digispark Pro to see that your code modifications are being stored and executed on the microcontroller.
Pay particular attention to the notes under the "Troubleshooting" heading. The Digispark's USB interface without using a hardware USB chip is a bit of a hack (a brilliant one though) so establishing the USB connection sometimes requires a few retries, a different cable, or other fiddling around as suggested in the Wiki.
In some setups, the Digispark Pro, while connected to a PC, stays in its bootloader and does not execute the user program. Powering the Digispark Pro from a power bank, a USB wall wart, or some other power supply once it is programmed is generally the perfect resolution.
Step 5: NORDIC NRF24L01 Radio Transceiver
The nRF24L01 is a single chip radio transceiver for the world wide 2.4 - 2.5 GHz ISM band. The transceiver consists of a fully integrated frequency synthesizer, a power amplifier, a crystal oscillator, a demodulator, modulator and an enhanced protocol engine. Output power, frequency channels, and protocol setup are easily programmable through a SPI interface. Current consumption is only 9.0mA at an output power of -6dBm and 12.3mA in RX mode. Built-in Power Down and Standby modes support power reduction. (datasheet)
Step 6: Configure DigiProNRF Nodes
The exclusive DigiProNRF circuit board supports interconnection of a Digispark Pro module and an nRF24L01 module. The DigiProNRF circuit board also supports a 3.3V filtered regulator to power the nRF24 and provides one row of broken out Digispark Pro pins for easy access to power lines and I/O signals.
From the schematic diagram, note which nRF24 Module pins connect to which Digispark pins. These pin assignments are used in the attached example code.
Solder up two DigiProNRF nodes to experiment with point-to-point communications between the nodes.
DO NOT POPULATE the three "center header pins" at the bottom of the Digispark Pro. Instead, use the extra header pins for the row of breakout pins next to the Digispark Pro. The three "center header pins" can be connected without causing any problems (they are not wired to anything in the PCB) but the header is better used for the breakout than wasted on three unused Digispark holes.
Program the two DigiProNRF nodes with the attached demo sketches (one for TX and one for RX). The onboard Pin1 LED (near the center of the Digispark Pro) on each board will slowly blink when the radio connection is successful. The LED will stay on solid when the radio connection is broken. For example, if the other node is powered down.
FYI, this demo is based on the Pro nRF24L01+ Shield tutorial.
Check out the related nRF Mesh Network Example for connecting three or more nodes.
Step 7: Wireless Remote Control Servo Motors
The nRF radio link is used in this example to send a position setting to a remote servo motor. The two attached demo sketches can be used on two DigiProNRF nodes wired to a potentiometer and a servo motor as shown.
Note the use of a separate power supply for the servo motor. Connecting the servo motor and the receiving DigiProNRF to the same supply can couple enough noise into the nRF radio circuitry to impact the wireless communications link.
The Arduino Servo Library allows an Arduino board to control readily available hobbyist servo motors. Servos have integrated gears and a shaft that can be precisely controlled using pulse width modulation (PWM). Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees.
Step 8: Passive Infrared Motion Sensor
A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view. They are most often used in PIR-based motion detectors. PIR sensors are commonly used in security alarms and automatic lighting applications. (wikipedia)
This tutorial explains how PIR sensors works and provides a detailed example using a PIR sensor an Arduino project to detect motion.
Combine a PIR sensor with two or more nRF24L01 radio modules to remotely detect motion. Perhaps you could set up a remote wireless notification when your mail carrier opens your mailbox to deliver your HackerBox?
Step 9: Regular Expressions
A Regular Expression (regex) is a sequence of characters that define a search pattern. Usually such patterns are used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory. The concept arose in the 1950s when the American mathematician Stephen Cole Kleene formalized the description of a regular language. The concept came into common use with Unix text-processing utilities. (wikipedia)
Work through these fun introduction exercises to learn the basics of regular expressions. You will be surprised how much they can come in handy.
The image here is from a more advanced RegEx Presentation from Peter Thoeny, which includes an interesting crossword puzzle challenge.
Step 10: Hack All the Things
We hope you have enjoyed 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 email@example.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.