1. 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.
    Dismiss Notice

I'm exhausted, and a newb...

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by Franknstein, Apr 19, 2007.

  1. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    Hi all, hope someone can point me in the right direction with the circuit i've built. I'm not an electronics engineer or anything, dabbled in a couple of cicuits and stuff over my lifetime, mucked about with Dick smiths beer powered radio's and stuff like that.. this is the first cicuit of any complexity (to me at least) that I've designed.

    I basically do a lot of car racing simulator component building as a hobby, and until now, interfacing with already made joysticks and USB devices has been pretty easy as I just take them apart and wire in remote switches to the circuit boards to perform what I need to do (ie. make a pseudo gearbox out of wood and stuff, and have 6 microswitches at each gear gate, which close the circuit on each corresponding button on the joypad)... you get the idea I'm sure.

    Now, I bought this premade gearshifter for sim racing the other day, and its really old, and features some weird cartidge system and a DIN plug of sorts. I dont have anything to plug that specific DIN plug into my pc, and need it to be USB.

    The shifter works in the following way:

    1 2 3
    |_|_|
    | | |
    4 5 6
    (it has gears 7 and 8, but I blanked those off cos its rubbish)

    The shifter shaft works exactly like a cars one does.
    Now, see my post here: http://forum.rscnet.org/showthread.php?t=288167

    Something important to note is that when in neutral, obviously none of the microswitches in the shifter are closed...
    3rd and 4th gear are easy because they are either the 'green' or 'blue' wires independantly.... but 1,2 and 5,6 are combination switches... AND - when you move the shifter to the left side it will activate the microswitch with the yellow wire first, then when you shift into 1st or 2nd it activates either green/blue wire together with the yellow... what i'm saying here is that I dont want the yellow wire (or the red wire for the right hand side gears (5,6)) to activate any button on the remote USB joystick.... So my whole thinking was to break the circuit into three sections:

    1. -green/blue are normally closed (Activated) when in Neutral.
    -red/yellow circuits are deactivated

    2. -when yellow is activated (circuit now knows its moving to left axis)....
    -deactivate green/blue for remote gears 3 and 4
    -activate circuit green/blue for remote gears 1 and 2.
    -all circuits on red wire (right side of gearbox, ie gear 5 & 6) are
    deactivated.

    2. -when red is activated (circuit now knows its moving to right axis)....
    -deactivate green/blue for remote gears 3 and 4
    -activate circuit green/blue for remote gears 5 and 6.
    -all circuits on yellow wire (left side of gearbox, ie gear 1 & 2) are
    deactivated.


    Well, thats how it makes sense in my head, I hope someone here can follow my logic and really look forward to a response that could be of any use. After all the hours I've put in and it doesn't work (on the pc, it works with my multimeter set on CONTINUITY, testing each gear) I am really dissapointed.

    I tried drawing up some logic charts with XAND/XOR symbols that I remember from computer science and just could not wrap my head around the logic of it that way....


    Look forward to any reply!
    Thanks!
    Ryan
     
  2. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    Anyone got any ideas?
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi ryan,
    Looked at the link, copied this post so I can get my head round it off line!.

    If I can suggest an idea, what logic devices etc do you have available??

    Which part of SA, if you dont mind me asking??, I get to PE once a year.

    Regards
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0

    Hi Eric

    Thanks for the reply. I suppose I have many logic devices available, I mean, I really dont mind what I use, I just thought relays would be the simplest... but if I could use diodes or transistors or even an IC I will do it... I just cant seem to bust this circuit.... I've now tried redesigning the whole circuit, and the only way I see it working is to use like 10 relays, which I am really sure is not necessary!!! Any help would be appreciated...

    I stay in Johannesburg...

    tnx
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi ryan,
    Working thru your dwgs and text. Im drawing a block diagram, when finished I will post it.
    Look thru it and check the idea, if OK, then we can give you a logic diagram.

    I know someone in Oz, who will be able to come up with a relay option.
    hi Len.
     
  7. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    Brilliant! Thank you so much! I owe you big time...
     
  8. philba

    philba New Member

    Joined:
    Mar 12, 2006
    Messages:
    1,886
    Likes:
    8
    Location:
    Seattle
    This is a fairly simple logic problem though there is a little complextity involved.

    You have 5 input values (sw1-5) and 8 output values (gears 1-8). There are many ways to solve this however you mention USB so that pretty much implies a microcontroller. There are a number of PICs that implement USB that could be used for this task.

    Determining which gear is fairly simple in a PIC/microcontroller - take the 5 inputs as a 5 bit number and use it to index a 32 byte table. Each bit in a given table entry would indicate which gear was engaged. So, bit 0 set to 1 would indicate 1st gear, bit 1 set to 1 indicates 2nd and so on. all bits zero would indicate neutral.

    You can figure out the table by doing the following table
    Code (text):

    Switches            gears
    1 2 3 4 5          1 2 3 4 5 6 7 8
    0 0 0 0 0          0 0 0 0 0 0 0 0
    ...
    0 1 1 1 0          0 0 0 0 0 0 1 0   <-- SW2,3,4 -> 7th gear
    ...
    1 0 0 0 0          0 0 0 0 0 0 0 0
    ...
    1 0 1 1 0          0 0 0 0 0 0 0 1   <-- SW1,3,4 -> 8th gear
    ...
    Figure out the other 6 gears.


    Outside of a microcontroller/USB, you could solve this with a small EPROM if you have access to an EPROM programmer. Just use the 5 inputs as the address and the output byte as the 8 gear indicators similar to the PIC example above.

    Or you could use 2 3 to 8 demuxes (like the 74HC138) to generate the 8 gear signals. Use SW 1 and 2 to select which chip and run SW 3,4 and 5 into both chips' inputs. Then it is a small matter of picking out which of the 16 outputs means a specific gear (use the above table, again). The outputs will be inverted so you will need to deal with that but it's easy. You can deduce neutral ANDing SW1 and 2 together. You should be able to run the outputs directly into the switch inputs on your USB interface if they are pulled high switches as well.

    note, when I say use a given switch as input, you will need to use pulled high switches using pull-up resistors. this gives you active low logic - a bit value of 0 is actually a high voltage and a 1 is a low voltage.
     
    Last edited: Apr 23, 2007
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi ryan,

    Philba, has described in detail a good option, if he has covered what you need,let us know, so I can set the project to oneside.

    Regards
     
  10. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    Hi guys

    ok, I understand the very basic theory of what Philba has described (thanks for taking the time btw). I have no problem with using preporgrammed CMOS ic's, as I dont have access nor the knowledge to burn my own.

    So if this 74HC138 chip is easily available, I can get two of them tomorrow. I will need help with the wiring diagram, I opened the PDF of the 74HC138 and it shows inputs select 'A,B,C' and then enable 'G2A, G2B, G1'.... whats select and whats enable... I know theyre inputs and I understand the binary logic table, and understand how the input binary corresponds to the outputs etc, but I have no idea how to wire this all up the real world...

    Also, the USB joystick is powered up via the computer power supply, through the motherboard and through the USB cable into the joystick board. All I need to do is close switch, I dont need to put any external power through the switches (correct?). I understand you need a power source to power the 74HC138 IC's, do I tap into the power from the USB joystick, or use a seperate power supply (ie a battery).. and if I use a seperate power supply, would it not put extra current through the USB joystick board which I dont want? All I need to do is close the switches?

    When you talk about active low and pulled high and pull-up resistors, I am completely lost :(
     
  11. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    Yes, I'll design a relay one for you if you wish. Just post the details of what you need. I don't feel like wading through all of the above. Either Eric's block diagram or complete the table as posted above by philba would do.
     
  12. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    If I could do it the relay way that would be awesome, because its something I understand a lot more than IC's... Here is the table below... just keep in mind that whenever an output requires a combination of two switches, the switchs never get switched at exactly the same time, its always one before the other. Thanks again!


    Switches gears
    1 2 3 4 5 || 1 2 3 4 5 6
    -=-=-=-=-=-=-=-=-=-=-=-=-
    0 1 0 0 1 || 1 0 0 0 0 0
    ...
    1 0 0 0 1 || 0 1 0 0 0 0
    ...
    0 1 0 0 0 || 0 0 1 0 0 0
    ...
    1 0 0 0 0 || 0 0 0 1 0 0
    ...
    0 1 1 0 0 || 0 0 0 0 1 0
    ...
    1 0 1 0 0 || 0 0 0 0 0 1
     
  13. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    A good friend of mine helped me with the logic circuit this evening. So I've come up with this diagram which looks pretty promising, couple of questions though:

    1. Can I use the power from the USB joystick (use my multimeter and try find a terminal with like 5v or something when its plugged in? Or could tapping into the power on the board cause a drop in voltage or something?

    2. Looking at my new diagram below as it stands, do I need to add any resistors or anything?

    3. Will current flow through the switches on the joypad switches coming from the outputs of the IC's? Or does will it just close the switch?

    here are the diagrams I've drawn... I've split it into two, otherwise there is just too much wire and it becomes confusing.


    logic:
    -=-=--=

    yellow & green = gear 1
    yellow & blue = gear 2
    green = gear 3
    blue = gear 4
    red & green = gear 5
    red & blue = gear 6

    diagram 1:
    [​IMG]

    diagram 2:
    this shows how each gear is wired to the USB joystick, and how I have made the joystick common ground common with the grounds on the IC's... and the power source tapped into the USB joystick too... Any resistors needed anywhere here? Any suggestions?
    [​IMG]
     
    Last edited: Apr 24, 2007
  14. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    Here is the relay one. Switches 2 & 4 are not required.

    The diodes protect the switch contacts from the back EMF when a relay is released.

    All outputs should have a 4k7 pull up resistor as shown for G6.

    Sorry about the scribble, I'm a bit busy.

    EDIT.
    From your original diagram, it appeared that the outputs had to be active low. So I designed the circuit for AL.

    But the table you posted indicates that they are active high.

    Also, what is the USB joystick interface? Is it TTL or CMOS? If TTL and the JS requires active high signals, then I'll have to alter the circuit.

    If it is a CMOS interface, then all you need to do is connect +5 Volt to the lever spring of relay S3 and replace the +5 Volt behind the resistor with gnd.
     

    Attached Files:

    Last edited: Apr 24, 2007
  15. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    The NOR package should be a NAND. But it could be done with only 2 ICs. If you want to do it this way, let me know and I'll post the circuit.

    The PD resistors are required to cause the input voltage to change when a switch is opened or closed. When open the input voltage will be 5 Volt, when closed, 0 Volt.

    EDIT
    My edit to the previous post is also partly relevant to this one.

    The outputs of this circuit are active high.

    You also need to know what the JS interface conditions are, ie. TTL or CMOS.

    You did not indicate what ICs you would use in this circuit. If TTL, then you don't need the PU resistors. But if the JS needs CMOS levels then you will need CMOS ICs.
     
    Last edited: Apr 24, 2007
  16. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    Thanks for your help LJCox, I really do appreciate it.

    Firstly, please explain why I should be using a NAND and not a NOR for the 2nd IC, because that would suggest that only when red and yellow wires are '1', does the the gate open... (its impossible for both red & yellow to be '1' at the same time), so this would be a null and void package to use???? If not, please explain?

    Thanks for the relay diagram, I really appreciate your efforts. A little confused by some of the symbols you have used:
    [​IMG]
    Where I've circled, I can see a diode on the left, but whats to the right of it?

    Yes, I think the inputs to the joystick will require Active High.

    Not sure if its CMOS or TTL, will check tonight. But checking this description of the difference between the two, http://www.epanorama.net/phpBB2/viewtopic.php?t=2431& I see they both require almost the same input voltage, and the output voltages are very similar too... so why would I need resistors for the TTL and not the CMOS???? Please explain.

    I would like to try do it with the IC's and with the relays... as I'm using this as a learning experience too... and would like to experiment with both. So if you could post a circuit with the IC's too, it would be very helpful to me.

    tnx again
     
  17. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi ryan,
    The symbol to the right of Len's drawing, that you have circled is the '+' [plus sign] which indicates the positive supply end of the relay coils.

    EDIT: the way a TTL input is designed, is such, that if it left 'open' it will pull itself up to a logic '1' [high, about 2 to 3V].
    BUT a CMOS input has a very high input impedance and if left 'open' could be either high or low or possibly oscillate

    Regards
    Eric
    Len I'm in the UK.
     
    Last edited: Apr 25, 2007
  18. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    I'll post a circuit for you later today or tomorrow.
     
  19. Franknstein

    Franknstein New Member

    Joined:
    Apr 19, 2007
    Messages:
    53
    Likes:
    0
    Ok checked out the joystick board.... theres not even one IC on the board... not sure what to check for now???
     
  20. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    Attached are 2 options and my gating paper which may help you understand the circuits.

    I converted your table to employ H & L rather than 1 & 0 as the latter is confusing when negative logic is used. (In negative logic, H = 0 & L = 1)

    I chose the ICs as follows:-

    For the Active High (AH) option, for U1 I needed an AND gate with an AH output and Active Low (AL) inputs - a NOR package.

    For U2 I needed two 3 input AND gates with an AH output and AH inputs. But these are not manufactured as far as I know. So I used a quad AND.

    For the Active Low (AL) option, for U1 I needed an AND gate with an AL output and (AL) inputs - a OR package.

    For U2 I needed two 3 input AND gates with AL output and AH inputs - a triple NAND. Alternatively, a dual 4 input NAND would do.
     

    Attached Files:

  21. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    You said above that it is a USB joystick. So I assume you mean that it plugs into the USB port of a computer. Is this correct?

    I don't know much about USB, but sounds to me more likely that it plugs into the serial port.
     

Share This Page