Introduction: HackerBoxes 0002: Stepping Up to ARM32, MCU Video, Wii Nunchuck
This Instructable shares the basics of working with HackerBoxes #0002. HackerBoxes is the monthly subscription box service for electronics hobbyists, makers, and hackers. If you would like to receive a box like this right to your mailbox each month, you can SUBSCRIBE HERE anytime. We hope subscribers to HackerBoxes will use this Instructable to make the most of their box contents.
Of course, this Instructable is for non-subscribers too. Box contents are presented in enough detail so that anyone can join in the fun with their own components and modules. Where possible, we include links to online merchants where the items may be purchased individually. Also, extra HackerBoxes (when available) may be purchased at the HackerBoxes web store.
Step 1: Box Contents
- ARM 32-bit Cortex-M4 STM32L476 Nucleo Board (buy from Amazon)
- TFT LCD Touchscreen Shield with micro SD Socket (buy from Amazon)
- Arduino DUO "Cool Version" (buy from Amazon)
- Wii Nunchuck Controller (buy from Amazon)
- USB A-B cable for Arduino UNO (buy from Amazon)
- USB A-miniB cable for STM32 (buy from Amazon)
- Dual RCA Pigtail
- Dupont cables F-F
- Small Signal Switching Diodes
- HD15 D-Sub (aka VGA) Connectors
- Resistors: ten each of 68,75,470, 1K, and 2K OHM
- Fone Phreak Auto Decal
- Heat shrink tubing
- Single row headers
Step 2: The Story of 2600 Hz
2600 Hz is the frequency of a tone emitted by the Blue Box to reset a telco trunk line. The Blue Box was classic tool of telephone system hackers also known as Phreakers.
Enjoy the video on this page to learn about the phone phreaking exploits of Steve Wozniak and Steve Jobs before they went on to found Apple Computer. Here is another entertaining video. Sport your 2600 sticker with pride for the thus far short, but rich, history of the hacker culture. Worse case, people will just think that you ran one hundred marathons. :)
Step 3: ARM 32-bit Cortex-M4 Nucelo Development Board
Disguised as a mere Arduino, this computer board is a BEAST:
- ARM 32-bit Cortex-M4 Processor
- 1MB Flash Memory supporting zero-wait-state execution
- Operating Frequency up to 80 MHz
- Floating Point Unit with DSP Instructions
- Arduino Compatible Pin Headers
Get started with the documentation and tools available here.
Video for Learning Embedded Design on ARM micros.
Video for Learning DSP on ARM micros.
“RISC architecture is gonna change everything. Yeah. RISC is good.”
-Hackers (The Movie) 1995
Step 4: LCD Shield
- 2.4″ diagonal LCD TFT display
- 240×320 resolution
- 18-bit (262,000) color
- SPFD5408 controller or ILI9341 controller
- 8 bit digital interface + 4 control lines
- Onboard 3.3V 300mA LDO regulator
- (5V interface compatible)
- Four white LED backlight
- Four-wire resistive touchscreen
- MicroSD slot
Here is the datasheet for the SPFD5408 driver chip. This GitHub repository has an excellent library and plenty of demo code to explore the shield form the Arduino UNO.
Here is the datasheet for the ILI9341 driver chip. This forum has some detailed information on using displays featuring the ILI9341.
This particular UNO is called the "cool version" because of its colorful connectors. Note that these Arduino modules have the new CH340/CH341 serial driver chip instead of the traditional FTDI serial chip. A driver (available for OS X, Windows, and Linux) for the CH34x chip generally needs to be installed on your computer for the Arduino IDE to communicate to these boards. Here is a video on the topic.
Step 5: Video Output Options
The LCD shield is a great way to display output directly from your microcontroller projects, but sometimes it is nice to be able to drive a regular display such as a television set or a computer monitor.
The current preferred video interface is of course HDMI, which is available on certain higher end microntroller platforms such as the Raspberry Pi and BeagleBone Black. Driving the HDMI bus generally requires a dedicated memory and video driver. It isn't really possible (or at least not reasonable) to bit bang HDMI from a basic micro.
Alas, composite video and possibly VGA are the best bet when trying to drive video from a simple microcontroller such as the Arduino UNO.
Step 6: Composite Video
Using a couple of RCA pigtails, three resistors, and some heat shrink tubing, we can make a composite video (with audio) cable to use with almost any microcontroller platform. It can be very useful to "connectorize" modules, devices, and cables by soldering half of a Dupont cable onto each terminal. You can finish each connection with a very narrow piece of shrink tubing and then finish the entire thing with one larger piece of tubing. It looks very neat and provides for a strain relief.
For the cable in the pictures, a label was printed with the signal names (use about 6 point font) and cut with an exacto knife to label each tiny Dupont connector. If you use female connectors you can gender-bend them with a pin from a SIP header (or a piece of hookup wire) to create a connector that works on F or M interface blocks.
Once the cable is made, test out the video output using the TVout Arduino Library.
The Hackvision project is a very cool retro gaming system using the TVout library. Once you test out the Wii Nuncheck controller, give it a shot with Hackvision.
Step 7: VGA Video
This tutorial covers basic VGA generation from an Arduino using the schematic shown here. The parts are included to make this basic VGA interface. Consider using some of the shrink tubing as shown to make a nice connectorized cable as we did for the composite video cable.
Here is a slightly better VGA example for which the parts are also included. Lastly, here is a 64 color VGA output example.
Step 8: Wii Nunchuck
The Wii Nunchuck controller (WiiChuck) includes a Joystick, Two Buttons, and a 3-axis Accelerometer interfaced over a simple I2C serial bus.
The image here shows how to prep the WiiChuck cable into Dupont connectors as we did for the composite video cable. You can just unscrew the connector and pull it off. There is no magic to the assigned wire colors (they may vary) but the controller that we've opened from this batch used these wire colors:
- Pin 1 (PWR): Red
- Pin 2 (SLC): Green
- Pin 3 (DET): Black (connected to PWR in controller)
- Pin 4 (NC):
- Pin 5 (SDA): Blue
- Pin 6 (GND): White
Some suggest using two 2K resistors to pull-up SDA and SLC to PWR.
Here is a library for using the Wiichuck with an Arduino. Note that aftermarket off-brand Wiichucks need to be initialized differently than the original OEM Wiichucks. This library handles the initialization properly for both types.
Wikipedia has a nice entry for the I2C serial interface.
Step 9: Hack the Planet!
If you enjoyed this Instrucable and you would like to have a box like this delivered to your house each month, please SUBSCRIBE HERE.
Can you get some video output modes going on the Arduino DUO? Did you bring up the Hackvision retro gaming system? With Wii Nunchuck? Please share your success (below or on the HackerBox Facebook page) or certainly let us know if you have any questions.
Who can post the first example of overcoming the inherent video limitations of the Arduino by leveraging the horsepower of the STM32 for gaming or otherwise?
Thank you for being part of the HackerBox adventure. Please keep your suggestions and feedback coming. HackerBoxes are your boxes. Let's make something great!
7 years ago
I´m wondering how to connect display and nunchuck at the same time with the Arduino. Ports are blocked with shield...
And I don´t understand for what the nucleoshield is usefull. Why combine it with Arduino, when it can be a standalone?
7 years ago
The tft LCD is working on the arduino uno. I used the library at http://forum.banggood.com/forum-topic-95414.html. Adafruit also has a large collection of libraries and examples for the ILI9341 display controller. Next step: get the tft LCD working on the ARM32.
Reply 7 years ago
Thank you for the clarification. We updated this information into the instructions!
7 years ago
Anyone have success with the wii nunchuck? Things appear to be partially working. `nunchuck_get_data()` returns 1, but all data is 0xFF.
Reply 7 years ago
Phillip - The nunchucks included in the HB do work (assuming everyone received the same "GOOIRC" brand in their HB), but they need to be initialized differently than OEM nunchucks - check this link out:
Also, there is another library other than the one listed in the instructions that does most of the heavy lifting for you with the off brand nunchucks - see link:
As for the actual wiring, I used the following on the UNO board included with the HB kit:
Black > 3.3V Power
White > Ground
Green (SLC) > A5
Blue (SDA) > A4
My 'chucks are happily sending out good numbers to the serial monitor right next to me on my workbench as I type this - hope it works for you too!
Maybe HB will update their instructions?
Reply 7 years ago
Thank you for the clarification. We have updated this information into the instructions!
7 years ago
My box didn't have the USB A-miniB cable included.
No problem as I have plenty lying around so please don't send another one. But if others pack up the boxes for you it's probably good to know.
7 years ago
To get started with the ARM32 board follow this intractable: https://www.instructables.com/id/Arm-Mbed-Microcont...
Even though it is a different board the instructions work.
To see printf output install a terminal program (Minicom for 'coz or putty for windows) and connect to the serial/USB port with 9600/8/n/1.
I have not gotten the tft LCD screen to work. I get all white and nothing displays. I've tried both Arduino and ARM32 examples.
7 years ago
I'm looking forward to seeing what you had in mind for this box! I've been poking at the Nucleo a little bit. A couple of things that I've learned:
1. This board (L476) is not yet supported by yotta.
1.1 This is too bad because I think yotta looks like a super nice way for hackers to write uC code. Much better than arduino IDE.
2. The Olde Schoole IDE at https://developer.mbed.org/compiler/#nav:/; works very well.
3. To upload the code to the board, you really do just copy it to the mass storage that appears when you plug it in! So weird! The board detects an appropriately compiled .bin file, resets, and runs the code. I tried with some bins that were compiled for the wrong board while chasing the yotta-rabbit and it just ignores the file and does nothing if it is not compiled for the correct board.
4. No drivers needed in OS X.
5. Once you have the board mounted, open $MOUNT_POINT/MBED.HTM in a browser to get your account set up and get the board added to your account. This is required for yotta to pull packages (once the board is supported) as well as to use the IDE. I think. Anyway, that is what worked for me.
6. In the Olde Schoole mbed IDE mentioned in #2, there are several nice examples that you can compile and load for an immediate smoke-test of the toolchain.
Thanks for putting the box together, and I'm looking forward to seeing what you had planned :)