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

    tirta Member

    Joined:
    Feb 4, 2010
    Messages:
    56
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi Frakk, Sokol1, Senetor, NuMcA,

    Thanks guys for all the replies. :hi:

    I have misunderstood these toggle switches. :no:
    I thought I need only one for all 16 buttons. :blush:
    Well, if 16 switches are needed, I think this is too much work,
    I change my mind, I will not use toggle switches now, maybe in the future project.

    And to save cables, I have changed the plan for 20 buttons on throttle:
    B1, B2, B3, B4, B5, C1, C2, C3, C4, C5,
    D1, D2, D3, D4, D5, E1, E2, E3, E4, E5.
    5 columns and 4 rows and 3 (axis), so the total is 12 cables.
    Is this correct?

    I notice that the original CH cables use 15 pin DB-15 connector,
    so I can reuse the connector.

    Can I use the original CH cables?
    or is it better to use microphone cables? only for the axis?
    or for all the buttons, too?

    What are the reason choosing the microphone cables?
    Low resistance?

    Today, the pcb is finished and I have bought all the parts.
    However, after looking more carefully at your layout,
    I find the USB-B that I got, has a different pins configuration.
    Mine is 4 pins in a straight line.
    Here is the picture:
    [​IMG]
    Sokol1, could you tell me how to connect it to your pcb?
    Vcc, Gnd, D-, D+, what is the correct order?

    Sokol1, here is the dxdiag:
    Can you change the Product ID?
  2. Sokol1

    Sokol1 Member

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

    About the ID question.

    I plug two Mjoy16 in my PC, and get these numbers:

    =======================================
    Device Name: MJ16 (original HEX)
    Vendor/Product ID: 0x0000, 0x0002

    Device Name: MJ16 (modified HEX)
    Vendor/Product ID: 0x0903, 0x0002
    =======================================

    The DXdiag report show numbers in Hexadecimal, I use Windows calculator
    to convert in Decimal (I dont understand Hexadecimal numbers :D ):

    MJ16 (original HEX)
    0x0000 = ID 0000


    [​IMG]

    MJ16 (modified HEX, to appear after any joystick)
    0x0903 = ID 2307

    Your device:

    Bluetooth HID Joystick

    0x057E = ID 1406

    I think that you won't have problems with ID.

    BTW - Others IDs:
    Sokol1
  3. willynovi

    willynovi Member

    Joined:
    Feb 13, 2009
    Messages:
    64
    Location:
    Argentina
    Balance:
    354Coins
    Ratings:
    +2 / 0 / -0
    As you know I built a PIC based controller and I plug two device on my PC with the same firmware, so the same ID and both actualy work fine. One is recognized as original and the other as clon.

    So I think there is no proble to connect two or more indentical boards, all will work.

    regards
  4. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    OK (5x4=20).

    Yes, you can reuse DB-15 connector and cable of CH, but in spite the use 15 pins in connector
    they dont have 15 internal wires - I dont remember correctly number, you need check, probable the cable leaving CH PRO Throttle have more wires.

    Cut the cable next to original gameport circuit, and with aid of multimeter (or a battery and one lamp or LED and two wires) identify which wire go to each pin in DB-15. Take note.

    So you solder wires leaving Mjoy16 to female DB-15 fit in Flightstick wall accord original cable.

    And solder another end - without DB-15 connector in CH PRO Throttle buttons, HATs and pots.

    That's all.

    As I say above use original CH cable to plug Throttle into Joystick.

    Use microphone cable (shield) to wire pots of X and Y cable.

    If after test you find spikes in throttle axis, use one microphone cable
    to this axis.

    Because they are less sensible to electromagnetic interferences. :)

    But you can test with common wires (not shield) too.

    Good news!

    Ooops. Houston, we have a problem.

    You got a USB-A connector, no USB-B!

    These dont fit in last layout that I draw.

    See here:
    http://pinouts.ru/Slots/USB_pinout.shtml

    You can use these only if fit external of Mjoy PCB and solder wires to their pins and Mjoy16 PADs. (Not too K.I.S.S. friendly :brows: )

    Sokol1
  5. Sokol1

    Sokol1 Member

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

    In case of Mjoy16 you can easy change Vendor ID and device name (1) during the write firmware process.

    (1) Device name dont make difference for Windows, only Vendor and Product ID.
    But for games is convenient different names.

    This part I don't understand, but using trial and error method I got to change.
    Mjoy8 take more work, I need to reassemble the HEX, and in spite of zero knowledge in programming, hexadecimal numbers... I managed to do. :rofl:

    Sokol1
  6. MMASailor20

    MMASailor20 New Member

    Joined:
    Feb 8, 2010
    Messages:
    8
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Frakk, I'm new here nad I have a quick question for you regarding the components. The 2k2 on your layout: is that an Inductor or a Resistor? I wanted to be sure so I would get the right part to build this puppy. I was searching Mouser and searching 2k2 came up with a bunch of Inductors and Resistors which all look the same so I wanted to avoid being confused
  7. MMASailor20

    MMASailor20 New Member

    Joined:
    Feb 8, 2010
    Messages:
    8
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Sokol I don't know if you could answer that either...would it be presumable that it would be a resistor unless there was a unit next to it such as 10uH? On the diagram there are a few items that only have numbers and nothing after it...would those be resistors? I know things like 15pF is referring to a capacitor and 3.3V is referring to diodes, just the inductors vs resistors was confusing me a little bit.
  8. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    You are right, the 10uH is the inductor, the rest are resistors. 2k2 just refers to 2200. Inductors are usually small values such as 1mH, 10uH, so the number in front will never exceed three digits, 150H is the largest I have seen commercially selling, and they almost always have the H after them if the number is stated on a circuit board. Try to search for 100H+ inductors, there are not too many... On the other hand, standard resistors range from a couple milliOhms to couple hundred MegaOhms and for simplicity they are usually marked as 31M, 4k7, 390 and so on.
  9. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    To fit in major Mjoy8/16 layout posted here, you need Axial Inductor (another types are square, coil, SMD...) like:

    Inductor 10uH (L1) = color stripe: brown, black, black, silver (10%)

    [​IMG]

    Resistor 2,2k (2k2) = color stripe = red, red, red, gold (5%)

    [​IMG]

    Resistor 4,7k (4k7) = color stripe = yellow, violet ,red, gold (5%)

    Resistor 82 ohm = color stripe = gray, red, black, gold (5%)

    Resitor 10 k (for pull up) = color stripe = brown, black, orange, gold (5%)

    Instead 8 x 10k resistor you can use one these - made the same thing but is more elegant:

    [​IMG]
    8x10k SIP (9 pins) resistor network.

    Resistor calculator: http://www.hamradio.cc/electronics/resi ... ulator.php

    Ceramic capacitor, like:

    [​IMG]

    Dont use Polyester capacitor type!

    Polarized electrolytic capacitor, like:

    [​IMG]

    Crystal (quartz) 12 MHZ:

    [​IMG]

    USB-B connector (optional):

    [​IMG]

    Connector Strip 40 Pin Header (MALE) - to put pins in MJoy PCB, cut accord need.

    [​IMG]

    40 pin bar connector (FEMALE) - to make plugs for Mjoy pins, for hook axis, buttons:

    [​IMG]

    Cut accord need, like these for BU0836:

    http://leobodnar.com/products/BU0836/connectors.jpg

    Basic kit to build Mjoy8/16, substitute the perforated board for layout of his preference (and buy ATMEGA socket accord version= Amega8: 28pins or ATMEGA16: 40 pins socket.

    http://www.aviasimrus.spb.ru/forum/atta ... 1201195678

    Picture of ATMEGA16-16PU microcontroller:

    [​IMG]

    Add PCI pins, and 8 x 10k resistor to pull up (look at Frakk post subsequent to this - he advise that these resistors are not necessary).

    Sokol1
  10. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Extremely helpful step-to-step guidance Sokol1, everyone appreciates it!!
    THANK YOU!
  11. tirta

    tirta Member

    Joined:
    Feb 4, 2010
    Messages:
    56
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi Sokol1,

    Thank you for the pictures.
    It really clarify a lot of things :clap:
    Too bad I have done my shooping. :no:

    My inductor is rather bigger, round and in brown color.
    Can I use this type?

    And I get this ceramic capacitor:
    [​IMG]
    is this the wrong one?
    which type should I get? :?
    Please post the picture of the right one.

    Whops, another mistake. :blush:
    well, I have to go to the store again tomorrow, maybe I can exchange it.

    You means because the Mjoy16 is 0000,
    it will be on the top?
    so the smallest number always on the top of the list?

    I have just looked at your thread again on simhq.
    You moved the front HAT switch of the pro throttle to the combatstick.
    A very good idea since that button is rather hard to use.
    Is it possible to move that button to CH Flightstick?
    Have you ever done it?
  12. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    Well, i the last layout that I post, to make PCB smaller, inductor is fit under ATMEGA16, like in Tsinik layout. If this brown version have a big diameter than one 1/4 watt resistor is probably that not allow correctly fit for Atmega16...

    A palliative solution: since this Mjoy16 is to fit inside joystick, put the Inductor in trail side of PCB (solder side).

    In some Mjoys that I assembly, need use a big (10x5x10mm) one, these dont fit under ATMEGA16. Actually I find online these axial type.

    No, these of the picture is the right one :thbup: , ceramic type - only value is different, 15 pF are labeled 15 and 0,1 uF labeled 104.

    Yes, in this way.

    No, I dont do this in Flightstick, since i dont have another CH Pro Throttle, these are very ray here.
    And vendors of gameport versions in Ebay dont like to send used things to rest of the world... :(

    I plan to put a extra thumb button in Flightstick in the same way that has in Combatstick, in the left side of grip, whit some plastic surgery, that is simple. Is relatively easy to you move front HAT of PRO throttle to this position.

    Fit these HAT in top of Flightstick is doable, but need some modification in top PCB.

    Sokol1
  13. tirta

    tirta Member

    Joined:
    Feb 4, 2010
    Messages:
    56
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi Sokol1,

    I am confused about the position of eight 10k resistors (R1-R8) on the pcb .
    Do I have to put them vertically?
    Then connect all the upper wire part of the resistors together and to hole on the right, follow the red line? :?

    Good idea, I think I am going to do this, and connect the inductor by wire. :thbup:

    And for the programming software for mjoy16, do I use ponyprog v2.07c?
    or is there newer version?

    Sokol1, I have question about the matrix table:
    I use the same column number for both joystick buttons and throttle buttons:
    joystick buttons: A1, A2, A3, A4, L5, L6, L7, L8
    throttle buttons:
    B1, B2, B3, B4, B5, C1, C2, C3, C4, C5,
    D1, D2, D3, D4, D5, E1, E2, E3, E4, E5.

    so column 1, 2, 3, 4, 5 are used for both.
    how do I connect the wires?
    Do I connect 2 wires directly to the pin on the pcb, one goes to joystick and another to throttle?
    or
    Only 1 wire connected to the pin, and that same wire goes to throttle, after connecting through all the buttons on joystick?

    Which one is correct?
    Please advice.
  14. Frakk

    Frakk Active Member

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

    Here is my Mjoy:
    mjoy16-c1-all-in-one-high-quality-pcb-s-for-sale-t2207.html

    You can see the components on the board. The small yellow and orange ones are the ceramic capacitors, under the IC is the 10uH inductor. Try to get those components. I don't know what kind of inductor you have, maybe post a google picture?

    You don't need the 8x10k resistors on the matrix pins, those resistors are already inside the microcontroller.
  15. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    Yes, put 8 x 10 k resistor vertically - to save space - and connect all upper wire to +5V. :thbup:

    PonyProg v2.07c is fine, but I use Ponyprog2000 too, with exit.
    http://www.lancos.com/

    Look, you work with a 8 x 12 (Column x Row) Matrix.
    This mean that every wire from Columns pins go to 12 different buttons (and every wire from Row pins go to 8 different pins).

    So, you can split wire leaving Column pin 1 in 12 wires (not recommend, cause result in too many wires to handle).
    Or connect the wire leaving this Column pin1 first to Button 1, after to button 9, after to button 17... 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105 (12).
    Wire from Column pin2 to Button 2, after to Button 10, 18, etc. etc.
    Both modes work in the same way. You choice.

    What I do? I use DB-15 female connector in joystick base as cable split.
    Hook wire leaving Mjoy16 Column pin to DB-15 pin1, and from DB-15 pin 1 other cable go to Button 1 (trigger) switch (A1 in your scheme).

    The DB-15 male connector carry the same wire for throttle base, to hook B1 button after C1, D1, E1. Etc. for another Columns pins, an same for Row pins.

    Look at this picture - Suncom F-15 joystick with BU0836 - wired in the same way as Mjoy16.

    [​IMG]

    Look too at Mjoy16-C1 manual pag. 20 to better understand.

    Both way are correctly, the final result is the same.

    Sokol1
  16. Sokol1

    Sokol1 Member

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

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Sokol, I just have 18 jumpers on the pushbutton inputs in every possible combination, no ghost buttons, everything registers as it should. I am also moving 2 other jumpers on the switch inputs and the corresponding keys register in MjoyMapper. All of the 112 digital inputs won't be used at the same time, but even then everything would work just fine.

    The circuit works perfectly fine without the resistors. My version of the Mjoy manual and circuit doesn't have them, I am convinced that they are not needed. As I posted before, the AVR has built in pull-up resistors and they are programmed, external ones will not change anything (just consume more current).

    tirta, you can install these resistors, but they will be absolutely useless. If you decide to use them, look for a 8x10k SIP network resistor like this one:
    http://media.digikey.com/photos/Bourns% ... SERIES.jpg
  18. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    Probable you are right, in cases like Tirta - that use few buttons ~24 , these resistors don't make difference.

    My next Mjoy16 I assembly without these resistors.

    Mjoy16 without 8x10k resitors, with 30mm of width (x75mm of length) to fit inside joystick base - even in the tight of Suncom F-15.
    [​IMG]
    Use only one plug for +5v AVCC and Gnd for axis. For USB-A connector, or directly cable solder. Tree resistors mounted vertically.

    Sokol1
  19. tirta

    tirta Member

    Joined:
    Feb 4, 2010
    Messages:
    56
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi Frakk and Sokol1,

    Thanks a lot for all the comments. :thbup:
    However, since I have bought the 10k resistors, I think I am going to use them in the pcb.

    Sokol1, I have difficulty finding USB-B, I think I am going to use USB-A.
    I still confused about the pins.
    And yes, I have looked at this site:
    http://pinouts.ru/Slots/USB_pinout.shtml

    [​IMG]
    from left to right:
    1, 2, 3, 4 or 4, 3, 2, 1 ?
    1 = VCC
    2 = D-
    3 = D+
    4 = GND

    Please advise.
  20. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    On that site look at the pictures. Those are looking into the connector. You have the piece of board, contact pads on the bottom. On your picture you have contact pads on top, so from left to right it is 4321.