Electronic Cribbage Board

Thread Starter

agroom

Joined Oct 15, 2010
60
My project is to build an electronic LED cribbage board. For those that don't know what cribbage is or how it's played, essentially it's a card game that's played to 120 pts. The cribbage board has 2-4 rows of 120 holes that small pegs fit into. As players score points, they advance their pegs down the board and the first to reach 120 wins. Here's a picture of a basic 2-row cribbage board.

I searched the forum and found one thread of a similar project, though my idea is somewhat simpler. Instead of turning on LEDs from inserting a peg into the hole, I want to omit the pegs/holes all together and just have 'virtual' pegs with LEDs. Here are the project requirements:

  • Each row consists of 120 LEDs. They can be flush mounted under the board or soldered above, basically whatever is the easiest in the end.
  • Players press a button to advance their 'peg'.
  • Since it's possible to accidentally press it too many times, there would have to be a 2nd button for reverse or similar like long press would back-up one.
  • There needs to be 2-3 LEDs lit in each player's row. Typically it's played with 2-3 pegs, and when a player scores points the take the rear most peg and move it to the front. This is so you can remember what your previous score was (once you pull your peg, it's easy to forget where you pulled it from).
  • The board knows when a player advances to 120 and no more advancement is possible until reset. Plus, something like all the LED's for that player's row flash or something to acknowledge they won.
  • There needs to be a reset button, but somewhat protected to avoid accidental presses.
  • Ideally able to be battery operated, but also has plug for wall-wart.

That's about all I can think of for now, though I'm sure others will surface as I begin development.

Based on the requirements, I'm sure it'll need to be driven with a micro-controller, which isn't a problem. I've got basic experience working with both PIC and PICAXE chips and have a programmer for PICAXE and AVR (USBtinyISP AVR programmer that I bought for making ghetto pixels).

What I really need assistance with/ideas for are interfacing the 240+ LEDs since each need to be individually accessible. Off the top of my head, some kind of micro SMD LED strip would be ideal. I have experience with larger 5050 RGB strips, I don't have any experience with small strips. In addition, they would have to be very closely placed too so that the board doesn't end up being way too big.

I also have some experience with circuit board design and could make a custom PCB with each LED being like an 0603 SMD. It would be tedious to solder them all, though I'd do it once...hehe. I'd like it to have a nice finish, but it might be rather interesting for the surface to be a PCB, make it kinda geeky :)

Anyway, I think to get me started though are just ideas to interface the LED array. Honestly, if this is something that's just too complex...not in design but in build, that is hundreds of solders, especially small SMDs, then I might just scratch it. Though I'm hoping one of you could offer some revolutionary idea! :)
 

WBahn

Joined Mar 31, 2012
30,062
Let's assume that you do this using individual LEDs. So you would have a total that is approaching, but not greater than 256 LEDs. How many ports do you have available on your MCU? If you have 16 available for the LEDs, then you could put them logically into a 16x16 array and turn on any one of them at a time by asserting the pin for that row and that col (one going HI and the other going LO). Since you only need a few on at any one time, you can easily cycle through the set of ones that are on and they will appear to be on all the time.
 

Thread Starter

agroom

Joined Oct 15, 2010
60
How many ports do you have available on your MCU?
The largest one I have at the moment is a 20 (PICAXE 20X2), though I bought it for another project. I have 2 extra 14 pin PIXAXE 14M2s and I think 2 8-pin 08M2s.

If you have 16 available for the LEDs, then you could put them logically into a 16x16 array and turn on any one of them at a time by asserting the pin for that row and that col (one going HI and the other going LO).
I've done a small 5x5 LED grid before using my arduino so I'm semi-familiar with the concept using POV. But wouldn't I need 32 to do this? For instance, if this were a square 16x16 grid (easier to visualize), and for simplicity sake, let's say my MCU's output pins are 1-16, then:

row 1 = pin 1...row 16 = pin 16
col 1 = pin 1...col 16 = pin 16

The 2 issue I see is
1. trying to turn on LEDs where the row and col # are the same. i.e. LED at row1:col1 is controlled by the same output pin. Same with row2:col2 and so on.
2. You couldn't address (light) a single LED, only a full row or column. Well, minus a single LED in the row/col due to #1.

Or am I just missing something? I suppose I could just buy a 40pin MCU, but I'd prefer not having to pay another $15+/- for a new one. I also thought there might have been some other kind of "trick" similar to what you described and/or use of a few other external components.
 

tubeguy

Joined Nov 3, 2012
1,157
One trick is to use a 1 of 16 selector for your columns, along with a driver transistor as a sink output for each column. Connect LED cathodes in a column. Only need 4 pins.
 
Last edited:

WBahn

Joined Mar 31, 2012
30,062
I've done a small 5x5 LED grid before using my arduino so I'm semi-familiar with the concept using POV. But wouldn't I need 32 to do this?
Yes, I made a typo (or, more accurately, a mental discombobulation) and meant to say 32.

Since it appears you don't have 32 pins available, another option is to use 8 pins and have two sets of four go to two 1-of-16 decoders (or demux).

Yet another way to do it with even fewer pins is to use 4 pins to a 1-of-16 decoder and then have two 8-bit data latches that you load with signals from 2 other pins.
 

John P

Joined Oct 14, 2008
2,026
I suggest something like the MAX7219 LED driver. It can control 64 LEDs and has a simple interface to the processor; in fact you don't even need to give each one its own interface as you can run them in series. The MAX7219 is an expensive chip, but you can order them direct from China via eBay and then they're quite inexpensive. Some people say that's a bad way to buy chips, but I got ten of that component recently and they've been fine.
 

Thread Starter

agroom

Joined Oct 15, 2010
60
Since it appears you don't have 32 pins available, another option is to use 8 pins and have two sets of four go to two 1-of-16 decoders (or demux).
Duh, lol...now I feel like I had a brainfart :) My digital class this semester covered demux/decoders and that would be a perfect solution. Best part is most of them are normally high and the selected output goes low, so it's already setup to very well. Thanks :)

Yet another way to do it with even fewer pins is to use 4 pins to a 1-of-16 decoder and then have two 8-bit data latches that you load with signals from 2 other pins.
I've never used data latches, but from the name alone it sounds like it would work great. I'll have to read up on them.

Thanks for the help!
 

Thread Starter

agroom

Joined Oct 15, 2010
60
I suggest something like the MAX7219 LED driver. It can control 64 LEDs and has a simple interface to the processor; in fact you don't even need to give each one its own interface as you can run them in series. The MAX7219 is an expensive chip, but you can order them direct from China via eBay and then they're quite inexpensive. Some people say that's a bad way to buy chips, but I got ten of that component recently and they've been fine.
This sounds interesting. I just downloaded the datasheet, so hopefully I can make some sense of it :) Thanks!
 

Wendy

Joined Mar 24, 2008
23,421
There was someone who had a similar request, I came up with a possible alternative.



The orange is PCB material, the grey some sort of springy material (lot to choose from). You could make the shown hole size smaller. It is loosely based of a model rocket launcher safety key.
 

Attachments

thatoneguy

Joined Feb 19, 2009
6,359
You may want to have the previous score showing when adding onto the score (advancing LED peg). Otherwise, it's easy to lose track. Maybe have the last score remain blinking or dim when a new score is being added?

I'd also suggest one of the Maxim LED drivers, either I²C or SPI type, 4 of them, and you'll need a LOT of wiring in a small area.

What are the constraints, if any, for the physical size of the completed project?
 
Top