NataliaaaaaaaaAbraham Contreras
Published

3D-Printed BMO

The I used what I had at home version of Adafruit's BMO. Using digispark board, LED matrix, buzzer with rechargeable battery.

BeginnerWork in progress8 hours250

Things used in this project

Hardware components

DigiSpark
DigiSpark
×1
MAXREFDES99# MAX7219 Display Driver Shield
Maxim Integrated MAXREFDES99# MAX7219 Display Driver Shield
×1
Lipo battery
×1
TP4056 charger
×1
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×1
dip switch 1 pos
×1
passive buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE
LED Matrix Editor

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

3D printing files

Botones - buttons
Cuerpo - body
Tapa - cover
Brazos - arms
Piernas - legs

Schematics

Wiring

Code

BMOanimations.ino

Arduino
Loops animations and beeps
#include <LedControl.h>
#include "pitches.h"   

const int DIN_PIN = 3;
const int CS_PIN =4;
const int CLK_PIN = 0;
const int BUTTON_PIN=2;
const int BUZZER_PIN=1;

bool  interrupt = 0;

 //De-bouncer
 boolean buttonState = HIGH; 
 //int btnSpeedState=1;         //Estado actual del botn
 int btnSpeedSatateLast = 0;  //Estado ltimo del botn
 int lastDebounceTime = 0;    //Tiempo del ltimo rebote
 int debounceDelay=80;         //Tiempo de espera para el rebote en milisegundos
int numLoop = 0;


const uint64_t IMAGES1[] = {
  0x003c424200666600,
  0x1e213f0033000000,
  0x788400cccc000000,
  0x003c427e00660000,
  0x003c424200660000
};
const int IMAGES1_LEN = sizeof(IMAGES1)/8;


const uint64_t IMAGES2[] = {
  0x1824241800666600,
  0x0c120c0033330000,
  0x1824180066660000,
  0x3048483000cccc00,
  0x304830cccc000000
};
const int IMAGES2_LEN = sizeof(IMAGES2)/8;

const uint64_t IMAGES3[] = {
  0x0044380044ee0000,
  0x1c14082277000000,
  0x003c0084e7000000,
  0x00007c0022ee0000,
  0x0078483044ee0000,
  0x7c44380044ee0000
};
const int IMAGES3_LEN = sizeof(IMAGES3)/8;

const uint64_t IMAGES4[] = {
  0x183c7effffff6600,
  0x00183c7e7e240000
};
const int IMAGES4_LEN = sizeof(IMAGES4)/8;
LedControl display = LedControl (DIN_PIN, CLK_PIN, CS_PIN);

void setup() {
   attachInterrupt(0, button_ISR, FALLING);
   pinMode(CS_PIN, OUTPUT);
   pinMode(DIN_PIN, OUTPUT);
   pinMode(CLK_PIN, OUTPUT);
   pinMode(BUTTON_PIN, INPUT_PULLUP);
   pinMode(BUZZER_PIN, OUTPUT);
  display.clearDisplay(0);
  display.shutdown(0,false);
  display.setIntensity(0,10);
  }

void displayImage(uint64_t image) {
    for (int i = 0; i<8; i++) {
      byte row = (image>>i*8)&0xFF;
      for(int j = 0; j <8; j++) {
        display.setLed(0,i,j,bitRead(row,j));
        }
      }
    }

 int i=0;
  void loop() {
  switch (numLoop)
   {                       
     case 1:
     
       do {
        displayImage(IMAGES1[i]);
        delay(400);
       } while (++i<IMAGES1_LEN);
       i =0;                
     break;
     case 2:
       do {
        displayImage(IMAGES2[i]);
        delay(400);
       } while (++i<IMAGES2_LEN);
       i =0;                
     break;
     case 3: 
       do {
        displayImage(IMAGES3[i]);
        delay(400);
       } while (++i<IMAGES3_LEN);
       i =0;                
     break;
     case 4: 
        displayImage(IMAGES4[0]);
        tone(BUZZER_PIN, NOTE_C5, 150);
        delay(400);
        noTone(BUZZER_PIN);
        displayImage(IMAGES4[1]);    
        tone(BUZZER_PIN, NOTE_C5, 200); 
        delay(700);
        noTone(BUZZER_PIN);
       
     break;
     }

   if (numLoop>4)                             //Despus de preseionarse 4 veces, reiniciar
      numLoop=1;                               //velocidad al valor inicial de 1
  }    

void button_sound()
{
    tone(BUZZER_PIN, NOTE_B5, 200);
    delay(50);
    // stop the tone playing:
    noTone(BUZZER_PIN);
 
  }

void button_ISR(){
  static unsigned long last_interrupt_time = 0;
  unsigned long interrupt_time = millis();
    
  if(interrupt_time - last_interrupt_time > 200)
    {
      numLoop= numLoop + 1;
      button_sound();
    }
  last_interrupt_time = interrupt_time;

}

Pitches definition

C Header File
Used to generate tones
/*************************************************
 * Public Constants
 *************************************************/

#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978

Credits

Nataliaaaaaaaa

Nataliaaaaaaaa

21 projects • 16 followers
Electrical Engineer with a particular interest in cute electronic projects.
Abraham Contreras

Abraham Contreras

15 projects • 13 followers
Applications engineer and model scale maker
Thanks to Adafruit.

Comments