HackerBox 0045: Spark Net

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)

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

  • Battery Powered Contest

    Battery Powered Contest
  • Plywood Challenge

    Plywood Challenge
  • Plastic Contest

    Plastic Contest

15 Discussions

0
lmperkins
lmperkins

Question 11 months ago on Step 6

I've successfully (I think) got both boards programmed. When I disconnect the USB and power up both boards with 5 volts (via Vcc) I get a steady red light from each of the LEDs. The transistor on the custom PCB gets very hot on the TX board after a short period of time. I never get the slow blink described in the instructions. Any suggestions would be appreciated.

0
lmperkins
lmperkins

Answer 11 months ago

I heard from hackerbox support that the units might be too close together and that was indeed the problem. A lot of frustration solved by a very un-intuitive trick.

0
lmperkins
lmperkins

Answer 11 months ago

So I tried building the third module to replace the one with the very hot transistor and nothing changed. They both sit there with solid red LEDs. Not sure what I should try now.

0
HowardW29
HowardW29

1 year 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.

0
d4e5
d4e5

Reply 1 year ago

You can ignore my request... I got the same pain, and fixed it too. I posted details.

0
d4e5
d4e5

Reply 1 year ago

Hi there... I am struggling on Linux, cannot really figure out the path where to put the digistump stuff... any chance you can share the content of your ArduinoXXXX/hardware and ArduinoXXXX/hardware/tools
Thanks!

0
d4e5
d4e5

Tip 1 year ago

Making the digistump stuff work on Linux (Kali in my case) was painfull... so I thought I share. You basically have to rebuild the micronucleus.
Context: I am running Kali, Arduino 1.8.7., so I run everything as root, you might have to sudo some comments if you are on regular Debian or other Linux.
Arduino is located at /root/Software/arduino-1.8.7

For some reason, when I installed the stuff in arduino, the micronecleus executable ended-up been installed at /root/.arduino15/packages/digistump/tools/micronucleus/micronucleus/2.0a4 No idea why, I had to get $ cd / and $ find . -name "micronucleus" to find it. By the way, it does not seems to be 2.0a4 version, if you run $ ./micronucleus --help you do notget a version number at the end.

Anyway, get to a temporary folder and get the git:
$ git clone https://github.com/micronucleus/micronucleus.git
$ cd micronucleaus/commandline

if you try $ make, it will crash because it cannot find "usb.h", you have to get the usb stuff:
$ apt-get install libusb-dev

Now you can:
$ make

Try it:
$ ./micronucleus --help
you get:
--------------------
usage: micronucleus [--help] [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--timeout integer] [--no-ansi] (--erase-only | filename)

--type [intel-hex, raw]: Set upload file type to either intel hex or raw
bytes (intel hex is default)
--dump-progress: Output progress data in computer-friendly form
for driving GUIs
--erase-only: Erase the device without programming. Fills the
program memory with 0xFFFF. Any files are ignored.
--fast-mode: Speed up the timing of micronucleus. Do not use if
you encounter USB errors.
--run: Ask bootloader to run the program when finished
uploading provided program
--no-ansi: Don't use ANSI in terminal output
--timeout [integer]: Timeout after waiting specified number of seconds
filename: Path to intel hex or raw data file to upload,
or "-" to read from stdin

Commandline tool version: 2.04
-------
Notice the last line (version 2.04).

Now, move the executable to the right folder:
$ cp ./micronucleus /root/.arduino15/packages/digistump/tools/micronucleus/2.0a4

Now you can launch Arduino, plug in the board, and go Sketch>Upload.

What a pain! I need a drink :-) now!!

0
eburman
eburman

1 year 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
HowardW29
HowardW29

Reply 1 year 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
RichW36
RichW36

1 year 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
eburman
eburman

Tip 1 year 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.
0
HackerBoxes
HackerBoxes

Reply 1 year 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
eburman
eburman

Reply 1 year 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
eburman
eburman

Reply 1 year 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.