1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Tutorial Mjoy16 USB AVR Joystick

Discussion in 'DIY peripherals' started by tronicgr, Jan 3, 2008.

  1. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Great post Sokol, 1000s thanks!
  2. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Would anyone be kind enough to post one screenshot of a working MJOY16's EEEPROM?
    Like this:
    [​IMG]

    In PonyProg2000, READ DEVICE, scroll to the end of the buffer, where the letters are BLUE...

    I want it to check the Vendor ID and Product ID
    [​IMG]

    Thank you!

    BTW i am using:
    Wind0ws XP Pro (32bit) SP3, English
    Pentium 4 @ 3GHz
    2Gb of RAM
  3. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    :yippiee: SUCCESS!!! :yippiee:

    I am going to work and i will be right back to post details!!
    I bought everything again, even a breadboard and tried it, IT WORKED!!

    THANK YOU GUYS!! :cheers:
  4. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Nice to hear NuMcA! Please post what caused your problems if you find it out! :clap:
  5. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    NuMcA,

    Good news. :thbup:
    Probably reason for previous failures is: breadboard.
    When you use PCB, will be everything easier.

    Sokol1
  6. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Guys, I am embarrassed to tell you this :blush:, but i was not able to find what was wrong! It DOES WORK now, but i don't know what my problem was. As Sokol has said, i am starting to believe it was breadboard problems, or a problem with the Zener Diodes. I replaced E-V-E-R-Y-T-H-I-N-G, (even the USB cable and breadboard) with brand new parts and it worked! Thank you for your help!
  7. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    If you have a voltmeter you can check your zeners. Just connect them in series with a 1k resistor, connect 5V to the marked side (cathode or negative) and GND to the other. Measure the V across the zener and you should get 3.3V.

    The breadboard could have been the problem, but you said you soldered the circuit together too right? When you do projects on a breadboard look out for component leads touching eachother. It happens to me all the time..
  8. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    In my PCB i had the 82 Ohms resistors BEFORE the pull-up (2.2k) and pull-down (4.7k) resistor!

    But i found it out early, and gave no more look on the PCB (which after all i could not change to fix). So i concentrated on the breadboard. Now, since i cannot find what was wrong on the breadboard, i will go back to the PCB and see what i can fix (hack 'n' slash method...).

    Thank you once again!!
  9. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    On PCB i had the ZENERS before the 2.2k and 4.7k resistors! I was able to fix it and now i am rebuilding my console on the MJOY16 with the already made PCB!
  10. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    The Vref Pot

    Dear Frakk,

    I had read your earlier post about the pot not working in MJoy, but others seemed in thrall of it, so I put it in. Your explanation of how you came to realize it was not 'working' makes good sense. Thank-you for expanding it so it makes sense to ninnies like me.

    Of course, the next question is: should I take out the pot and replace it with the little capacitor for best performance?

    Regards,
    George
  11. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Red Baron

    Hi Frakk again,

    The Red Baron thing is frustrating. I chose to put the Rudder pedals onto Xrot. in MJoy because it is the only other self-centreing axis. My other games recognize the rudder satisfactorily, so I will probably leave it there and be made happy that Sokol has just shown us a Windows 7 version of PPJoy because that will allow Red Baron to run for years to come.

    But that raises the question: just as there are advanttages of Self-Centreing, are there disadvanges of it: perhaps irregularity of rudder function around the centre, or perhaps more aggressive rudder action to one side or the other? It might be that self-centreing is convenient but it also might introduce problems. If there are real disadvantages in performance, then I could connect rudder to the fourth axis even though it is not self centreing and be very happy knowing I have done the best thing! :)

    Any thoughts, or am I just analyzing too much?

    Regards,
    Mark Walsh.
  12. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    CH-Rudder pedals

    And just finally, I can tell you that I have got my Ch-Rudder pedals to work more smoothly than they did. These pedals are not normal flight pedals, in that they work independently of one another. You can use them as Car Pedals. So there are two pots rather than one. Originally I just wired the two pots together but got a really crummy response curve, gentle in the middle but with a parabolic rise after that.

    So I made an adder circuit, which I have attached in case anybody is interested: well in reality I am just writing because I am really happy about this. It is the first circuit I have ever designed myself, and it works just like I wanted it to! :cheers: Sorry about being off topic!

    Regards,
    George.

    Attached Files:

  13. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    A friendly found a bug in Mjoy16-C1 (firmware 1.3) MODE 2 - I tested and confirm:

    In this mode - if jumper in pins 20 (row L) and pin 22 (Column 1) are close, buttons 73 to 112 and POV HAT don't work.

    In MODE 1 - jumper open - all buttons, toggle switch's, encoders and POV HAT work OK.

    Sokol1
  14. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    George, you could take the pot out, but I don't think it will make a big difference if you leave it in, just turn it all the way to 5V. As far as the functionality goes, I haven't played a lot with it, I just tried it out in rFactor to see how the axis react and how I can calibrate it.

    Self Centering is good if you want to set your center point on every startup, right where the axis are currently stand. That means if you have a joystick that has a spring to pull it back to mechanical center, you might want it enabled. Maybe the springs and mechanical setup changes over time and your mechanical center could change compared to your electrical center.

    On the other hand if you have a throttle slider, you want to calibrate the end points, and you want these endpoints in the same mechanical and electrical position as well. If you had auto center on and you left the throttle all the way up then plugged in your MJoy, you would have your throttle calibration lost and your endpoints would be shifted.

    What are you trying to do with your pedals in terms of functionality? Are you trying to get the difference of the two positions? Lets say Left is at position 50 and the Right is at 250, now the output position will be +200 (200 to the right of the center point). Other way around Left is 250, Right is 50, so your position is -200 (200 to the left of the center point) am I correct? If it works the way you want it to then congratulations on your achievement! :D

    Sokol thanks for the information!
  15. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Re: CH-Rudder pedals

    Well done George!!

    :lol: you are truly a Hardware FAN!!! There is way of doing it through software and PPJOY! You can combine the 2 axes into 1 virtual axis. This can be done through Glovepie. I created a subtract-er (exactly opposite of your adder), because i wanted to use a PSP joystick as brakes ONLY.

    Code:
    ppjoy1.Analog0 = 2*(joy1.slider) + 1
    
    which means that the #1 virtual axis on PPJOY is binded with the Slider axis (PSP mini-joystick) of joystick#1. But it uses values of Slider from 0 to 1.
    
    Example: 
    If the PSP joystick is centered, then i should have SLIDER = 0 and PPJOY.analog0 = 1 (UN-pressed brakes) 
    If the PSP joystick is FULLY pressed, then  SLIDER = -1 and PPJOY.analog0 = -1 (FULLY pressed brakes) 
    
    See BRAKES axis:
    [img600px]http://i202.photobucket.com/albums/aa220/klapatsimbanos/MiniSTICK/expl.jpg[/img600px]
    More pictures here, at my blog: Miskatonic-Tech: Mini joystick

    I hope it helps... I am a software nerd myself..
  16. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Thanks for the encouragement, Gentlemen.

    Frakk, as I push the left pedal, the voltage out from the rudder pedals falls, and if I push the right pedal the voltage out increases. I could not think of a really good way of joining these two pedals together to get one output value of voltage. The best way I could come up with was to simply join the two resistors in the middle and make that the output, and have the sliders on each pot taking the 0V and 5V respectively. Done this way I get the Voltage output and pedal sensitivities as in the attached spreadsheet. This is very tricky to fly with because of the very steep increase in sensitivity away from the centre point because the total resistance of the voltage divider decreases. Also, if I leave one foot pushed on one pedal while I push the other as well (easy to do because the CH-pedals are not mechanically linked) then the sensitivity actually increases more - the total resistance of the voltage divider DECREASES even faster.

    I think that my circuit (although I haven't checked it absolutely with a voltmeter, just by flying around and by looking at the show raw values output in the Win XP games controller calibration window) provides a linear sensitivity (volts out versus amount of push on the pedals) by adding the voltage of each pedal (related to an effective zero point of 2.5 Volts - half whatever voltage the USB port is supplying), and that there is no terrible problem if I leave one foot pressing on the wrong pedal a bit, except that it is a bad habit to be in if shooting.

    Maybe I am not explaining myself as well as I could, but I am going to shoot down the enemy for a bit now!

    Mind you, if anyone else has another way of wiring two pots together to get a single voltage out for USB to use, I would appreciate it. I thought I had tried most other ways and they all gave quite crazy results.
    Salute,
    George.

    P.S. Note for all you mathematicians out there, that the formula for the voltage out was a best fit by Excel. I did not try to work it out algebraically. The derivative was based on that formula and could be quite wrong. I might look at that one day.

    Attached Files:

  17. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
  18. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    About Mjoy16 MODE2, I ask in AviaForum and response from AlexOz make sense:

    MODE2 is to allow use of 4 ENCODERS (16 buttons) and 8 TOGGLE SWITCH (16 buttons) in Windows mode - limited to 32 buttons.

    To use more than 32 buttons you need a mapper software (ie SVMapper, JoyToKey...), and if you use one, use MODE1.

    Sokol1
  19. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    George you are on the right track with those op-amps. I have to refresh my studies about them but it is quiet simple to use them actually. An other good way would be to use only 1 pot and mechanically connect the pedals for a synchronized movement.
  20. dnlk21

    dnlk21 New Member

    Joined:
    Dec 7, 2009
    Messages:
    8
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi all,

    I just finished building a mjoy, have been following this thread for guidance. Construction went well, but I am having problems programming. I am using Mindaugas' programming cable, and have double checked the pinouts. When I first hooked it up, all seemed well. PonyProg read the chip, erased the chip, and wrote the chip, all without errors. Then I set the config and security bits, again, according the Mindaugas' instructions. Then came the Device missing or unknown device (-24) error. Now I cannot do anything without getting that error. I even tried removing the atmega and putting it on a breadboard with +5, Gnd, MISO, MOSI, Reset, and SCK only. Still got the same errors.

    Anybody have a suggestion for me. I was thinking about making a serial programmer, but need to get some 5v1 diodes.

    Any help would be appreciated.

    Thanks,

    DNLK