Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help randomly lighting two different LED's...

Status
Not open for further replies.

Flyingmonkeyc

New Member
Hello,
Well, I don't know to much about electronics, and only really need to learn a little bit to create this project I'm working on.

I'm trying to create a punching bag "Add-On" that has two lamps that light on randomly, but only one at any given time. The purpose is to allow me to practice some self defense techniques using the lamps to represent which side the attacker is comming from.

I did research on this, and came up with the 555, and playing around with it, I can not produce the random results I'm trying to achieve, which brings me to believe that I need another chip.

I need it to reset about every 3 seconds, and stay on for about 1 or 2 seconds (otherwise I wouldn't be able to tell if one lamp or LED stayed on for two "turns".)

Any help or direction would be greatly appreciated! :D
 

Attachments

  • punching_bag_01.jpg
    punching_bag_01.jpg
    20 KB · Views: 938
There is only one way to get truly random events, that is with a noise generator. You would need a low pass filter and amplifier to drive the LEDs. A computer (PIC) can give psudo random numbers and would be somewhat simpler in hardware.
 
Thanks for the reply, but I don't excactly need true random. I researched some more and figured out that using a 555 in conjunction with a 4017 will work.

This is more of what I was looking for,
**broken link removed**
, I'm going to try to change it to use only 2 lights, even if I have to just reroute 3 leds into 1 somehow, that way it still remains 50-50. If someone could help me figure out how to alter this circuit so that a push button is not required, it would be great. Should I just take out the switch?

Thanks in advance.
 
Russlk said:
There is only one way to get truly random events, that is with a noise generator.

But.... is it truly random?

To the eyeball, yes, because we can't count hundreds of numbers in picoseconds, but in reality, no.

a noise generator is an oscillator, and an oscillator produces the same pulses over, and over again.

I wonder if consistently changing the duty cycle will help, and even if it does, what circuit can do it?

I still think that pure random is impossible.
 
mstechca said:
a noise generator is an oscillator, and an oscillator produces the same pulses over, and over again.

NO! - an analogue noise generator is NOT an oscillator, and it doesn't produce the same pulses over and over again.

If you make a digital noise generator, then that does produce the same pattern over and over again, as do software based random number generators.

With such digital methods the cure is to start from a 'random' seed, an easy method is to press a button to start the process, which then loads a seed value from a fast running oscillator
 
A very simple way to generate a 'random' sequence is to use a Pseudo Random Bit Sequence genertor. You can do it in a microcontroller with a few cycles of cpu time and 4 bytes of ram, or you can do it with a couple of logic ICs.

I was chatting with someone about something similar last week, and found a few good web references here:

This one is a bit detailed:
**broken link removed**

This is the business:
**broken link removed**


The best source of info that I found was the book 'The Art of Electronics' by Horowitz & Hill.

Mike.
 
Nigel Goodwin said:
mstechca said:
a noise generator is an oscillator, and an oscillator produces the same pulses over, and over again.
NO! - an analogue noise generator is NOT an oscillator, and it doesn't produce the same pulses over and over again.
I don't know why you say that. Can you give me a schematic of a basic noise generator? I'll experiment.

If you make a digital noise generator, then that does produce the same pattern over and over again, as do software based random number generators.

I always looked at it that noise is generated by an oscillator. In fact, it is the high frequency that makes us think we are hearing noise, because it is thousands of clicks in a second.

So other than oscillators, Nigel must know of another way to generate noise.
 
mstechca said:
I always looked at it that noise is generated by an oscillator. In fact, it is the high frequency that makes us think we are hearing noise, because it is thousands of clicks in a second.

You looked at it completely wrongly! :lol:

So other than oscillators, Nigel must know of another way to generate noise.

Yes, the common way - using an oscillator isn't it!.

Here are a couple of examples from dicovercircuits, as usual they both use the noise properties of a zener diode!.

https://circuitos.tripod.cl/schem/r62.gif
 
The first circuit tells me that one lousy diode (transistor with one hanging connection) is driving the circuit.
Thats interesting.

Ya see, I never made a random noise generator because the output when connected to the speaker can be annoying.

Something has to change the voltage at one end of the diode to change it's internal capacitance (since it appears reverse biased).

Would it be the temperature applied to it?
If it is temperature, then maybe we can get more random information.
 
mstechca said:
The first circuit tells me that one lousy diode (transistor with one hanging connection) is driving the circuit.
Thats interesting.

Ya see, I never made a random noise generator because the output when connected to the speaker can be annoying.

Something has to change the voltage at one end of the diode to change it's internal capacitance (since it appears reverse biased).

The transistor is connected as a zener diode, check the reverse base emitter breakdown voltages for a silicon transistor - they make quite good zeners, with a voltage of around 6-7 volts. If you remember we mentioned this when talking about using a transistor as a varicap - if you go too high the junction will zener.

The noise generating properties of a zener are well known, and it's common to use a transistor in this role, simply because you are more likely to have one to hand. Notice the 2nd circuit I posted uses an actual zener diode.
 
Flyingmonkeyc, here's a circuit for you. I breadboarded it, and it works well.
To test it, you might want to speed it up by temporarily changing C3 to 100nF.
 

Attachments

  • digital_noise_gen.png
    digital_noise_gen.png
    26.1 KB · Views: 821
mstechca said:
The first circuit tells me that one lousy diode (transistor with one hanging connection) is driving the circuit.
Thats interesting.
Ya see, I never made a random noise generator because the output when connected to the speaker can be annoying.
Something has to change the voltage at one end of the diode to change it's internal capacitance (since it appears reverse biased).
Would it be the temperature applied to it?
If it is temperature, then maybe we can get more random information.
haven't u heard of shot noise.
 
akg said:
mstechca said:
The first circuit tells me that one lousy diode (transistor with one hanging connection) is driving the circuit.
Thats interesting.
Ya see, I never made a random noise generator because the output when connected to the speaker can be annoying.
Something has to change the voltage at one end of the diode to change it's internal capacitance (since it appears reverse biased).
Would it be the temperature applied to it?
If it is temperature, then maybe we can get more random information.
haven't u heard of shot noise.
According to this, shot noise occurs if forward-biased diodes. Avalance noise is the source in zener diodes.
 
easy

just take and use the dice game posted above and put an exclusive or gata at each of the outputs with the 6 lights as the input on the curcuit.All you need is put 3 lights to one side and the other 3 to the other side and it will randomly change each cycle :)
 
Re: easy

person4u said:
just take and use the dice game posted above and put an exclusive or gata at each of the outputs with the 6 lights as the input on the curcuit.All you need is put 3 lights to one side and the other 3 to the other side and it will randomly change each cycle :)
I think the randomness of that circuit depends on the 1uF capacitor charging to a different voltage each time the pads are touched (due to the amount of time touched, skin resistance variation, 50 or 60 Hz noise added, etc.). If you just short the contacts permanently, I doubt that it would be as random. Perhaps the fact that the BC557 in the timer doesn't saturate would add some randomness.
 
It took me a couple tries, as I'm still new at this, but I finally got Ron H's circuit to work perfectly, I added a POT to it, and an On/Off switch, though it took me some time to add the POT so it worked nicely...I'm now soldering everything together...thank you Ron H and everyone else!!!
 
Flyingmonkeyc said:
It took me a couple tries, as I'm still new at this, but I finally got Ron H's circuit to work perfectly, I added a POT to it, and an On/Off switch, though it took me some time to add the POT so it worked nicely...I'm now soldering everything together...thank you Ron H and everyone else!!!
Where did you add a pot?
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top