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. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    Samples of SVMapper use - in IL-2 Sturmovik:

    [​IMG]

    Button 1 and 2: ON-OFF (toggle) switch, button 3 push (momentary) button.

    So, you have a visual feedback of landing gear position, and a automated LG in F4F and i16. TS PTT button open mic while pushed.

    Notice that SVMapper alow to use multiples profiles using Profile on press and Profile on release functions.

    And about Mjoy16 layout: is convenient change the axis signal inputs pins for this sequence:
    Signal
    Gnd
    +5V

    If any axis is unused, put a jumper over Signal + Gnd pins to minimize spikes in these axis.

    With original sequence:
    Signal
    +5V
    Gnd

    Is difficult to put jumpers to ground these axis and alow marge for mistake (signal and +5V).

    Sokol1
  2. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    The SVMapper looks great. About the analog inputs, when I started to redo the original board for the controller(pg5 I think) tronicgr suggested to use this layout. He said I think a AMC1.5 feedback pot like pinout: (S + -), is easier to design on pcb near the Atmega16 chip and more immune to noise!

    As far as I'm concerned it doesn't matter in terms of pcb design. When we don't use them, we don't really care about where those axis are (the last used pin will controll the rest). I agree it would be a good practice to do it as you suggested and I'm open for any changes and other's opinion.
  3. Sokol1

    Sokol1 Member

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

    Me observations about analog inputs pins is based in pratical use of Mjoy(8) and Mjoy16.
    For some reason Mjoy is high sensitive to noise, so if you connect potentiometers in all axis imputs, and use shielded cabbles, all work fine.
    But, if you leave some axis not connected to pot, HALL sensor... this axis start to spike.

    In AviaForum (http://www.sukhoi.ru) wheres Mindaugas (Mean Dog) start Mjoy project back in 2004, they recomend use jumpers (like ones used in motherboards) to ground unused axis, so if Signal are close to Gnd is more easy to do.
    No other reasons to do this change.

    Sokol1
  4. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Thanks Sokol for your input and sharing your experiences! As I said, I agree it is a good practice to use the jumpers and I will post an updated layout once I'll have time. I wish there was an english translation of that forum :)
  5. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Here is what I would say the first official version of the redesigned PCB. I made it so it would be easy to make at home with minimum trace width and copper distance of 0.8mm (except at the USB connector), even more where it was possible. I reduced the number of diodes to 12 to make it even simpler and included pads in addition for an INIT pushbutton. The pins for the analog inputs are also changed as Sokol suggested, now a jumper can simply disable them connecting to ground. The crystal capacitors and the inductor are placed inside the IC socket to save room and tight pads/traces.

    MJoy16C1.GIF MJoy16C1bottom.GIF MJoy16C1top.GIF IMG_5867 (Custom).JPG
    The next step will be a separate controller and matrix board.
    • Like Like x 1
  6. gregers

    gregers New Member

    Joined:
    Jun 8, 2009
    Messages:
    2
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
  7. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Thanks gregers, if you post that board about 2 months ago I may not have started to do this one. There is only one problem with the board you posted, and that is getting it made. For a 2 layer pcb with plated through holes and such tight traces between the pads, this board has to be orderd from a pcb manufacturing company. I designed this board specifically for those who want to make it at home with only what is necessary. It is only 1 layer, minimum copper width and distance is 0.8mm and reduced number of components, and it still only measures 13.5x8.5cm. I could add the additional 8 pulldown resistors without any significant change in the layout too, although that is not necessary because they are connected to ground internally when not high anyways.

    Attached Files:

  8. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Dear Frakk (and Sokol if you are still watching),

    I am just about to burn my board, so these questions will help determine my final alterations:

    1. Do I need to worry about the resistors that Sokol describes? What do they do?
    2. Looking at what you have said, Frakk: can we do with that smaller number of diodes? What advantage is there of having the 50+ diodes (one per switch) as compared with your scheme (one diode per digital circuit)?

    Using only 8 - 12 diodes would make re-wiring my joystick buttons much easier: to use wires in the joystick rather than diodes.

    3. I have read that the diodes should be as close to the switches as possible. The lead from my joystick to the Mjoy was going to be 1.8m. Is this too long for your arrangement?

    4. I think you could do the wiring with just 8 diodes, anode to each of PC0 - PC7. Is that an alternative to your arrangement - 12 diodes with cathode to PB0 to PB7 and PD4 - 7?

    Thanks to you all for your input, and a special thanks to Sokol for his visit. Now all we need to do is have Mindaugas visit and everyone who is important will have been here!

    Regards,
    George.
  9. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    George:

    1. As I posted before, I don't think they are necessary. The way TTL logic and the matrix key system works, the outputs from the column connections will be Low/0V/Gnd, except for a scanning High/5V/Vcc that goes from 1 to 8 over and over.

    2. I do not beleive there is any advantage of having more diodes than 1/input (rows,12 diodes) or 1/output (columns, 8diodes).

    3. Technically for our application it doesn't matter where you put the diodes. I strongly recommend using shielded twisted pair wires for all signal cables, such as the cat5 network cable connecting the shield wire to ground, if you haven't already done so. You can share Vcc and Gnd between analog inputs to reduce connector and wire size too, a 10pole shielded wire will take care of all 8 analog inputs.

    4. Yes you could do the wiring with just 8 diodes, that is exactly why I wrote 8-12 diodes! The diodes have a 0.7V drop, anything below 0.7V will be absolutely blocked. Although I don't beleive the diodes are critical in the operation since the input High threshold of the IC is higher than that.

    Please note that all my answers are based on my tests with the breadboarded circuit and my theoretical knowledge. I haven't noticed any ghosting or unnatural operation without any diodes or the 8 pulldown resistors, but that doesn't mean anything.

    George, on your circuit I would make these connections easily changeable (diode and resistor placements) in case one works better than the other. It really takes only 5mins of soldering. I think everyone would thank you for trying out the different options and see what difference they make in real life operation. And if you posted pictures it would be even nicer!
  10. Sokol1

    Sokol1 Member

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

    These 8 resitors in pins 21-29 appeared in some revisions of PCB made by russian/poly users. Seemingly, without him begin to appear ghost buttons when used all of the possible buttons, ~120 include HAT.

    Same case for one diode in each button. Probably, with an smaller number of buttons being used this had not happened.

    But if your new scheme work whitout ghost buttons is very nice.
    Plenty simplified the buttons connections.

    GeorgeBoles,

    If you objective is re-wire a old gameport stick to USB, I sugest that you make one these small PCBs whitout key matrix. In case has not made one. :thbup:

    Sample (~57x34mm): http://aviasimrus.spb.ru/forum/showthread.php?t=1014
    This PCB requests capacitors with 2,54mm betwen terminal (pins).

    Then you put PCB in the base of joystick and can use shorter/less cables.
    In this case, put one diode in one terminal of each button/HAT, and wire according to the key matrix scheme.

    The eletric circuit and .HEX (firmware) these small one is same used by Frakk, when Mindaugas leave the Mjoy project he liberated the Mjoy16 code for DIY use, but blocked it for edition, the only thing that can change in HEX is the name - with 4 letters - and the vendor ID.

    PCB with key matrix is good to button box or cockpit, but complicated to use in joystick re-wire.

    Sokol1
  11. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Hi Folks.

    I cannot believe that i am stumped by this but looking at the little programmer that Mindaugas draws in his old docmuantation: http://www.qsl.net/ba1fb/avrisp.gif

    Are all of the following correct?

    1. That the pin numbers refer to the little numbers embossed on the D-sub connector,
    2. That the diagram is looking at the parallel port on the back of my computer, and
    3. That the diagram is also looking at the BACK of the male d-sub plug that I need to plug into my computer.

    I do not want to blow up my new USB Mjoy or my new computer, so confirmation would be appreciated please.

    Regards,
    George
  12. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
  13. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Just refer to the numbers on the connector. If you are looking into the connector, wider side on top, upper left is pin 1 and lower left is pin 14. Mindaugas' picture is looking into the parallel port in the computer. This pin out is what ponyprog uses. Other programs might use different pins, it is quiet easy to change them around so don't worry too much about it. All you need to know is which pin is which in terms of programming output.
  14. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Thanks, Frakk. Appreciated.
    George.
  15. jeffreymstrong

    jeffreymstrong New Member

    Joined:
    Jul 20, 2009
    Messages:
    4
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Frakk will you be posting the PCB (for laser printing) and Sprint Layout file similar to how Senetor did on this post?
  16. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    What format would be best? SL doesn't export pdf files unfortunately, only BMP, JPG, GIF, EMF and the Extended Gerber. I could post any of this, or the lay file if that is usefull for anyone?
  17. jeffreymstrong

    jeffreymstrong New Member

    Joined:
    Jul 20, 2009
    Messages:
    4
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    You can print to PDF via CUTEPDF (Great free tool), and the .LAY file would be useful for some as well.
  18. Sokol1

    Sokol1 Member

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

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
  20. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    I just printed the pdf on paper, took some measurements and it looks like everything shrunk a bit. I dont know if its my printer or the pdf is wrong. Please measure the dimensions after printing to make sure the holes fit. The board outline should measure 13.5x8.5cm as I posted before, and also check the IC legs and the pin headers, they should be 2.54mm apart, 2.54cm for 10 pins, and 5.08cm for 20 pins.

    Edit: It was my printer setup, make sure to use paper sizes and scales from the pdf file with 100% zoom. The border dimensions are still a bot smaller but the hole distances are correct. I should have moved the drawing further from the edges.. Sorry but i havent made any pdf files before yesterday :blush: I will adjust it asap.
    Mjoy16V1copper.pdf