Introduction: HackerBox 0041: CircuitPython
Greetings to HackerBox Hackers around the world. HackerBox 0041 brings us CircuitPython, MakeCode Arcade, the Atari Punk Console, and much more. This Instructable contains information for getting started with HackerBox 0041, 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!
Topics and Learning Objectives for HackerBox 0041:
- Exploring the SAMD51 ARM Cortex M4
- Embedded programming with CircuitPython
- Retro game design for MakeCode Arcade
- Assembling the Atari Punk Console Synth
HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. We are the dreamers of dreams.
HACK THE PLANET
Step 1: Content List for HackerBox 0041
- Adafruit ItsyBitsy M4 Express
- Exclusive MakeCode Arcade PCB
- Exclusive Atari Punk Console PCB
- Two Electronic Component Packs
- Color Display 128x160 Pixel TFT
- CR2032 Coin Cell Five Pack
- RGB 12 LED Ring Module
- SG90 Micro Servo Motor
- 400 Point Clear Breadboard
- DuPont Jumper Wires Male-Male
- Braided MicroUSB Cable
- Exclusive Circuit Python Decal
- Exclusive HackerBox Maker Decal
- Exclusive HackerBox 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: Electronic Component Packs
Familiarize yourself with the components shown here. Note the suggested allocation of these components according to the color coded blocks.
HackerBox 0041 includes these components packed in two resealable poly bags. Please note the components are only separated into two bags for ease of packaging and there is no meaning to the placement of the components into one or the other of the two bags.
Step 3: Adafruit ItsyBitsy M4 Express
The Adafruit ItsyBitsy M4 Express features the Microchip ATSAMD51 ARM Cortex M4 (datasheet) processor running at 120 MHz. The microcontroller has floating point support, 512KB Flash, and 192KB RAM.
While the ItsyBitsy M4 can be used with the Arduino IDE, it ships with CircuitPython on board. When you plug it in, it will show up as a small disk drive with main.py on it. Edit main.py with your favorite text editor to build your project using Python, the most popular programming language. No installs, IDE or compiler needed, so you can use it on any computer, even ChromeBooks or computers you can't install software on.
Step 4: CircuitPython
CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards. CircuitPython is an open source derivative of the MicroPython programming language. It is a software implementation of the Python 3 programming language and has been ported to run on several modern microcontrollers. (see Wikipedia)
The Adafruit Welcome to CircuitPython page is the best starting point.
The solderless breadboard, jumper wires, and various other items from HackerBox 0041 are useful while working through to the Adafruit CircuitPython Essentials demo experiments.
Step 5: MakeCode Arcade
MakeCode Arcade is a web-based, beginner-friendly platform for creating retro arcade games for the web and for microcontrollers. Using the exclusive HackerBox MakeCode Arcade PCB, the Adafruit ItsyBitsy M4 Express, a color TFT display, and seven pushbuttons, you can assemble your own handheld MakeCode Arcade platform.
ASSEMBLY NOTES: Start with the PCB side including the text "ItsyBitsy" in the silkscreen facing up. All of the components go on this side of the PCB. There is a piezo buzzer in the PCB design wired to the ItsyBitsy. However, support for that output doesn't appear to be implemented in the Arcade code yet, so soldering the buzzer on is optional at this time. The 40pin female header can be broken down into two 14 pin sections to create a "socket" for the ItsyBitsy. Socketing the ItsyBitsy supports popping the module on and off of the Arcade PCB and the solderless breadboard as necessary for various projects. Of course, if you end up using both platforms for the ItsyBitsy with much frequency, you might want to pick up another ItsyBitsy and solder it directly to the Arcade PCB.
PROGRAMMING: See the details on MakeCode Arcade for the SAMD51.
Step 6: Battery Power for the MakeCode Arcade PCB
By default, the MakeCode Arcade PCB is powered through the microUSB port on the ItsyBitsy. USB power can be provided by a computer USB port, a wall wart, etc.
For a portable Arcade platform, the USB port can be powered using a USB power bank. Optionally, a clean solution for integrating LiPo battery power is the Adafruit LiIon/LiPoly Backpack shown in the photo. This backpack can be combined with a LiPo Battery and optionally an on/off button. Note from the photo that the LiPo Backpack can be neatly positioned on the backside of the arcade PCB. It helps to leave the relevant three pins of the ItsyBitsy if you plan to trim the other pins off after soldering.
Step 7: Atari Punk Console Badge
The Atari Punk Console is a popular circuit that utilizes two 555 timer ICs or a single 556 dual timer IC. The original circuit was published in a Radio Shack booklet in 1980. Its designer, Forrest M. Mims III, called the circuit a "Stepped Tone Generator" in his booklet "Engineer's Mini-Notebook - 555 Circuits".
The circuit is often called the "Atari Punk Console" because its "low-fi" sounds resemble classic Atari console games from the 1980s, with a square wave output similar to the Atari 2600. Technically it is an astable square wave oscillator driving a monostable oscillator that creates a single (square) pulse.
ASSEMBLY NOTES:
- Two coin cell clips go on the back of the board
- All other components go on the front of the board
- Tin all three pads for each clip to ensure good contact with the coin cell
- A 1K resistor R2 is located just below the IC
- The DIP switches control power to the oscillators and the LEDs separately
- C1 and C2 are 0.1uF Caps
- C3 is a 10uF Cap
- For all three caps, mind the polarity marking on the board by placing the longer pin towards the + mark
- For the clear, self-flashing LEDs the shorter pin goes in the hole near the flat edge of the board circle
- There is a + mark on the PCB for the speaker
- The IC (and its socket) should be oriented according to the half-circle marking on the board
- Solder the IC socket without the chip in and then put the IC in the socket once cool
- The 1Mohm potentiometers are marked "B105" on the bottom. In some versions of the parts kit, 500Kohm potentiometers are provided instead. These are marked "B504".
- The 5Kohm potentiometer is marked "B502". In some versions of the parts kit, a 1Kohm potentiometer is provided instead. It is marked "B102".
Wikipedia Atari Punk Console Page
Jameco Electronics Atari Punk Console Page
Step 8: Livin' the HackLife
We hope you have enjoyed this month's voyage into DIY electronics. Reach out and share your success in the comments below or on the HackerBoxes Facebook Group. Certainly let us know if you have any questions or need some help with anything.
Join the revolution. Live the HackLife. You can get a cool box of hackable electronics and computer tech projects delivered right to your mailbox each month. Just surf over to HackerBoxes.com and subscribe to the monthly HackerBox service.
45 Comments
Question 4 years ago
I'm brand new to circuit boards and finding the instructions are not getting me through, including the instructables site. I'm not sure where certain pieces (and their proper names) go. Is there a more detailed guide, preferably a video, that walks me through more in depth?
Answer 4 years ago
I sounds like you are starting out at ground level. Where are you getting stuck? Soldering? Identifying the parts? The kits are very simple and are good for beginners. I'd be happy to help but I don't know where you are getting stuck. Also, there is just tons of information available on the internet. Really just dive right in and hope for the best. You may be surprised when it all comes together and works!
4 years ago
Here's a video of me playing around with my atari punk console.
Notice how I don't have to move the two left dials very far to get variances in the sound? Is that normal or does it seems like I have an issue somewhere?
https://drive.google.com/file/d/1b-Up5SbHzGbhRMFqswqAcTm312wMyLob/view?usp=sharing
4 years ago
I'm getting a white screen when I fire up the arcade. I've checked my connections and have the bootloader and everything so I decided to breadboard the itsy bitsy and TFT. It still comes up with a white screen. Here's how it's wired, can someone confirm the connection are correct? Otherwise I'll just order another TFT.
Reply 4 years ago
I got a white screen too. Then I connected the usb to my computer, copied the appropriate bootloader file into the device, double clicked the restart button, and whammo, it worked.
Reply 4 years ago
where did you download the file you needed to get the image on the screen. All im getting is a white screen. I put the M4 in to bootloader mode and downloaded the ( adafruit-circuitpython-itsybitsy_m4_express-3.1.2.uf2 ) and copied it to the ITSYM4Boot drive. Is there any help you can give to get me on my way thanks.
Reply 4 years ago
The circuitpython firmware won't display anything to the screen on it's own. you'd have to find or write some python code to drive it, or you could use the MakeCodeArcade bootloader from step 5.
The bottom of step 5 has a link to their docs, page 2 - 'Bootloader' has the .uf2 file you want (the itsybitsy one, not the feather one). Double-click reset on the board to put it into a different programming mode (it'll show up as 'ITSYM4BOOT' instead of 'CIRCUITPY'), then copy that .uf2 file over to the removable disk. It'll reboot itself when that's done, and you should see an image on the screen.
If you want to go back to circuitpyhthon afterward, you can do basically the same thing, but with the .uf2 file from 'Welcome to Circuitpython' link in step 4 (page 5 - 'Installing Circuitpython') except that double-clicking reset will take you back to the MakeCodeArcade bootloader from now on, and either the circuitpython uf2 or the game ones from MakeCodeArcade will work.
Here's more on the uf2 bootloader (and the origninal if you _really_ want to go back to factory - or at least how mine shipped) https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/uf2-bootloader-details
Reply 4 years ago
When I try to copy the arcade.uf2 (3.2.2) file to the itsybitsy M4 (when in bootloader mode), I get an error that there is not enough filespace. The error takes a while to calculate free space and then times out not enough file space. Has ayone ran into this and what did you do to resolve it? I am running windows 10.
Reply 4 years ago
Really interesting. I'm having this same problem. Hopefully the same solution will work for me!
Reply 4 years ago
Me too. I wired up a similar display I had laying around and that worked as expected (mirror image, small picture, all wrong but at least it was the D51 image and not white, lol). A new display arrives tomorrow from Amazon so we'll see what's what.
Reply 4 years ago
I'm getting a white screen too and the soldering is good, double checked it. Dragging a file to the boot drive after a while of calculating indicates the file is too large for the drive. The atari circuit was an easy one, I've got several of those old books and cookbooks.
*I can copy .py files to the M4 and it works, that tells me its a coding problem. the UF2 file will not execute nor copy for me.
Reply 4 years ago
So for me, I tried it on a breadboard, and it worked fine though cables were jiggly. But it was fine. But very intermittent. The SPI signal is very sensitive. A slight jiggle or loss of connectivity and your screen display is gone. A reboot fixed it, but then it was still intermittent. I chalked it up to using jumpers. So I finally soldiered it to the PCB and I just get a white screen. I checked all the solider joints, and everything is fine. <scratching my head>
Reply 4 years ago
Update. I was able to get it to work, after painstakingly redoing all the joints on the Itsy. Works great now. No sound though. Anyone else get sound?
Reply 4 years ago
There was a note in the instructions mentioning that sound was not yet implemented in the code just yet. Hopefully soon in the future.
Reply 4 years ago
Dragon I tried your breadboard layout and was able to finally see bootloader screen and load a game. I tried putting it on the supplied blue board, but just get white screen. Soldered the 16 pin male connectors to the itsybitsy after removing 2 on both sides. Not sure how the female 40 pins are supposed to be used for this.
Reply 4 years ago
I am on the same point. Just have a white screen. I am going to clean the flux from soldering , but I dont think this is the problem . Should have at least got a boot screen. I am also wondering why there is 2 sets of holes for the header?
4 years ago
Here is a video of the Neopixel ring on the ItsyBitsy M4 running CircuitPython.
http://tinyurl.com/y4wfgyuf
Reply 4 years ago
Hey there, can you post the Python code for that? I tried to no avail using the neopixel_write module. I hooked up D7 on the board to D0. GND, and 3V to the respective connections on the ring. New to Circuit Python. Thanks for the help, in advance!
Reply 4 years ago
Sure here is a link you should be able to access. There is the code for the one in the video and another one where you use a potentiometer with the ring to act like a level meter. I will post some schematics soon.
https://tinyurl.com/yxgje5rw
With this code, you want to connect DI on the ring to A1 on the ItsyBitsy board.
Reply 4 years ago
One other thing to note on the Neopixel Ring, You can daisy chain them, so DO = Digital Out and DI - Digital In.