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

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 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)

How the nRF24L01+ Wireless Module Works.

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 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

9 Discussions

0
None
eburman

16 days ago

I've found it difficult to get much traction with the nRF24L01 and Digispark Pro combo. I just can't get a clear understanding of how to code things with the RF24 system. Most of the good tutorials that I'm able to find use Arduino boards for the learning examples and also use the Arduino IDE serial monitor to communicate and debug. The Digispark Pro doesn't allow direct hardware serial communication with the arduino IDE. I've tried using the DigiCDC library as a work around but I haven't been successful with that either. The DigiSpark shows up as a USBmodem but I've been unable to get it to send or receive data though the serial port. I wish that the DigiProNRF Circuit Boards had also included 4x2 headers so that the nRF24L01 could be plugged in rather than permanently soldered in place. That way I could have removed the nRF24L01 to use with arduino boards rather the more difficult to understand and under-documented Digispark Pro combo. I'm setting this all aside for now. I've ordered some new nRF24L01's so that I can revisit all this later using a simpler and easier to understand system.

1 reply
1
None
HowardW29eburman

Reply 15 days ago

I have a bunch of single width jumper stock that came with some perfboard I bought on Amazon several months ago, and did exactly what you suggest with these. I'm just starting to play around with them, so I can't say how well it worked or not.

0
None
RichW36

16 days ago

So I did get this working. But I noticed a pretty sizable delay with the input,tx,rx, execute. I am looking for a way to bump up the resolution. Is it hardware or code exacution?

0
None
eburman

Tip 4 weeks ago

FYI Regarding BadgeBuddy. Such a simple project. Two LED's, a switch and a button battery holder.
What could go wrong?
Plenty!
What ever you do, don't follow the LED profiles as they are printed on the PCB.
Follow the written instructions exactly....
  • INSERT FLASHING LEDs INTO FRONT OF PCB WITH SHORT PIN CLOSEST TO THE FLAT SIDE OF THE LED OUTLINE ON THE PCB.
3 replies
0
None
HackerBoxeseburman

Reply 4 weeks ago

The "flat side" on the PCB silkscreen, the "flat side" on the LED, and the "short pin" should all be the same thing. It shouldn't matter which you use as the cathode indicator to align the part.
https://en.wikipedia.org/wiki/Light-emitting_diode#/media/File:LED,_5mm,_green_(en).svg

0
None
eburmanHackerBoxes

Reply 27 days ago

Oddly, that just seems not to be the case. I thought that maybe my perception of reality was clouded by my evening Tanqueray gin and tonic with extra lime. But today in a less befudddled state of mind, there is no doubt about it. According to the PCB I received, one side matches the flat side alignment of the LED and the other side most definitely does not. After perfecting my desoldering skills I finally got things up a blinking according to specs. Maybe a fluke LED?

0
None
eburmaneburman

Reply 26 days ago

So it turns out that it was an anomalous LED after all. Upon closer inspection, one of the two LED's provided in my Hackerbox was constructed so that the negative (cathode/anvil) side is positioned opposite to the flat side on the epoxy case. Sheesh! Just my luck! Why does this kind of stuff always happen to me? This says something about Chinese quality assurance. You get what you pay for. If I happened to get a backwards LED then probably some other folks got them as well. I'm amazed that this issue didn't come up at during your DEFCON soldering workshop. I hope that this Tip helps my HackerBoxes colleagues.

0
None
HowardW29

4 weeks ago on Step 3

I had the damndest time getting the code for the Digispark Pro to upload to the board. What ultimately worked for me was recompiling the micronucleus command line tool as suggested in the ARCH section of the Linux Troubleshooting page even though I'm on SuSE and not ARCH.