Introduction: HackerBox 0060: Playground

Greetings to HackerBox Hackers around the world!

With HackerBox 0060 you will experiment with the Adafruit Circuit Playground Bluefruit featuring a powerful Nordic Semiconductor nRF52840 ARM Cortex M4 microcontroller. Explore embedded programming with CircuitPython, Arduino, ARM GCC, and more. Control embedded programs from mobile devices over Bluetooth Low Energy (BLE) channels. Use the Playground Ghost PCB to breadboard with the Circuit Playground Bluefruit. Understand and implement voltage divider circuits, class D audio amplifiers, full color LCD displays, and extra storage using both SD memory cards and serial flash chips.

HackerBoxes is the monthly subscription box service for enthusiasts of electronics and computer technology - Hardware Hackers - The Dreamers of Dreams.

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.

Supplies

This Instructable contains information for getting started with HackerBox 0060. The full box contents are listed on the product page for HackerBox 0060 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month with a $15 discount, you can subscribe at HackerBoxes.com and join the revolution!

A soldering iron, solder, and basic soldering tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Deluxe Starter Workshop for a set of basic tools and a wide array of introductory activities and experiments.

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.

Step 1: Elite Cyber Security Patch

Our exclusive, tactical-style PVC (polyvinyl chloride) patches are tough but flexible. They are waterproof and can withstand a wide range of temperatures, making them ideal for harsh outdoor conditions or elite online use.

INSTALLATION:

The preferred method of attachment to fabrics is it to use the "sewing channel" around the outer edge of the patch to sew the patch into place.

There is an iron-on mount pre-applied to the rear of the patch, although ironing should not be the first choice for attachment. Remove the protective paper sheet, position the patch, and heat through the fabric FROM THE REAR of the patch. Be extremely cautious to avoid melting the patch itself.

For non-fabric surfaces, remove the protective paper sheet and mount the emblem with double-sided tape or an appropriate adhesive.

Step 2: Adafruit Circuit Playground Bluefruit

The Circuit Playground Bluefruit from our brilliant friends at Adafruit is an amazing integrated platform for exploring electronics and programming. It's round and has alligator-clip pads around the outer edge for making connections in a variety of methods. It can be powered from USB, a AAA battery pack, or with a LiPo battery. The Circuit Playground Bluefruit has built-in USB support and it can be used with Arduino sketch and CircuitPython programming tools among others.

The main chip is a Nordic Semiconductor nRF52840 Microcontroller which is built around a 32-bit ARM Cortex M4 CPU core running at 64 MHz and supporting floating point operations. The nRF52840 has protocol support for Bluetooth 5, Bluetooth mesh, Thread, Zigbee, 802.15.4, ANT and 2.4 GHz proprietary stacks. It has NFC-A Tag for use in simplified pairing and payment solutions. The ARM TrustZone CryptoCell cryptographic unit is included on-chip and brings an extensive range of cryptographic options that execute with high efficiency and independently from the CPU.

Baked in to each Circuit Playground Bluefruit you will find:

  • 1 x nRF52840 Cortex M4 processor with Bluetooth Low Energy support
  • 10 x mini NeoPixels, each one can display any color
  • 1 x Motion sensor (LIS3DH triple-axis accelerometer with tap detection, free-fall detection)
  • 1 x Temperature sensor (thermistor)
  • 1 x Light sensor (phototransistor). Can also act as a color sensor and pulse sensor.
  • 1 x Sound sensor (MEMS microphone)
  • 1 x Mini speaker with class D amplifier (7.5mm magnetic speaker/buzzer)
  • 2 x Push buttons, labeled A and B
  • 1 x Slide switch
  • 8 x alligator-clip friendly input/output pins
  • Includes I2C, UART, 6 pins that can do analog inputs, multiple PWM outputs
  • Green "ON" LED so you know its powered
  • Red "#13" LED for basic blinking
  • Reset button
  • 2 MB of SPI Flash storage, used primarily with CircuitPython to store code and libraries.
  • MicroUSB port for programming and debugging
  • USB port can act like serial port, keyboard, mouse, joystick or MIDI

GET STARTED:

Power up the Circuit Playground Bluefruit using a standard MicroUSB cable and click over to the Adafruit Documentation to learn more.

Step 3: Circuit Python

CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards. It makes getting started easier than ever with no upfront desktop downloads needed. Once you get your board set up, open any text editor, and get started editing code. It's that simple.

Follow these quick steps to install CircuitPython onto the Circuit Playground Bluefruit.

Thanks to all the features baked into the Circuit Playground Bluefruit and the power of CircuitPython, we can now do a number of cool experiments right out of the box. Here are just a few examples:

Controlling Onboard NeoPixel RGB LEDs

Measure Temperature and Log it to Flash

HID Control for Keyboard and Mouse Injection

Interface with Mobile Devices over Bluetooth

Step 4: Breadboard Friendly Playground Ghost

The Playground Ghost is a fun way to use a Circuit Playground with a solderless breadboard for connecting to traditional modules and breadboarded circuits. As a "bolt on" interface, the Circuit Playground can be easily attached, removed, and reattached to the Playground Ghost. This allows flexibility for mounting onto other "bolt on" boards like the Adafruit TFT Gizmo or Adafruit Proto Gizmo and also for unmounting to use with alligator clips, etc.

Step 5: Assemble the Playground Ghost

Broaching Nuts

Broaching nuts are used to permanently attached a strong threaded fastener into non-ductile materials (such as printed circuit boards). One side of the nut incorporates a cutting face. When the nut is pressure fit against and into a plated PCB hole, the cutting face binds into the plating within the walls of the hole. This interface provides both a mechanical and electrical connection to the plating and any attached PCB traces.

Two Methods for Using the Broaching Nuts

METHOD A

The first method for mounting the Circuit Playground onto the Playground Ghost is the quick and easy method. We suggest going this route, at least for the first time. In this method, simply turn the biting face of the broaching nuts outward so that the nuts are simply used as traditional (non-broaching) nuts. Putting the nut on the blue side (Circuit Playground side) of the two PCBs reduces the risk of the screw head shorting or damaging any components on the Circuit Playground since the nuts are slightly smaller than the head of the machine screws.

METHOD B

The second method for mounting the Circuit Playground onto the Playground Ghost uses the broaching nuts as intended - broached. Start by pressing each broaching nuts into the Playground Ghost on the side opposite from the PCB traces. The cutting face of the broaching nut actually cuts into the plating in the PCB hole, so it can take quite a bit of force. The best option is to use a vice or other weapon of mass crushing. Be sure to place some cardboard (or other scratch protection) between the trace side of the PCB and the vice surface.

PLEASE NOTE: Method B results in the head of the machine screw resting on the component side of the Circuit Playground and can be a very tight fit for the machine screws. The "washer head" tops of the supplied machine screws are oversized and can easily short or damage board components. If you happen to have M3 machine screws without "washer heads" you might want to use those instead. These might be just plain round head or pan head screws as shown in the image above. If you have a stash of screws for PC cases, you're probably in luck since M3 screws are pretty common for that application. Using an insulator under the screw head is another option, but do be careful.

Header Pins

Finally, solder the short side of the right angle headers into the Playground Ghost as shown. The right angle headers allow the ghost to stand up on, and truly haunt, the solderless breadboard.

Step 6: Playground Ghost on a Solderless Breadboard

Pop the Playground Ghost onto a solderless breadboard and wire up the trimmer potentiometer as shown here.

Check out the potentiometer tutorial from Adafruit which illustrates connecting a potentiometer to a Circuit Playground board. The tutorial also demonstrates reading and plotting the voltage output using a CircuitPython program.

This is a valuable exercise since the potentiometer is a special example of the very important voltage divider circuit. The operation of voltage dividers is integral to sensor interfacing, level shifting, and various other examples of electronic wizardry. Read more in this SparkFun Tutorial.

Step 7: Audio Amplifier and Speaker

The PAM8302A (datasheet) is a 2.5W Class-D mono audio amplifier offering high quality sound reproduction. The efficiency of the PAM8302A is much better than that of Class-AB cousins optimizing battery life for portable applications.

What exactly does Class-D mean? Well, power amplifier classes are letter symbols applied to different power amplifier types. The class gives a broad indication of an amplifier's characteristics and performance. The classes are related to the time period that the active amplifier device is passing current, expressed as a fraction of the period of a signal waveform applied to the input. A class A amplifier is conducting through all the period of the signal; Class B only for one-half the input period, class C for much less than half the input period. A Class D amplifier operates its output device in a switching manner; the fraction of the time that the device is conducting is adjusted so a pulse width modulation output is obtained from the stage. (wikipedia)

This project demonstrates using an amplified speaker with the Circuit Playground Bluefruit. Starting from this example, one could make variations to celebrate the holidays, a birthday party, or their favorite quidditch team. What Bluetooth controlled audio project can you come up with?

Step 8: LCD Display

The display module is based on the ST7789 chip using a SPI interface. The display itself is an IPS LCD measuring 1.54 inch with a resolution of 240x240 pixels and is capable of generating quite vivid color images.

You can start with this beautifully detailed example project to explore using the 240x240 ST7789 LCD with the Circuit Playground Bluefruit - all coded in CircuitPython.

Step 9: More Storage

When working with projects that present images or sound, we can always use more storage space. This is obviously also true for projects that collect and log data from a user or the environment.

A common solution is to leverage a MicroSD memory card using a SPI interface.

CircuitPython Library for SD Cards

Arduino Library for SD Cards

A more integrated solution is to use a serial flash chip like the GD25Q16 (datasheet). The 16 in the part number represents 16Mbits which is 2 MBytes. Of course, serial flash chips also come in various other sizes. This tutorial explains how to use serial flash chips with the Arduino SerialFlash Library.

Step 10: More RF

If you want to get down and dirty in the mud, check out some additional nRF52 resources:

Nordic Semiconductor NRF5 SDK

Video Demo of Nordic Semiconductor SDK

LOGITacker

Nordic Semiconductor nRF Sniffer

Adafruit's nRF52 Bootloader

Step 11: Livin' La Vida HaX0r

We hope you are enjoying this month's HackerBox adventure into electronics and computer technology. Reach out and share your success in the comments below or other social media. 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.