HackerBox 0063: Samadhi

Introduction: HackerBox 0063: Samadhi

Greetings to HackerBox Hackers around the world!

HackerBox 0063 features two different SAMD ARM Core Development Boards. The SAMD21-powered Adafruit QT Py and the SAMD51-powered Mini SAM M4 can both be programmed with either CircuitPython or using the Arduino IDE. Explore the ESP8266 Wemos D1 Mini to run code directly on its Tensilica RISC core or configure the ESP8266 as a communication peripheral to provide WiFi connectivity for another microcontroller. Also, study remote wireless keystroke injection attacks and experiment with virtual machine technology.

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 0063. The full box contents are listed on the product page for HackerBox 0063 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: Samadhi

Pondering a theme related to our two SAMD microcontrollers for this box...

The Mini SAM M4 Dev Board features the ATSAMD51G19
The Adafruit QT Py features the ATSAMD21E18

We can consider what SAM stands for:

  • SAM
  • Smart ARM MCU
  • Smart Advanced RISC Machine MCU
  • Smart Advanced RISC Machine Microcontroller Unit
  • Smart Advanced Reduced Instruction Set Computing Machine Microcontroller Unit

OK, well that's a mouthful - probably best to just leave it at SAM, or for a bit of thematic poetry, we could imagine that SAM is short for SAMADHI.

Derived from the root sam-a-dha, meaning "to collect" or "bring together", samadhi is often translated as "concentration" or "unification of mind". Samadhi is a state of profound and utterly absorptive contemplation of the Absolute that is undisturbed by desire, anger, or any other ego-generated thought or emotion. It is a state of joyful calm, or even of rapture and beatitude, in which one maintains full mental alertness and acuity.

Nice.

Step 2: Mini SAM M4 Development Board

The Mini SAM M4 Development Board is based on the Microchip SAMD51G 32-Bit ARM Cortex-M4F MCU running at 48Mhz. It was designed by Ben Shockley who was inspired by the classic 1980s "spaceman" LEGO minifigure.

The board features a microUSB port interface for programming and power. Its header pins are smaller than usual (0.050 inch instead of the usual 0.1 inch) and breakout six analog pins (including a true analog output) and several digital pins including some dedicated I2C, SPI, and UART connections.

There are two LED indicators. The “Built-In” LED is located on the reverse side of the board and shines through the spaceship on the front of the board when illuminated. The second is an APA102 RGB LED.

There are two buttons. One is tied to RESET and the other is user programmable.

A 2MB Quad-SPI flash memory chip provides plenty of space for CircuitPython as well as user code. Mini SAM comes pre-loaded with CircuitPython

Ben Shockley's Mini-SAM Repository

Circuit Python for the Mini SAM M4

Enabling SAMD Support in the Arduino IDE

Step 3: Mini SAM Breadboard Backpack

The Mini SAM M4 Development Board features header pins that are smaller than usual. The headers are 0.050 inch pin pitch, which is half of the usual 0.1 inch pitch that we're all used to. In other words, they are twice as dense. While these smaller headers help make the Mini SAM super tiny and cute, the denser pitch is not compatible with solderless breadboards or jumper wires. Until, that is, we slap a Breadboard Backpack onto Mini SAM's space suit!

This cool PCB was also originally designed by Ben Shockley who was kind enough to help us run a batch for this HackerBox. Thank you Ben!

Adding the included headers to the Backpack PCB is fairly self-explanatory, just make sure the board is not upside down. The 0.1 inch headers (the bigger ones) go on the side of the board where the silkscreen word "MINI" is on SAM's lower abdomen. We can call this the bottom of the Backpack PCB since the 0.1 inch headers will face down while using a solderless breadboard.

The smaller headers go on the side of the board where the silkscreen word "MINI" is closer to SAM's neck. We can call this the top of the Backpack PCB. The smaller headers can be soldered with the female headers on SAM's back and the male headers on the top of the Backpack PCB (as shown in the photo). Or they can go the other way around, whichever you prefer. SAM doesn't mind at all. You can even do some one way and some the other way as long as the connecting pairs are opposite. Go nuts!

Step 4: Adafruit QT Py

The Adafruit QT Py is a tiny development board based on the powerful ATSAMD21E18 chip. That SAMD features a 32-bit Cortex M0+ 32 bit processor core running at 48MHz. While using very little power, the QT Py offers amazing processing performance and ease of use. The QT Py features the same size, form-factor, and pin-out as Seeed Xiao module. Given its tiny size, we can easily pop one into any small project.

QT Py features:

  • ATSAMD21E18 32-bit Cortex M0+
  • 48 MHz 32 bit processor
  • 256KB Flash
  • 32 KB RAM
  • USB Type C connector
  • STEMMA QT plug-n-play connector
  • Native USB supported by every OS
  • RGB NeoPixel LED
  • 11 GPIO Pins
  • Works with Arduino IDE or CircuitPython

GO HERE for the usual amazing array of online documentation from Adafruit.

Step 5: Wemos D1 Mini ESP8266

The Wemos D1 Mini Module features the ESP8266 SOC. The ESP8266 SOC includes a microcontroller core, WiFi circuitry, and an integrated TCP/IP protocol stack. The ESP8266 is capable of running code directly on its MCU core. Or, the ESP8266 can act as a communication peripheral to provide WiFi functionality to another microcontroller. For example, we can connect a SAMD board and an ESP8266 module to add WiFi connectivity to the SAMD.

ESP8266 and Arduino IDE

The Wemos D1 Mini Module can be programmed using Arduino tools that you probably already have.

To add ESP8266 support within the Arduino IDE, follow Steps 1-5 of this tutorial.

Then, under Tools>Board, select "WEMOS D1 R2 & mini"

And open an example sketch:

File > Example > ESP8266 > Blink

Once uploaded, the Blink sketch will flash the blue LED on the Wemos D1 Mini.

As usual, experiment with changing both delay calls in the blink sketch to 2000, run the code, and then change them both to 200 and run the code again. Verify that the LED flashes ten times faster with the 200ms delays compared to the 2000ms delays. Cool beans!

Step 6: BadUSB MalDuino W - Remote WiFi Keyboard

WifiDuck and its evolution into MalDuino W are examples of BadUSB devices. They can emulate a USB keyboard just like the original USB Rubber Ducky with the added feature of being controlled remotely over WiFi. Once assembled, you can simply plug one into a system, connect to its Wi-Fi network, and manage all scripts from within the web interface. Such devices use the Ducky Script language that Hak5 introduced for use with the USB Rubber Ducky.

WiFiDuck uses an ATmega32U4 connected to an ESP8266

MalDuino W uses an ARM Cortex-M0 connected to an ESP8266

Use this knowledge for good and not evil: BadUSB devices work because the keyboard on a computer is generally a trusted device. You plug it in and it can start typing right away. While a human might not type as fast, an automated BadUSB device can press hundreds of keys per second. Experimenting with BadUSB devices helps us understand the threats of keystroke injection attacks. Such devices can also be used to automate administrative tasks.

Learn to defend against BadUSB attacks.

Step 7: Virtual Machines

What is a virtual machine?

Why do I need one?

How can I set one up for free right now?

VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL).

Presently, VirtualBox runs on Windows, Linux, Macintosh, and Solaris hosts and supports a large number of guest operating systems. VirtualBox is being actively developed with frequent releases and has an ever growing list of features, supported guest operating systems and platforms it runs on. VirtualBox is a community effort backed by a dedicated company: everyone is encouraged to contribute while Oracle ensures the product always meets professional quality criteria.

Step 8: Trust Your Technolust

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.

3 People Made This Project!

Recommendations

  • Microcontroller Contest

    Microcontroller Contest
  • Automation Contest

    Automation Contest
  • Make it Glow Contest

    Make it Glow Contest

20 Comments

0
DIY_Maker_Dad
DIY_Maker_Dad

8 days ago

I've been unable to get the second file for the Malduino to load to the QT Py. I've tried on both Linux and MacOS with no success. Any one else having similar issues or have tips on how to get it loaded?

0
jrbski
jrbski

Reply 6 days ago

What is happening when you try to load the second file? I have had some issues with the drive conflicting with Acronis backup software... the Acronis drivers kept trying to connect to the 'D;\' drive. The fix was to stop Acronis, or change the drive letter, and I was then able to copy the UF2 file successfully. Once the QTPy shows up as a second keynboard, you know it was successful. As noted below, the LED on the QT Py is a different pin, so you can't tell its working from that.

I recompiled the source, and have the LED working, but the ESP interface is not (yet).

0
DIY_Maker_Dad
DIY_Maker_Dad

Reply 3 days ago

When I try to load the second UF2, I get an error message "error opening directory MalW, permission denied." I get a similar error message trying with both MacOS and a Linux OS.

I've updated the user permissions to make sure the user can access the com port as a member of the dialout group in Linux and has sudo rights.

I've tried copying the file both through the GUI file manager and through a terminal. Each time I get the same error message.

0
jrbski
jrbski

Reply 3 days ago

Unfortunately I haven’t used Linux/OS X for circuit python hardware to date, but it sounds like the issue is related to the ‘virtual’ usb drive you need to copy the second UF2 into. I would expect the ‘Malw’ drive to show up in file manager as a usb drive would, or under /media. That is the drive u should need access to write to, and u shouldn’t need to use the com port. I would expect a ‘sudo cp’ to /media would ensure the second UF2 file would be copied assuming the usb MalW ‘drive’ mounts properly.

2
stephen.peters
stephen.peters

Question 21 days ago

Hello there. I won't get to this fine now for a while, I do like to dream. Any hip project suggestions for us? Particularly ones with step by step instructions for us n00bz?

1
CrittersWeb
CrittersWeb

Answer 15 days ago

I agree. It's good that Hackerboxes at least puts links in their instuctables, but sometimes the information behind the links is far too dense and foreign. It would be nice if they included at least one Hackerboxes centered example case for all the hardware they provide. Even when they link to information sources, I still don't know what to do with it or how to get started. There's a lot of Hackerboxes hardware I haven't tried yet because I didn't have time to figure out the resources they link to.

0
cosromx
cosromx

Reply 12 days ago

And that why I unsubscribed

1
HackerBoxes
HackerBoxes

Reply 12 days ago

Each HackerBox should have aspects that speak to a range of different ability levels, but the range is not infinite. Our goal is to meet a good number of members where they are and stretch them a bit beyond that - with different stretches each month. We don't want to entirely overwhelm someone who is a (hard working) beginner and we don't want to totally bore a seasoned wizard with spoon-fed everything. Yes, aspects of a box that will entertain someone with a lot of experience might be mostly unattainable for a beginner, but that beginner might enjoy digging deep on some other aspect of that same box, which might bore the more experienced user. Or the beginner might stick it out, ask for help, and see what they can pull off. Every aspect of every box will never speak the same meaning for every member. That would be impossible. White belts and black belts can train in the same room, but they are working on different skills. That said, if even the more basic aspects are frustrating you and you do not wish to ask for help or struggle, there are a lot of other fun offerings out there that might fit your level and needs. For example, plenty of DIY electronics products are self-contained and provide more explicit hand-holding. Shop around. Check out all the different options from Adafruit. Every product is not for every consumer for all times, so figure out what works for you where you are right now, get to work, and have fun! You're always welcome to return to HackerBoxes when you're ready. We aren't going anywhere. However, if the most encouraging words you have for a (self described) n00b looking for new ideas are to simply discourage them, then you should definitely go somewhere. :)

0
chemxboy
chemxboy

Question 13 days ago

Anyone know what’s written on the hoodie sticker? It’s weird that the preview image of the box does not have the writing, but the actual sticker does.

49458D2D-9000-4F11-85D1-51E6B1381501.jpeg
3
mbcharney
mbcharney

Question 23 days ago

What exactly is the coin?

0
jer502
jer502

Answer 22 days ago

paperweight

0
mbcharney
mbcharney

Reply 21 days ago

Poop! Thought i was getting an Epilog Laser engraver!! LOL

0
jer502
jer502

Reply 22 days ago

In the good sense

0
dtwilliamson
dtwilliamson

22 days ago

The bitcoin (a valueless physical commemoration of the digital bitcoin cryptocurrency which itself has speculative value) is marked ".999 Fine Copper" and is strongly magnetic. It's a cute souvenir. The remaining .001 (minus the tiny amount of purported 24K gold plating) is some mighty powerful iron!!! (In other words, don't believe the "copper" labeling!)

0
netelder
netelder

21 days ago

Was unable to get the Maldunio system working with the included QT Py. It worked fine with a TrinketM0 that I already had. Will do some additional debugging and post what I find.

0
eric.hokanson
eric.hokanson

Reply 21 days ago

make sure the TX from the Wemos goes to the RX on the QT and also the RX to TX. And the LED must be different on the QT vs the Trinket because the LED didn't flash on mine. Need to see if I can troubleshoot that in the firmware code (i'm sure the guy has the source on a GitHub someplace). Also would be nice to change the WiFi SSID to something less suspicious than the malduino.

0
netelder
netelder

Reply 21 days ago

For the QT Py, RX (D7) pin goes to TX pin on ESP, and TX (D6) goes to RX pin on ESP. Confirmed to work as expected.

The NeoPixel on the QT Py is on Pin 11, so the existing UF2 image won't blink it as it's using pin 7 (data) and 8 (clk) on the Trinket M0. That part of the code will need to be rewritten, and a new UF2 image created, to enable the NeoPixel.

0
seaprimate
seaprimate

22 days ago

Thanks! I got a whole bitcoin in my hackerbox! I can pay off my mortgage!