HackerBox 0060: Playground

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.

5 People Made This Project!

Recommendations

  • Cookie Speed Challenge

    Cookie Speed Challenge
  • Edible Art Challenge

    Edible Art Challenge
  • Made with Math Contest

    Made with Math Contest

23 Comments

0
anthonywylam
anthonywylam

11 months ago

Not really a fan of the Cuircutpython method. Nothing wring with it. It was just very disorienting to start getting some comfort and knowledge with arduino then have the next box pop out something unrelated. I don't know about anyone else but I have a 2/3 success rate with digispark/stump. I've gotten two bad digi's so far that were just bad boards so anyone else having issues don't feel down I think they are just a little unreliable especially if you need them to recognise in win32/64. I had to use one of the stumps from demonseed box to get this little monster going but I really dig the finished result. It's made me curious on how to change the music to the Halloween movie theme.

0
ArtsyEngineering
ArtsyEngineering

1 year ago

I can't seem to find a way to interface the sd / discrete memory with the Adafruit Circuit Playground Express. Can someone point me in the right direction for how you'd interface these given that the CPX doesn't (appear to) have broken out spi pins?

0
ArtsyEngineering
ArtsyEngineering

Reply 1 year ago

Oh wow, thank you so much!

I kept finding posts stating that you just couldn't use the SPI port on the CPX I just assumed all these people would have considered reassigning the pins, hahaha.

Do you find using circuit python via sd card works just fine? I'm curious about how the new read / write speeds effect the experience.

0
eric.hokanson
eric.hokanson

Reply 1 year ago

Yeah. The circuit Python example worked for me. Not sure about read/write speeds. Am planning to implement the temperature sensor logging to the sd to see how well that keeps up.

0
ajkelly2
ajkelly2

Reply 11 months ago

Anyone have any pictures or pinout diagrams to help with this?

0
eburman
eburman

Tip 12 months ago

TFT module not working? 1. Make sure you added the adafruit_st7789 file into your library folder on the Circuit Playground drive. The TFT will not run without the ST7789 driver installed. 2. Make certain that there is continuity between the CPX boad and the header pins on the ghost board. The nuts and bolts between the two boards are not perfect fits and I found that my module did not run because one of the bolted connections wasn't good. 3. Double/triple/quadruple check your wiring. I hope this help someone.

0
Taranach
Taranach

1 year ago

In a world where there are thousands of types of screws and a Hackerbox kit that is supposed to have "Everything You Need" aside from regular tools, I am extremely surprised that they chose to put in freaking washer-head screws that can damage the CPX rather than the *Right ones* or making us dig around for our own proper fitting ones that we might just have "lying around"... particularly when these screws cost fractions of a penny in bulk... right poor engineering/packaging planning... especially when it might damage the arguably most expensive component in the box... NOT a happy camper about that... I would have easily foregone the patch or the sticker to have the right hardware out of the box.

0
HackerBoxes
HackerBoxes

Reply 12 months ago

The guide for this box explains how to use the supplied hardware to avoid problems. Also, please let us know where are you quoting "Everything You Need" from so we can correct it. That's definitely never been part of our box design guidelines. We even try to list out additional things needed for each box and we point out that it is assumed members have on hand the sorts of things in the Starter Workshop. Since we would never say "Everything You Need", please let us know where read it, so we can correct it. If you didn't read it somewhere, please don't put it in quotes or falsely attribute it. Perhaps you're thinking about Blue Apron or one of the cooking boxes? Thanks.

0
TimGTech
TimGTech

Reply 1 year ago

These kinds of nuts are commonly used on PCB assemblies. Use the nuts on the CPX side. Screw heads go on the back side of the ghost board. Then all is right with the world. :)

0
fullyloaded
fullyloaded

1 year ago

I could not get the Circuit Python board to read the potentiometer correctly. The returned values kept bouncing around as if nothing was connected. I tried A1 as shown in the example then switch to A2. Still nothing. They bounced between 1024 and 752. Is anyone else having this problem? The NeoPixel startup with the default code looked great!

analog_example.png
0
lmperkins
lmperkins

Reply 1 year ago

Seems to be working fine for me although my potentiometer seems to have a bit of a glitch at the high end

pot trace.jpg
0
eburman
eburman

Reply 1 year ago

I get the glitches too. Seems to happen across the spectrum form low to high. They aren't bad. Fairly minimal considering the resolution but I wonder why it isn't more stable.

0
fullyloaded
fullyloaded

Reply 1 year ago

You have to put in all of the bolts and nuts so that the traces on the Circuit Playground board will transfer to the Ghost PCB. Otherwise the wires are not connected. DUH!

0
mrc0de
mrc0de

1 year ago

Hardware DIVsion?

0
Blun7
Blun7

Reply 1 year ago

You know those frst runs, with unntended mstakes, that become SUPER valuable? Ths s one of those! Be sure to keep t!

0
lmperkins
lmperkins

Reply 1 year ago

That's a feature, not a bug. ;-)

0
ArtsyEngineering
ArtsyEngineering

Tip 1 year ago

I made a Github repo to help people get started with the Circuit Playground Express and I'm going to try and include a bunch of code examples for simple stuff. I've included one so far that demonstrates most of the boards features and also has the external sd card reader working thanks to help from eric.hokanson!

I've also added an example of communication with a raspberry pi over bluetooth, although it will require some fiddling and knowing your way around the raspberry pi to make work.

https://github.com/jgoergen/CircuitPlaygroundExpressBluefruit_Demos

0
james.fiorito
james.fiorito

1 year ago

Thanks for making the main logic board removable. I'm still kicking myself for not using headers to attach the TTGO in the safe mode box.

0
lmperkins
lmperkins

1 year ago on Step 5

I would recommend against using the broaching nuts as intended (Method B). The holes in the PCB are very slightly off the holes of the CPX. With Method A there is enough slop that this isn't a problem. But if pressed into the PCB flush and even using a vise, the holes do not line up enough to use M3 screws. I hesitate to try enlarging the holes on the CPX for fear of messing up the traces. Not sure what to try now.