Electronics Experiments

  • Creator
    Topic
  • #6293

    OneMadGypsy
    Participant

    Exclusive OR (XOR) Condition with Transistors

    This was a headache. I started with 3 transistors and after a whole lot of thought and scribbling on paper, I realized I need 5 transistors. After all that, it still took me a bit to realize that I have to go from transistor 4 collector to transistor 5 collector… instead of t4 collector to t5 emitter. Actually, even that isn’t true. It just seems like it is because of how I am optimizing the layout (this just hit me). I’m just going t4 collector to the led (duh … Pbbbt, too much optimizing made this more confusing than it had to be).

    in code logic this experiment would be:

    if( (a && (!b)) || (b && (!a)) ) // ...do

    you could shorten that logic to

    if ( a != b ) // ...do

    but, that doesn’t really tell the whole story. That just claims they can’t be equal but, in reality, one has to be true and the other false else do nothing.

    I used a pencil cause my hand was casting a huge shadow.




    I’m not allowed to use any help of any kind. The only thing I have allowed myself to do is look up pinout schematics or definitions of any parts that I am not familiar with. However in this case that was zero. I already know what transistors, resistors, wires, leds and buttons do. My entire focus on this stuff is using programming skills to write “code” with electronics. If I go read/watch tutorials I’m not going to learn to the same degree. I’m not saying that I don’t study electronics, cause I definitely do. I’m talking about for these little experiments any research beyond the basic data of a part is forbidden.

    http://www.nextgenquake.com/groups/onemadgroup/forum/
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #6297

    OneMadGypsy
    Participant
    • topics: 47
    • replies: 347

    Look at this work of art. I’ve started ordering all my peripherals from Elenco. They don’t mess around when it comes to quality. The breadboards themselves are about as nice as you can get but, mounting them on the metal backing plate and including the terminals brings it to a whole ‘nother level.

    I’m waiting for some more stuff. When it gets here I will definitely be using this board for experiments.

    I drank too much coffee and can’t keep my phone stable enough to take a clear picture. The sticker says “Elenco Precision MODEL 9433”

    #6296

    OneMadGypsy
    Participant
    • topics: 47
    • replies: 347

    Button Bouncing

    In electronics, bouncing is when you press a button once but it sends the signal numerous times. This can be fixed in your code but, I believe that a lot of bouncing can be fixed in your button wiring. Look at this image.

    That is how like 100% of arduino people wire their buttons. Or at least the people making tutorials. I could post hundreds of pictures from tutorials with this wiring concept. There is a fundamental problem with this wiring scheme. Electrons flow from negative to positive. In that diagram it is depicting that they flow from positive to negative. They have the positive coming in to the right of the button and then when the button is pressed it completes the circuit, passes through a resistor and the remaining current gets sent to pin 2 to set it HIGH. This does work but it creates a whole lot of noise and that’s where you get an insane amount of bouncing because, you are essentially using your button (which is nothing but a switch) to manage 2 polarities instead of using it to simply short/connect one polarity.

    Now, look at my button.

    Coming from the black wire on the left, electrons flow through the negative rail of the board into a resistor and into my button. When the button is pressed it completes the circuit and the electrons are sent on their way to the negative lead of my PNP transistor. My button is just shorting/completing the negative current instead of trying to become it’s own circuit. This severely cuts down on bouncing. There may still be some bouncing and that should be fixed with code. It’s possible the bouncing that my circuit creates could be eliminated by simply upping the delay of the main loop by a 100ms or so.

    In order to overcome the bouncing that the first example creates takes all kinds of state checks and micro delays that lead to more state or volatile byte checks. It’s like you wound yourself with a chainsaw while cutting bread and then use 5000 band-aids to seal the wound, when you could start with not using a chainsaw to cut bread.

    You may think something like “Yeah, but your button is not controlling an Arduino”. And you would be correct. BUT, it doesn’t matter. I used that picture because it was already in this thread and showed what I needed it to. Arduino or not, there is no reason to feed both poles to your button. Just break/connect one pole with it and not only do you get a lot less anomalies but, you also simplify the circuit by one wire per button.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.