Attiny85 6-sided rollable dice

We are trying to make a rollable dice with an Attiny85. It is supposed to be six-sided and responding on rolling. Just like a normal dice but with LED indicators instead of the normal dots.
So far, we have only been able to find examples of one-sided dice and we are starting to wonder whether this is even possible to do.
Any suggestions?

So as an example, but then with six sides:
https://www.youtube.com/watch?v=JU3wjGo8i7U

I cannot envisage what you are trying to do. A die has a different pattern on each side so do you only want the pattern on the top after rolling to illuminate, or something else ?

Ideal it would only light up on the topside, yes.
We are able to use either a LED Matrix or a LED Strip divided on a PCB board for each of the numbers a side.
Hopefully, this makes more sense.

How are you to determine which side is physically up?

Not a programming problem.

Or is that the question? If you know which of six sides is up, it seems trivial to illuminate the corresponding display element whatever it be.

You could use a number of tilt switches, one at each corner of a tetrahedron that just fits into a cube.

4 choose 2 is 6, and are the six sides of the cube.

google

4 choose 2

or

combinations and permutations

There are other ways, but this would be straight ahead the easiest.

During rolling the switches would be going crazy and your code could exploit that and display appropriately.

a7

A tetrahedron does not fit into a cube!

You are thinking of an octahedron!

Presumably the answer is to use a three axis accelerometer module.

You would require 21 LEDs for the six faces. Charlieplexing wodul be a possibility or a MAX7219.

No, I mean a tetrahedron.

Of course a tetrahedron fits into a cube. One edge will be a diagonal of one side. 6 edges tetrahedron, 6 sides cube.

And whenever the cube is flat in the table, two of the four switches will be closed. Two will be open.

Which 2 of the 4 determines the side that is up.

The trick is to orient the tilt switch along the internal diagonals of the cube, or aim them from the vertices of the cube towards its center.

That’ll keep you way busier. Fun, but overkill.

a7

Oops, didn’t read that far into the article! :laughing: Too much mathematics in there.


OK, I was trying to think of how mercury switches would work and indeed, they would!

Now I figure that one of the four must be redundant, so three should suffice and a 74HC138 should do the job with no other logic components if you limit the LED current to 3 mA each. :grin:

And you could make a stand to sit it on the corner without the mercury switch to turn it off!

I do not believe that there is the possibility of eliminating a switch in this method. But I would be happy to be wrong.

Well, tilt switches. Not mercury. How old are you?:wink:

HTH

a7

Of course there is! :grin:
AB
AC
BC
AD
BD
CD
Just omit any one. Reduces to
AB
AC
BC
A
B
C

Possibly older than you. Don’t trust cheap tilt switches, mercury works!

(Just bought some more for fun :grin:)

1 Like

Yes. It might be easier still to use an octahedral arrangement, I have a toy with an octahedron inside it, a metal ball finds a vertex by gravity.

The octahedron vertices correspond to the cube’s faces’ centers.

Then one of the six octahedron switches is closed, indicating the side facing down.

It works after a fashion but is cheaply made.

You can’t use tilt switches in this case as four would be neither up nor down.

a7

That was my concern. :sunglasses:

Nice. I’ll convince myself that you are correct later.

However, the “extra” switch is good for knowing that the cube is more or less upright. There is a smaller solid angle where A and D are closed (and B and C open) than just A closed…

a7

But a pretty solid angle all right.

As I said, if you stand it on the corner missing the switch, it turns off and using CMOS, that’s all you need.

I have been trying to figure out how to use a simpler IC such as a 74HC14 or 74HC00 but giving up now …

This would leave the three real switches in a plane parallel to the floor where they might be either on or off and prone to changing as the angle of the plane changed, even very slightly.

Decoding that would show various sides up, all 6 possible, so there’ll have to be some kind of debouncing or other qualification it seems.

a7

No, I am talking about the tetrahedron arrangement.

Take a careful look at the tetrahedron and which way the switches point.

1 Like

Yes yes, it took longer than I wish it had, and I can’t figure out how to share the drawing I made on this stupid tablet. At least I figured it out without firing up the 3D tools…

So I see:

With the D vertex down, tetrahedron vertices A, B and C will all be above the center of the cube, so A + B + C would reliably indicate that orientation and be a nice way to say something to the process watching the switches.

Very nice. Appy polly loggies, my friend. Step by step.

BTW I am surprised you can still get mercury tilts, are they NOS you found somewhere?

a7

NOS?

Don’t know, the picture I gave is a link to just one (the cheapest of course) of the many listing for packs of ten on Aliexpress and - though I already have some - just for fun I ordered another three packs while researching the topic. Who knows, it is remotely possible I may even build the cube!

I don’t show links for eBay as they have decided to obscure their image links from hyperlinking, so they clearly do not want to encourage purchases. Very strange concept of “marketing”. :roll_eyes:

Dare I say it, whatever the EU may think about mercury is entirely irrelevant in China!

Infrared short range proximity sensors may also work to determine which surface of the dice is face down. You’d need 6. Probably also a tilt switch or two to detect the initial movement, after which wait until one of the proximity sensors shows a stable close reading, display a result for X seconds, then the MCU sleeps until again woken by the tilt switches.

NOS = new old stock. Old things that have been waiting around to be sold at retail for the first time. Somewhere. Like tubes and Nixie displays and, um, mercury switches. We may one day have to buy NOS real solder. :grimacing:

Oh and incandescent light bulbs.

And I may try to use an accelerometer. I’ve wanted to do a dodecahedral object that knows what’s up. TBH the maths is more like something I never knew than have long since forgotten.

Not sure there’s a trick as neat as the tetrahedron/cube thing for tilts.

a7

Actually, just look at the cube!

The switch in the corner of the cube points of course, to the opposite corner.