Kategori: Dot Matrix , Modul
24x16 Dot Matrix Green Display Board (4 x 2.5 inci)
Display Information Board berbasis dot matrix
contoh project sebagai berikut:
This clock uses the classic video game Pong to tell the time. The 2 players automatically win and lose so their scores show the hours and minutes. It’s not too hard to build and should cost less than £60 / $100. All the parts are easily available on eBay and the software code is free to download! The clock can also show the time written in words such as “Ten Past Twelve”, or with large or small digits. The date pops up every now and again too, printed out with a retro flashing cursor effect. A menu screen lets you choose the display mode, or you can have the clock pick a random mode every few hours.The project uses 2 bright LED matrix panels from Sure Electronics. You can choose between green or red panels with 3mm or 5mm LED’s . An Arduino runs the main code and a DS1307 clock chip keeps time, even when the power is off.
Plus wire, solder, sweat, tears, etc.
Parts in Detail…
2 x Model 2416 LED Matrix Displays from Sure Electronics. You can get these from Sure’s eBay store for $25 each: http://www.indo-ware.com/ You can buy either the red or green display, and with 3mm or 5mm LEDs. (My clock is made with the 3mm green one.) Make sure you get the newer version of the display which is based on the Holtek HT1632C chip. You can tell the newer displays as they have the controller chip and DIP switches on the back. The front is relatively empty of components – see picture below.
Sure 2416 LED Matrix with HT1632C.
1 x Arduino Uno / Duemilanove / Dicecimila with ATmega 328 CPU. The Arduino is the brains of the clock. It has a microprocessor that runs the clock software, plus inputs and outputs we connect to the displays, buttons and other components. Ensure you get an Arduino with the ATmega 328 CPU. The Uno is the latest version and has one as standard. Some Duemilanove / Dicecimila boards come with the ATmega 168 CPU with doesn’t have enough RAM for the clock code. You can get Arduino’s for about $30. Try Sparkfun Electronics or eBay.
1 x Arduino Prototyping Shield and Header pins. The prototyping board or ‘shield’ plugs onto the top of the Arduino making it easy to add components. It brings all the Arduino’s input and output pins onto a circuit board that you can solder components to. Get a board which is designed for a chip to go on, i.e. one that brings each pin of the IC out to a solder pad you can connect wires to – see picture. Again places like Sparkfun or eBay are good sources for them. You should be able to pick one up for $15 – $20. Check you get the black header pins too as some boards are sold without them. If you don’t like the idea of soldering, you could get a breadboard and jumper wire to build the circuit on temporarily instead. This is a good idea anyway to test it’s all working.
1 x DS1307 Real Time Clock (RTC) chip, Crystal, 3.3v Coin Cell Battery & Holder. The clock chip keeps time, regulated by the crystal. The battery powers the chip if the clock is unplugged, so it remembers the time when you turn it back on. I found all these bits on eBay bundled as a kit for $10.
1x 16 Pin IDC Socket. The display panels come with ribbon cable that needs to connect to a socket like this. We’ll need to solder it to the prototyping shield so we can plug the display ribbon cable in. They are a couple of dollars on eBay. If you aren’t planning to solder, you don’t need this.
2 x ‘Push to Make’ Buttons. These are used to set the time / change the display mode. You can get them for a few dollars.
1 x USB Lead – Type “A to B”
1x Mains to USB Power Adapter
Wiring it up…
This is how it’s all connected…. not too difficult.
Connecting The Parts In Detail…
The displays use a serial protocol called SPI to receive data. There are only 4 wires needed between the Arduino and the first LED display. Two more wires are required for power.
You’ll notice each display has 2 connectors on the back. These are for daisy chaining multiple units together as we are doing, and it’s what the little ribbon cable in the box is for. Connect the displays together using the ribbon cable. You can use either connector on the back, they are the same.
Use one of the free connectors on either display to connect to the Arduino. Again it doesn’t matter which one. For testing purposes I poked jumper wires from the Arduino into the ribbon cable connector. When I was happy things were working, I soldered the IDC socket to the prototype shield, meaning I could plug the ribbon cable in.
As on the wiring diagram, Pins 4 and 5 on the Arduino need to connect to pins 1 and 2 on the display connector respectively. These are used for something called Cable Select or ‘CS’. Cable Select determines which display listens when the Arduino is sending data out. The displays have small DIP switches to set their cable select address – essentially giving them different identities. Set one display’s switch to have CS1 on , and the other to have CS2 on .
Pin 10 on the Arduino is used to send the actual display data, and connects to pin 7 on the display. Pin 11 on the Arduino sends a clock signal. Connect this to pin 5 on the display.
Finally connect pin 12 on the display connector to positive and pin 11 to GND. Alternatively if you prefer you can use the screw terminals on the back of the display for power.
The DS1307 clock chip keeps the time. It uses something called the I2C protocol and only needs 2 wires to send time data to the Arduino. Connect pins 5 and 6 from the DS1307 to Arduino pins A4 and A5.
Connect the crystal between pins 1 and 2 on the DS1307. The crystal regulates the clock and can be connected either way round.
Finally the coin cell battery’s positive terminal connects to pin 3 on the DS1307 and the negative terminal connects to GND . The battery runs the clock chip if the power is turned off meaning you don’t have to reset the time. It should last for many years.
Connect one push button between Arduino digital input pin 2 and GND, the other between Arduino digital input pin 3 and GND.
We’ll supply power in using the USB port on the Arduino and then connect everything to the Arduino’s 5v and GND pins. Connect the 5v pin from the Arduino to the 5v pins on the display and DS1307. Then connect the GND pin from the Arduino to GND pins on the display and DS1307.
A FEW WORDS OF CAUTION WITH THE POWER…
Don’t use a higher voltage supply into the Arduino’s round power jack. The Arduino’s onboard regulator may not be able to cope with the power demand. If you try you’ll notice the Arduino will get very hot very quickly and probably not last too long!
Be very careful if you are powering the Arduino from a computer’s USB port. You could easily damage the port if you have a connection wrong or if the computer can’t supply enough juice. I powered my setup with my Macbook for testing and all was well, but be warned!
The prototyping shield plugs into the Arduino making it easy to add components. On a standard prototyping board you should have room to solder the DS1307 clock, crystal, battery and the IDC socket for the display ribbon cable. I attached the 2 buttons with wire, but you could solder them direct to the board.
I can’t really give instructions for what to solder where, as prototyping boards vary quite a bit depending on what you buy, but you should be able to figure it out based on the circuit diagram.
When things are soldered it should look something like mine in the picture. You can see the IDC plug on the right for the display cable, in the middle is the DS1307 clock chip. The tiny silver capsule above the chip is the crystal. On the left is the coin cell. The red button top right on the board is a reset button which came in the pack with the shield. It’s useful as the shield covers up the reset button on the Arduino itself.
Uploading the Clock Code
The last job is to upload the clock code to the Arduino. First you’ll need to download the Arduino programming software, called the Arduino ‘IDE’.
Important! The pongclock code is not yet compatible with the latest version of the Arduino IDE called 1.0. To get the pongclock software to work, you need to download version 0023 of the Arduino IDE software.
Download the IDE from the Arduino Site here: Look under “Previous IDE versions” for 0023: http://www.arduino.cc/en/Main/software
Once that’s installed, download the zip fie containing the clock code from my page on Google Code: http://code.google.com/p/pong-clock/
Unzip the clock code file. Inside you will see the main clock sketch called pongclock.pde and 4 library folders called ‘Button’, ‘DS1307′, ‘Font’ and ‘ht1632c’. These libraries are extra bits of code needed by the main clock sketch.
Next install the libraries. When you installed the Arduino software it should have created a folder somewhere for your sketches (i.e. projects) to go in. Find that folder and create a new folder inside it called ‘libraries’ if it doesn’t already exist. Then copy the 4 library folders from the zip into this ‘libraries’ folder. After you have done that make sure you quit and restart the Arduino IDE to make it pick up the new libraries.
After restarting, go to the Sketch -> Import Library menu. If the libraries are in the right place you should see their names listed in this menu.
Now go to the File menu and open the main pongclock sketch. It ends in .pde. You should see the code appear in the main window. Next pick your Arduino Board Type in the Tools -> Board menu, then hit the Verify (Play) icon. The compile test should compete without errors.
Time to upload the code to your Arduino! Unplug the Arduino from the clock prototyping shield and plug it into your computer with the USB cable. Click upload and wait for the code to be uploaded. Watch the TX and RX LED’s on the Arduino flash for signs of data transfer.
Finally unplug the Arduino from the computer and plug it back into the prototyping shield. Then plug the USB lead from the Arduino into the USB to mains adapter.
All being well the display’s should spring to life. Use the buttons to set the time and then sit back and admire your handiwork!
- Sometimes in pong a paddle will miss the ball when it’s not on the minute. I think it may be because the AI always assumes it can move the paddle to the programmed destination in time, whereas if that decision is computed when the ball is too near, it may not make it. Despite this, it does not affect the time if the paddle misses the ball.
- Sometimes after changing display mode the clock doesn’t get updated until the next minute comes up, so until that time it could show the time being a minute out. This just affects the display, the real time in the DS1307 is unaffected and the error is corrected on the next minute.
- The set clock routine could be better. At the moment the days aren’t read back from the DS1307 when you go into the routine.
Thanks to WestFW on the Arduino forum for providing the initial driver code, mattt for the DS1307 bits and Alexander for the button library.
|0 item produk
Total: Rp. 0