Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a circuit, which acts like a digital dice using diodes 1N4148, IC 555, IC 4017, 8 & 16 pin IC socket, LED, push-to-on switch, resistors & connecters.

By pressing the push button, 4017 counter toggles between 0 & until released. Once released, a random number is displayed. This is determined by the clock pulse generated by IC 555, which determines the state of 4017 counter.

Now I am thinking of making an application so as to capture this value(LED's lit) so that it can be used in a game like monopoly.

Is there any way I can achieve this ?

share|improve this question

You have several options, each has advantages and disadvantages:

  • You can connect each of your wires directly to a parallel port if your PC has one as these typically use TTL logic levels. Note that it's a good idea to use ribbon cables or some tape / elastic bands as lots of wires here can be a pain.
  • You can send data over a Serial port fairly easily with any AVR or programmable chip. These typically have serial libraries in C that you can use that can read the output from your dice and write it to the serial port in the form of an ascii symbol. Note that serial RS-232 serial uses different logic levels to your 74 series circuits (rather than 0v and 5v they use somewhere between -3 and -25v for logic 1 and 3v and 25v for logic 0. You need to specify the baud rate of transmission in both your transmitter and your receiving software. Assuming you have a power supply capable of negative voltages you can use something like a MAX232 to convert the levels for you nice and easily.
  • There's several commercial systems that make this easier if you don't have access to output to serial manually. For instance the Arduino doesn't need any of that, it has it's own FTDI chip and can send serial data straight over USB which you can read via a virtual serial port on any modern computer. It's a bit more expensive than doing it manually (AVRs are very cheap) but very simple to do, they provide a C-like library to program them and you do everything over USB. There's even a programs that show you how to use serial. You would simply read the the logic values from your dice, convert them to a number and write them to serial.
  • There's some very expensive options such as using infra-red (if you have a receiver) or bluetooth (very expensive, and requires an AVR or similar device to use it).

For reading data on the other side, there's some nice libraries such as PySerial which allow you to read serial data in Python, or you can do it directly from C/C++ on Linux as there's usually a serial port defined as /dev/ttyS* (/dev/ttyUSB* in the case of Arduino's virtual serial ports). The GNU screen program allows two way communication with any device as well, and in Windows MATLAB also has the ability to read in serial data, and I'm sure it's possible in other languages - I've just never tried it.

If you're not too experienced with the systems I'd recommend the Arduino. It has many more uses than the fairly simple circuit you're after and might be a little overkill, but you can do a lot of awesome things with it and it's an all in one solution that doesn't require any extras.

Edit: The serial port options I described all allow data to be sent both ways very easily, you should note that you'll need to add some extra circuitry to your dice circuit in order to use this with a parallel port.

share|improve this answer
while its totally overkill, Arduino would make it super simple and easy to do this. – TrewTzu Dec 16 '11 at 2:47

I'm quite sure you can connect a device like that on the Parallel port of a PC.

The program would read the value of the 4017 and the button.

Or you could connect a button and 6 diodes to the port and let the computer do the rolling and lighting.

share|improve this answer

You'll have to build an additional or different circuit to communicate with the PC. Something you make yourself would likely be over the Parallel port.

However, I'd recommend using a micro controller for communication. Something like the Arduino. Many have USB connections and will allow you to interface with your existing circuit with a few changes. Arduino also has plenty of helpful tutorials. Additionally, a micro controller will allow you to easily expand to other types of control inputs and hardware outputs.

share|improve this answer

You could do an arms-length integration by using a web cam and image recognition to decide what number was rolled. Get fancy and call it an "optical air interface" to make it sound official.

FYI this is how those lava lamp random number generators work, so there is good precedent.

share|improve this answer

Am I missing something? If your goal is a "digital dice" hardware for use with physical games, then no pc is required. On the other hand, if your goal is a PC game, it already has a perfectly good random number generator, and has no need of your hardware, and even if your hardware were somehow useful, no existing application will know how to use it.

So, assuming this is just a cool science fair project, not a serious attempt to build hardware to be bought, sold, and used, I would think about packaging it as a USB device. has exact specs for what is acceptable electrical properties.

share|improve this answer

Easiest methods I know are:

  1. USB experiment boards. These are relatively cheap and give a bunch of I/o pins you can control through some API on pc.

  2. USB connectivity kits such as PSoC can be used to make your device look like a keyboard or joystick.

Parallel port is nice, but hard to find on a modern pc, and windows has made its programming rather difficult since XP or so.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.