Project tutorial
Dead Bug Valentine

Dead Bug Valentine © MIT

My first go at dead bug style soldering. A style of soldering where no PCB is used and all of the components are soldered together.

  • 2,739 views
  • 1 comment
  • 17 respects

Components and supplies

Attiny85
Microchip ATtiny85
×1
HT16k33 8x8 LED Matrix
×1
A000066 iso both
Arduino UNO & Genuino UNO
Used for testing code and programming the ATTiny85
×1
11026 02
Jumper wires (generic)
×1

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Overview

This was one of those projects were I had a good idea in hand, but by the end it turned out quite different; and I am quite pleased how it turned out.

I wanted to make my Wife something nice this year for putting up with my various projects. Those on the "list," those in planning, those in progress, those finished, and some abandon.

My original idea was to cut a heart out of wood, mount the 8x8 matrix in a hole in the middle, and mount the ATtiny on a PCB somewhere. I couldn't make up my mind in front or back. While those ideas where being pondering and experimented with, I started on the hard part of the project.

I looked in my stock as I had both the ATtiny85 and 8x8 matrix handy. Wow, that seemed like a first, I didn't have to order anything. I hadn't really used the matrix before so I downloaded the Adafruit libraries and hooked it up to my Uno clone and started to play around. I used both the Adafruit_LEDbackpack and Adafruit_GFX. The animations are pretty straight forward. You have to create your image with 0 & 1's, then call each of them as you need them.

Code

Here is an example from my code that shows part of the heart being drawn, it is the center square.

 heart2_bmp[] =
 { B00000000,
   B00000000,
   B00000000,
   B00011000,
   B00011000,
   B00000000,
   B00000000,
   B00000000, },

Text scrolling is straightforward, but for those who are new, lets pick it apart a little bit and see what is going on.

   matrix.setTextWrap(false);
 matrix.clear();
 for (int8_t x=8; x>=-100; x--){
   matrix.clear(); 
   matrix.setCursor(x - 8, 0); 
   matrix.print("1 short text"); 
   matrix.writeDisplay(); 
   delay(100);

To start, the text shouldn't wrap as a message will be scrolling across the matrix. The first variable, x=8 is where the text will start to scroll across. This example starts on the right and moves towards the left. x>=-100 is allowing room for the characters. I took the total number of characters in my text message and multiple it by 9 and the text displayed correctly. If you miscalculate you might not see the whole message. This happened to me as the original message was about 4 characters and the value was 96. My message was much longer, but I hadn't changed the 96. Once it was bumped higher all worked out well.

I was using my Uno clone to do the testing. It is just much quicker to make a change and upload it quickly. Everything was moving along great, but I noticed one thing, the message wasn't oriented right, it was a bit upside down.

There is another command that comes in useful.

matrix.setRotation(1);

With it you can rotate the screen in any of the four directions depending on where you need/want the pins to orient. Setting it to one put 0,0 in the upper, left-hand corner, with the pins pointing downward. Or as in one part of my code I use the rotation to spin the heart.

Programming

Now is was time to program the ATtiny. I do like working with these little guys. They work quite well in a lot of my projects and can take up a lot less space than an Uno. There are some great guides out on the net on programming the ATtiny family of processors. The only hiccup I had was dealing with the Wire library.

While libraries might be compatible within the ATMel family of chips, there is the space consideration. And the ATtiny85 doesn't have the room of its big brother. There is a Wire library that was made just for the ATtinys, it is also from Adafruit. WireTinyM. Once I updated that it worked much better. I left in both for when making changes and updates. Depending on which one I am using I can just comment out the other.

During all of this I am still pondering how to make the mount for all of my little bits. I start to look at the 8x8 and the Tiny and figure what the hay. There are only 4 pins that need hooked up. And this would probably look way cooler than protoboard as there is no time to get a PCB fabricated and delivered. It seemed to so simple, 4 pins to 4 pins. It took a couple of tries in trying to find what might look best and also work the best.

Well, it struck me. It had earlier, but wasn't too hip on the idea at first and then it just started to grow on me the more I thought about it. I got myself a length of electrical wiring. I had a length of 3-wire left over from a kitchen project. I pulled out the ground wire and bent it in the shape of a heart. I would then just be able to hang the matrix and Tiny from the top of it. Shazaam!

After that it was a matter of finding a base (a birch log part that was from a wedding center piece and some Lake Superior lake shore rocks).

Finishing touches

Oh last but not least, I had to power it. I was going to use USB cable, but no, that would be just too much hassle. AA?? Naw, too many and won't last too long. Hey, I have one of those lipos at 3.7, I wonder if it would work? I know the ATTiny will work at 3.3V and that data sheet states the lowest power the for the matrix is 2.7. What the heck. I wired up a JST battery connector and plugged it it - DONE!

Code

Deadbug ValentineArduino
/* I Heart You project
   Peter Hein 2018, wrightmac.net
  ATTiny85 + 8x8 HT16K33 Keyestudio LED matrix
  8x8MATRIX <->  ATTiny85
  Power     ->  5v
  Ground    ->  Ground
  SDA       ->  PB0 - pin 5
  SCL       ->  PB2 - pin 7
*/

//Required Libraries
// Keep wire around for testing the code on an Uno - Can strip when done testing 
//#include "Wire.h"

// TinyWire is for the ATTiny85 version.
// Note**TinyWireM is the version from Adafruit
#include <TinyWireM.h>
#include "Adafruit_GFX.h"
#include "Adafruit_LEDBackpack.h"

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {

  // address for the matrix
  matrix.begin(0x70);  
}

// Frames for the heart animation
static const uint8_t PROGMEM
  heart1_bmp[] =
  { B00000000,
    B00000000,
    B00000000,
    B00010000,
    B00001000,
    B00000000,
    B00000000,
    B00000000, },
  heart2_bmp[] =
  { B00000000,
    B00000000,
    B00000000,
    B00011000,
    B00011000,
    B00000000,
    B00000000,
    B00000000, },
  heart3_bmp[] =
  { B00000000,
    B01100110,
    B10011001,
    B10011001,
    B01011010,
    B00100100,  
    B00011000,
    B00001000, },
  heart_bmp[] =
  { B00000000,
    B01100110,
    B11111111,
    B11111111,
    B01111110,
    B00111100,
    B00011000,
    B00001000, };

void loop() {
  // debug to find the 0 of the display
  // Note with 8x8 pins on the bottom setRotation(1) put the 0,0 in the upper, left corner
  // set Rotation(3) is upside down.
  //matrix.clear();      // clear display
  //matrix.setRotation(1);
  //matrix.drawPixel(0, 0, LED_ON);  
  //matrix.writeDisplay();  // write the changes we just made to the display
  //delay(1500);
  
  // Animate the heart
  matrix.setRotation(1);
  matrix.clear();
  matrix.drawBitmap(0, 0, heart1_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart2_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart3_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(250);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart1_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart2_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart3_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(250);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(250);

  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);


  // Clear the screen and my special message
  //matrix.setRotation(1);
  matrix.setTextWrap(false);
  matrix.clear();
  for (int8_t x=8; x>=-160; x--){
    matrix.clear(); 
    matrix.setCursor(x - 8, 0); 
    matrix.print("My Message Goes Here"); 
    matrix.writeDisplay(); 
    delay(100);
  }

  matrix.setRotation(4);
  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);
   matrix.setRotation(3);
  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);
   matrix.setRotation(2);
  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);
   matrix.setRotation(1);
  matrix.clear();
  matrix.drawBitmap(0, 0, heart_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

    matrix.setTextWrap(false);
  matrix.clear();
  for (int8_t x=8; x>=-100; x--){
    matrix.clear(); 
    matrix.setCursor(x - 8, 0); 
    matrix.print("I Have Beer"); 
    matrix.writeDisplay(); 
    delay(100);
  }
}

Schematics

Deadbug Valentine
Img 1853 3hpmbc0wrk

Comments

Similar projects you might like

Ugly Bug

Project tutorial by Jeremie

  • 6,966 views
  • 8 comments
  • 34 respects

tinyGlow Smart LEDs

by Alex Glow

  • 3,799 views
  • 3 comments
  • 24 respects

The Magnetic Field and RGB Tester

Project tutorial by Kutluhan Aktar

  • 3,530 views
  • 0 comments
  • 14 respects

Multi-Source Controlled USB Lamp

Project tutorial by Amal Mathew

  • 3,797 views
  • 2 comments
  • 20 respects

ATtiny13/13a/25/45/85 Programming Shield

Project tutorial by Viktor S

  • 1,992 views
  • 0 comments
  • 6 respects

LED Cube

Project tutorial by Praditha Alwis

  • 5,037 views
  • 0 comments
  • 12 respects
Add projectSign up / Login