Enter Your Holiday Season Project for a Chance to Win Over $20,000 Worth of Prizes and Gifts to Give! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
I have wanted to make an animated message display with lights and sound for sometime, so this holiday I decided to do it!
I have used the Keyestudio 8x8 Dot Matrix Modules before so decided to use them for this. I wanted to use more than one 8x8 dot matrix displays but I also wanted to 3D print a case for it. As my printer is not that large I compromised on only using two of the dot matrix displays. This is enough to show that it will all work yet still be within the capability of my printer. These displays have an I2C interface so can be connected in parallel, which made things much easier, but they are quite demanding of power so need a lot of current (when LEDs are on) so long term battery operation is probably not going to happen. I wanted to use a recorded holiday message so I used an ISD1820 PCB module I already had. It is not brilliant but is easy to use. The sound is recorded into the module once using the on-board record button and then played back using the P-L connection (or PLAYL button).
The complete circuit is very simple as shown below:
The dot matrix displays have a default I2C address of 0x70 but there are three user selectable (by soldering) address bits allowing a range of 0x70 to 0x77. One display was left as the default 0x70 and the other amended to 0x71 by adding a solder blob to the connections just above the A0 address signal.
The 3D Print
I use TinkerCAD for my 3D prints and below is an image of the designed box. There is also a lid to fit at the back to make it look a bit prettier.
It is a simple design, just being a shallow box exactly the same width as two dot matric displays. I designed the displays to be an interference fit so that no screws would be needed although I still put in a ridge at the top that could be used to screw the displays to if needed. Unfortunately the printer was having an off-day and the top of the box was very badly printed. At this point I ran out of filament, as well as time, so there was no opportunity to reprint. I just had to sand it down and make the best of what I had.
As I had run out of filament and time I was unable to design and print the battery holder and back of the whole box. Being resourceful (and desperate) I decided to just Blue-tac the display box to a battery holder (4xAA) and use some white card to make a more acceptable shell. It looks OK from the front, but from the back, not so good.
Sound
As I was using a self-contained sound module the only connections needed were power (GND and VCC) and P-L (D3 on the Nano). I just Blue-taced the speaker to the back of the display box and the sound PCB to the end of the battery holder. It doesn't look good, but it works and holds together.
Programme
The programme is relatively simple. I used Adafruit libraries for the display and graphics, although in the end I only used text. I started with grand ideas of putting in holiday related graphic sprites but time and enthusiasm ran out. In setup the displays are both initialised using their different I2C addresses (0x70 and 0x71) and then rotated through 90 degrees so that they appear the right way up at the front. The rest of the programme is quite simple, with a text string called msg[] being output character by character to the displays using a for loop, all contained within an infinite while loop.
There is a problem with the sound which only works correctly when the programming USB cable is plugged in. I am assuming that this is some sort of power supply problem with the displays causing some sort of power glitch when powered on. I was unable to rectify this problem so when powered only by battery the only sound heard is "Mer" ! The displays work fine though. I did try to get the display to update column by column rather than character by character to give a much smoother scrolling effect but it just would not work properly and my brain was beginning to hurt - so I gave up. Maybe some other time I'll have another go at column scrolling.
The programme used is listed below:
/* Message Display
* Dual HT16K33 8x8 Matrix Displays
* Dubbie Dubbie
* 9th Jan'20
* SCL to A5
* SDA to A4
* GND to 0V
* Vcc to 5V
* ISD1820 connected to D3 ((PLAYL) and D4 (PLAYE)
*/
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
#ifndef _BV
#define _BV(bit) (1<<(bit))
#endif
#define playl 3
#define playe 4
Adafruit_8x8matrix matrixleft = Adafruit_8x8matrix();
Adafruit_8x8matrix matrixright = Adafruit_8x8matrix();
uint8_t counter = 0;
int LDR0pin = A0; // LDR Analogiue Input pins
int LDRvalue = 0; // variable to store the LDR value
int LDRdata[8][8] =
{{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0}};
void setup()
{
pinMode(playl, OUTPUT);
digitalWrite(playl, LOW);
Serial.begin(9600);
Serial.println("Greetings Card on matrix Display");
matrixleft.begin(0x70); // pass in the address
matrixright.begin(0x71); // pass in the address
matrixleft.setRotation(1);
matrixright.setRotation(1);
matrixleft.clear(); // clear display
matrixright.clear(); // clear display
matrixleft.writeDisplay(); // write the changes to the display
matrixright.writeDisplay(); // write the changes to the display
} /* setup */
uint16_t x = 0;
uint16_t y =0;
uint16_t color=0;
void loop()
{
char msg[] = " Merry Christmas and a Happy New Year to all at Element14 ";
int index = 0;
int col = 0;
x = 0;
y = 0;
delay(1000); // Power on delay
while (1)
{
digitalWrite(playl, HIGH);
for (index = 0; index < 59; index++)
{
matrixleft.clear(); // clear display
matrixright.clear(); // clear display
matrixleft.drawChar(2+col,0,msg[index],1,0,1);
matrixright.drawChar(col,0,msg[index+1],1,0,1);
matrixleft.writeDisplay(); // write the changes to the display
matrixright.writeDisplay(); // write the changes to the display
delay(400);
digitalWrite(playl, LOW);
delay(1);
} /* for */
delay(1000);
} /* while */
} /* loop */
The completed working box is shown in the video below:
The audio is not as loud as I wanted everything else is generally as I desired. The camera is not so good at colours and LEDs so the actual box does look better in real life. I had planned to include a light detector using an LDR so that the system would automatically play when the light level fell, that is when it was getting darker, but it became very crowded at the back of the box and there just wasn't room to install it without making drastic changes to the construction. Still, I think it works pretty well, with the added bonus that it can easily be reprogrammed for other festivities such as birthdays.
Dubbie
Top Comments