Introduction: HackerBox 0044: PCB 123
Greetings to HackerBox Hackers around the world! HackerBox 0044 brings us PCB Design, AVR Device Programming, Serial RGB LED Applications, Pro ESP32 WiFi OLED Development, and much more. This Instructable contains information for getting started with HackerBox 0044, 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!
HackerBoxes is the monthly subscription box service for enthusiasts of electronics and computer technology - Hardware Hackers - The dreamers of dreams.
HACK THE PLANET
Step 1: Content List for HackerBox 0044
- Exclusive HackerBox Zipper Toolkit
- Pro ESP32 with OLED and WiFi
- Addressable RGB LEDs Round 8mm
- ATtiny85 Microcontrollers
- ATtiny85 Development Board
- Solderless Breadboard 400 Point
- Exclusive HackerBoxes Prototype Board
- Bundle of Various Length Jumper Wires
- Exclusive SIMON SAYS Badge Kit
- Snowflake 18-in-1 Multitool
- Tux Linux Decal
- PentesterLab Decal
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: Pro ESP32 With WiFi and OLED
Features:
- ESP32 Tensilica Dual Core Processor
- Clocked at 240 MHz
- 520 SRAM
- 802.11 b/g/n Wi-Fi Transceiver
- Bluetooth dual-mode integrated traditional and BLE low-power
- 4MB (32 M bit) Flash
- 0.96-inch White OLED Display
- Lithium battery charging circuit and interface
- USB to serial bridge chip and MicroUSB port
The ProESP32 can be powered up by plugging it into a USB port. At that point, it will start running the pre-programmed OLED demo.
To (re)program the ESP32, we'll use the Arduino IDE. If you don't already have the IDE installed, get it here.
Next, follow the process for adding ESP32 Board Support into the Arduino IDE.
Next, instal this OLED display library into the Arduino IDE.
A good sketch to start with is the example SD1306SimpleDemo. Open that up and change the parameters passed into the display constructor for the OLED pins used on the module:
SSD1306 display(0x3c, 4, 15);
Also, flick the OLED reset pin (on I/O 16) by adding the following two lines just before the display.init() call in the setup function:
pinMode(16, OUTPUT);
digitalWrite(16, 1);
Program the modified sketch into the ESP and the OLED demo should appear.
Other projects to consider for the Pro ESP32 OLED module include:
Step 3: Serial Addressable RGB LEDs
Serial Addressable LEDs can be chained together and controlled by ONE SINGLE PIN. Simply connect an I/O pin to the first LED's "Data In" port and then connecting that LED's "Data Out" port to the next LED's "Data In" and so forth.
Grab one or both of these libraries to use the APA106 RGB LEDs with the ESP32, the ATtiny85, or any other Microcontroller of your choice:
A huge variety of other form factors of these sort of LEDs are available from Adafruit and elsewhere. They are a great option for any indicator or visual entertainment needs.
Step 4: ATtiny85 Microcontroller
ATtiny (also known as TinyAVR) are a subfamily of the popular 8-bit AVR microcontrollers like those used in various Arduino boards such as the UNO and NANO. ATtiny MCUs typically have fewer features, fewer I/O pins, and less memory than other AVR series chips, but they are very tiny and easy to use.
The LED on the Pluggable Development Board is a breakout for the ATtiny devices. It features an ISP header for programming the MCU. Pin 6 (Arduino I/O 1) is wired to an LED. A MicroUSB port is wired to power the module and also support use as a Digispark if the microcontroller is programmed with the micronucleus bootloader.
Step 5: Programming ATtiny With USB ASP
When a new, stock ATtiny85 chip (like the two 8pin DIP chips in this box) is purchased from Mouser or DigiKey, it is completely blank. The chips do not have micronucleus or any other bootloader on on them. They need to be programmed. For example using an ISP (in-circuit programmer).
USBasp is a USB in-circuit programmer for Atmel AVR controllers. It simply consists of an ATMega88 or an ATMega8 and a couple of passive components. The programmer uses a firmware-only USB driver, no special USB controller is needed.
Insert the ATtiny85 into the Plugable Development Board (mind the pin one indicator) and wire the board up the USBasp as shown here.
Add ATtiny support to the Arduino IDE (see details at High-LowTech):
Under preferences, add an entry to the list of board manager URLs for:
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Under Tools->Boards->Board Mangers, add the board manager package from ATtiny by David A. Mellis.
This will add ATtiny boards to the board list supporting settings for"
Board: ATtiny25/45/85
Processor: ATtiny85
Clock: Internal 1 MHz
[IMPORTANT NOTE: Never set the clock to EXTERNAL unless the chip actually has an external clock source.]
Load the code example for "blink"
Change LED_BUILTIN to 1 in three places in that sketch and upload it to the ATtiny85 using USBasp.
The LED on the Pluggable Development Board should now blink.
Step 6: Programming ATtiny With Arduino
Any Arduino (UNO, NANO, or otherwise) can be used as an ISP (in circuit programmer) to program other Arduinos or even blank, stock AVR microcontrollers. Details for ArduinoISP can be found in the Arduino online docs under "Use Arduino as ISP".
Step 7: Programming ATtiny With ESP32
Just like an AVR-Based Arduino, an ESP32 module (such as the Pro ESP OLED) can be used as as an ArduinoISP. This modified version of ArduinoISP is available for use on an ESP32, which can be wired as shown here.
Step 8: Creating Printed Circuit Boards
A printed circuit board (PCB) mechanically supports and electrically connects electronic components or electrical components using conductive tracks, pads and other features etched from one or more sheet layers of copper laminated onto and/or between sheet layers of a non-conductive substrate. Components are generally soldered onto the PCB to both electrically connect and mechanically fasten them to it. (Wikipedia)
Screen captures were saved while creating the SIMON SAYS PCB included in this box. They are broken out into the following videos:
SIMON SAYS PCB (Part 1)
SIMON SAYS PCB (Part 2)
These videos feature a PCB created in EAGLE. Keep an eye out for a similar example video using KiCAD in the future.
Even more detailed resources:
Hackaday's Series on Creating a PCB in Everything
Contextual Electronics PCB Tutorial Series
Example PCB Manufactures: PCBWay, OSH Park, JLCPCB, etc...
Step 9: Assemble SIMON SAYS Badge Kit
Kit Contents:
- Exclusive SIMON SAYS PCB
- Exclusive SIMON SAYS Overlay Decal
- ATtiny85 Microcontroller
- 8pin DIP Socket
- Tactile Momentary Buttons
- APA106 Addressable RGB LEDs
- Piezo Buzzer
- Right Angle Slide Switch
- CR2032 Coin Cell Clips
- CR2032 Coin Cells
Assembly Steps:
- DO NOT POPULATE THE BUZZER YET **
- Solder Coin Cell Clips - tinning all six pads
- Remaining components are populated on the front of the PCB
- Position Overly Decal onto PCB with red in upper left nearest Chip
- Puncture LED and Buzzer holes through decal from rear of PCB with a wire
- Note that the flat edge of the RGB LEDs face the Chip
- Solder Switch, LEDs, DIP Socket (without Chip), and buttons into place
** The buzzer is not populated yet because it shares the RESET pin of the Chip, so it not connected until later in the programming/assembly process.
Step 10: Program SIMON SAYS Badge Kit
Burn the attached "HBSimonBadge.ino" sketch into an ATtiny85 chip using the Pluggable Development Board.
In oder to use the NeoPixel library, we need to bump the internal clock rate from 1MHz to 8MHz under Tools->Clock. Remember to never set the clock to external unless an actual external clock is present.
Whenever you make a change to the clock rate you have to perform a "Burn Bootloader" operation under tools, so do that now too.
The sketch comes up in a flash "attractor mode" until one of the button is held down for a second or two, then one single LED will blink indicating that the SIMON Memory Game has begun. Try to copy the pattern as it gets longer and longer. Once the piezo buzzer functionality is added in the next step, the game becomes even more engaging.
Attachments
Step 11: Using ATtiny85 Pin One As I/O for Buzzer
Only once the simon sketch is correctly programmed and appears to be properly functioning do we disable the RESET pin allowing it to be used as an I/O pin for the Buzzer.
We only get to do this once and then the chip cannot be reprogrammed again, so be careful!
To disable the RESET pin, use avrdude with fuse parameters set for ATtiny85 default but with 8X clock divider OFF and RESET Disable ON.
Details for this (including a link to a nice fuse calculator) can be found here.
In our example, we went to a terminal or command window and entered:
avrdude -c arduino -p attiny85 -U lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m
Once avrdude reports success, but the ATtiny85 back into the SIMON and make sure everything still works. If so, you can now solder the Piezo Buzzer onto the board with the POS+ marking oriented away from the chip. Prepare to enjoy low-fi-audio delights while you play!
The detailed link above also explains how to "unbrick" the chip so that is can actually be programmed again after the REST pin is disabled. However, this is a bit of pain (requiring connecting up of a "high voltage programmer") so we recommend just making sure the ATtiny85 is programmed as you wish before disabling the RESET pin at soldering in the buzzer.
If you notice any glitchy problems with the MCU, make sure the socket seating is solid (bend the pins in/out a bit to add tension if necessary). If that doesn't do the trick, you can tack a 0.1uF ceramic cap between the chip's power and ground pads on the back of the PCB. We have not found the capacitor to be necessary, but having it there is technically considered good practice. On that note, you can also place a larger capacitor between VCC and GND as a board-level power smoothing measure.
Step 12: PentesterLab
Check out PentesterLab... Thanks for the stickers, guys!
A penetration test, colloquially known as a "pen test" or "pentest", is an authorized simulated cyberattack on a computer system, performed to evaluate the security of the system. The test is performed to identify both weaknesses (aka vulnerabilities) and strengths, enabling a full risk assessment to be completed. (Wikipedia)
The National Cyber Security Center, describes penetration testing as, "A method for gaining assurance in the security of an IT system by attempting to breach some or all of that system's security, using the same tools and techniques as an adversary might."
Step 13: Hacklife++;
We hope you have enjoyed this month's HackerBox adventure into electronics and computer technology. Reach out and share your success in the comments below or on the HackerBoxes Facebook Group. 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.
42 Comments
3 years ago
I know I'm late to the game. I used the Nano from #52 to load the boot loader, and the Simon program. Thanks to everyone, I was able to use the following to command to write the fuse.
Once I set the port, and baudrate it worked great
avrdude -c arduino -p attiny85 -P COM8 -U lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m -b 19200
Tip 3 years ago
DONE!!! I spent HOURS trying to get this to work with different programmers. The one that finally worked for me was USBasp. At first I could load the bootloader and the program with it no problem, but when I got to the fuse thing, it wouldn't find it. Then I found this godsend of a webpage, https://rlogiacco.wordpress.com/2016/09/01/usbasp-...
Here's the trick:
If you have Windows 10, and you're using the Zadig driver thing, change the driver from the default WinUSB to the libusbK. Then you can use in command prompt.
---------------------------------------------------------------------------------------------------
To find the right command, find evg2000's comment and do as he suggested by copying that line after the global variable and switch out some options. My example that I copied was...
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -pattiny85 -cusbasp -Pusb -Uflash:w:C:\Users\JOHNBP~1\AppData\Local\Temp\arduino_build_253269/HBSimonBadge.ino.hex:i
I took this part "-pattiny85 -cusbasp -Pusb"
and added the "-U lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m"
so the command I put in command prompt was...
avrdude -pattiny85 -cusbasp -Pusb -U lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m
Worked like a charm.
3 years ago
My Mac terminal did not know where to find the avrdude application and it obstinately failed to recognize the avrdude command.
So…I installed avrdude using instructions from this site: http://macappstore.org/avrdude/
That was a little scary because for all I knew I was installing malware into my root directories. But I backed up my computer and gave it a shot. It worked and the files were where they needed to be.
Now the terminal recognized the avrdude command. But running the commands to set the fuses resulted in an error: “ser_open(): can't open device "unknown": No such file or directory”
So I added a specific command showing the serial port that arduino was using: “-P /dev/cu.Bluetooth-Incoming-Port”
That worked but the then it couldn’t find my specific programmer: “avrdude: stk500_recv(): programmer is not responding”
So I gave it the name of the programmer I was using: “-c USBasp”
And that worked! The final successful terminal commands that I used for my MacBook Pro were:
I have no idea how I figured all that out but I guess three years of struggling my way through HackerBoxes has warped my brain. Maybe this will help someone else out.
3 years ago
I haven't been able to get the tiny85 to load... I first tried with my UNO, but missed the bit about needing a 10uF cap, which I don't have on hand. Switched efforts to loading it using the ESP32, but I've been getting the same errors as the UNO which is that the TINY 85 signature doesn't match. I checked pin continuity, chip seating, everything seems good, but I get different signatures every time. Might have to give up on this one since the next one is in the mail, but any thoughts would be appreciated.
Reply 3 years ago
One other option is using the USBasp in circuit programmer. Unfortunately the a USBasp does is not included with this HackerBox. I used one that came with an earlier box (HB25 Flair Ware). If you've subscribed for a while like me then you can go back at get it. That worked well for me. I haven't tried the other methods yet. You could also order a USBasp on eBay or Aliexpress and when it arrives in a few months you can go back and revisit this project.
3 years ago
In reference to the Pro ESP32 With WiFi and OLED when using Arduino Ide what is the proper board name under the Tools / Board dropdown menu?
Reply 3 years ago
ESP32 Dev Module works for me.
Question 3 years ago
Has anyone gotten the Hacker Arsenal Deception firmware to be fully functional? I was successful in loading the firmware to the ESP32 and it does work to a limited extent. But it does not automatically bring up the login splash screen on my browser (Safari or Chrome) when I select the decoy SSID. If I put the IP address for the splash screen into the address bar then yes it will bring up the splash screen and it registers the information that I enter. But, it will not do it automatically. I've tried it on my MacBook Pro, my iPhone and on a PC laptop. None work as intended. I'm guessing that maybe there are now new security features which are built into operating systems and browsers that block honeypot decoys like the Hacker Arsenal WiNX used?
3 years ago
How do you set the clock in the clock demo. It looks great. Thank you.
3 years ago
Found the Simon Says badge a little hard to play with the pokey leads on the back, so I designed and printed a simple case to cover up the sharp bits. You can find it below at Thingiverse. If you have or have access to a 3d printer, feel free to print and share!
http://www.thingiverse.com/thing:3762770
Question 3 years ago on Introduction
I got the Simon game up and running. I used a Arduino Uno as an ISP. Loaded the bootloader with no problems. Installed the sketch for the Simon says badge to the ATtiny85. The final step burned the fuse to enable Pin 1 as an I/O port. To do that I used WinAVR with the following command:
C:\>avrdude -c arduino -P COM6 -b19200 -p ATtiny85 -U lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m
I then installed a 10uF bypass cap across +5 and GND pins.
Awesome Project.
3 years ago
So i'm almost there. I have the sketch running on the Attiny85 just fine and working. I am dwn to disabling the Reset pin and soldering on the speaker. Running avrdude, ths is what I am getting.... expecting a different signature. Using -F to disable the signature check doesn't work.
C:\Users\Tim>avrdude -c arduino -p attiny85 -P Com16 -U -F lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATtiny85 is 1E 93 0B
Double check chip, or use -F to override this check.
avrdude done. Thank you.
Reply 3 years ago
Getting a bit closer..... Now I get this - at the end a "programmer is not responding"
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -F -c arduino -p attiny85 -P COM16 -U lfuse:w:0xe2:m -U hfuse:w:0x5f:m -U efuse:w:0xff:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% -0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATtiny85 is 1E 93 0B
avrdude: reading input file "0xe2"
avrdude: writing lfuse (1 bytes):
Writing | | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.11s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xe2:
avrdude: load data lfuse data from input file 0xe2:
avrdude: input file 0xe2 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0xe2
avrdude: verification error; content mismatch
avrdude: safemode: lfuse changed! Was e2, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK (E:00, H:00, L:E2)
avrdude: stk500_recv(): programmer is not responding
avrdude done. Thank you.
Reply 3 years ago
check out my comment a few comments down, i think it might be helpful
3 years ago
In order to use the NeoPixel library, we need to bump the internal clock rate from 1MHz to 8MHz under Tools->Clock. Remember to never set the clock to external unless an actual external clock is present.. Well I am using a Arduino Uno to program the chip. I think I was able to burn the bootloader. But when it comes to the other sketch. There is no option to change the clock rate as stated above. So i am kinda lost at this point.
Reply 3 years ago
Remember that programming the UNO (with arduinoISP) and programming the attiny85 target through the uno are two unrelated things with totally different IDE settings. When programming the UNO, there will be no setting under tools for the ATYTiny85, but then when you change the target to ATTiny85, there will be options specific to that "board" (not the UNO).
Reply 3 years ago
Also, if you're using the UNO, you should, and I needed to, have a 1uF or 10uF capacitor between the ground and the reset pin, and mind the polarity of the capacitor. Once I did that, I was able to program.
Reply 3 years ago
This capictor goes where? Between ground and reset on the ATTiny85? I've seen similar recommendationin some forums, but it was also unclear to me then where the cap should go.
Reply 3 years ago
No, it should go between the ground and the reset pin on the Arduino board, with the negative lead on the ground (shorter lead) and the longer lead of the capacitor to the reset pin. You only do that when actually loading the sketch to the ATTiny85 chip. When you are loading the sketch to the Arduino board, there is no need to use the capacitor.
3 years ago
Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "ATtiny25/45/85, ATtiny85, Internal 1 MHz"
Build options changed, rebuilding all
Sketch uses 678 bytes (8%) of program storage space. Maximum is 8192 bytes.
Global variables use 9 bytes (1%) of dynamic memory, leaving 503 bytes for local variables. Maximum is 512 bytes.
avrdude: Warning: cannot open USB device: Function not implemented
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
"Show verbose output during compilation"
option enabled in File -> Preferences.
What did I screw-up/miss?