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

    GeorgeBoles Member

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

    The MJoy16 is a great project and solves the problems of lots of buttons, etc., but it also means you can resuscitate any old Gameport joystick so that it works via USB. It was my first ever digital project.

    The equipment you need is not extensive. I used a 1.5 or 2mm chisel tipped soldering iron, drew the PCB using Circad98 by Holophase http://www.holophase.com, made the boards using paper from this Pulsar Pro Fx http://www.pulsarprofx.com which is quite cheap as an introductory offer (although someone on this board might be able to send you a board from this site), and drilled out the hole using a cheapo Chinese Dremel clone. It programmed and worked first time by following Mindaugas' excellent instructions.

    My version included the 10k resistors and a diode for every switch and jumper (again, as Mindaugas said to do).

    Good Luck.
    George
  2. Sokol1

    Sokol1 Member

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

    You plug Mjoy-Encoders 16 pin output (paired in two) into 16 pins of Mjoy16 (or another USB controller) keymatrix. Mjoy-Encoders send keypress.

    USB cable (optional) is used only for power (+5V and GND), no data communication with micro.

    Or you use a 2 wires cable connected in +5V and GND of any unused asis in Mjoy16 to power Mjoy-Encoders.

    Frakk layout of Mjoy16 with one extra power connector, is Mjoy-Encoders ready. :thbup:

    Sokol1

    Attached Files:

  3. xb5967

    xb5967 New Member

    Joined:
    Nov 17, 2009
    Messages:
    5
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Good evening ladies and gentlemen
    I am so glad that Tronicgr has open this topic up. I been needing some help on my project for some time. I built one from the original Mjoy16 site (Mindaugas) and can't get it to program. I have read all I could find on the subject and this is what I have done. I have check all my soldering (Not a very good solderer but seems OK), checked for shorts (all seem good), changed out the zener diodes to 1n4728(3.3v), the clock oscillator, all capacitors and the Inductor while verifying they were installed correctly. Rechecked all my connections. Changed out processors( three ATMega16A and one Atmega16, both have the same specs except voltage range) and I still get Device missing or unknown device -24. I was using the parallel port dongle, so I built the AMC serial programmer. Still having no luck, Port check on PonyProg2000 fails. In fact all fail, Read ,write everything, It seems I can't get any communications between the program and the ports. One thing I have notice is that most of the people who has good luck with this device seem to live either across the big ponds (the Atlantic or Pacific oceans) or on the other side on the canal(Panama), I live in Texas,USA. Is the operating system a little different? Maybe my ports are not set correctly, they are set to auto. I have read somewhere about port releasing, any thoughts? I have also read about switching MOSO with MOSI, again any thoughts?
    I thinking about rebuilding my project using either Senetor's or Frakk's PCB, they both look good and are design for a certain purposes. Good job guys.
    Any help would be greatly appreciated
    Thanks
  4. xb5967

    xb5967 New Member

    Joined:
    Nov 17, 2009
    Messages:
    5
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Douh :uups:
    I forgot the operating system I use it's XP SP3. I'm also going to do a comm port test
  5. Frakk

    Frakk Active Member

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

    It is more than likely your ports. I guess you checked all the settings in PonyProg2000 and set up the interface correctly. If not, I would try different settings in the interface setup, although Parallel Avr ISP I/O should work with LTP1 and Serial SI Prog API with COM1, that's what works for me.

    Changing the MOSI/MISO will not help. It is more than likely your Windows settings or something is blocked in the BIOS.

    I am currently working on an Assembly Guide for my All-in-One circuit, you are very welcome to get it and use my version of the board.
  6. Senetor

    Senetor Member

    Joined:
    Oct 23, 2008
    Messages:
    90
    Location:
    Australia
    Balance:
    594Coins
    Ratings:
    +1 / 0 / -0
    Hi xb5967,

    Changing Port settings,

    Start PonyProg and click on Setup, then Interface Setup and click on Serial and note which com port is highlighted, ever if it is greyed out.
    Then in Windows XP, open Control Panel, Device Manager, then click on Ports. Double click on Communications Port, click on Port Settings, Advanced and at the bottom of the window change the Com Port Number to the same number as what was in Pony Prog. Click on OK, OK, and the setting should be changed.
    Open Pony Prog and in Interface Setup the port setting should now be black. With the AMC serial programmer connected, click on Setup, Calibration and wait a few seconds and Calibration OK should appear. Hope this fixes your problem.

    Senetor.
  7. xb5967

    xb5967 New Member

    Joined:
    Nov 17, 2009
    Messages:
    5
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Thanks Frakk and Senetor ,
    I did a loopback comm test and it was OK. I reduced and than increased bits per second rate, nothing. Changed buffer rate, again nothing. I’m going to follow these steps, I followed Minaugas steps that said to calibrate, setup and then plug Mjoy in versus plug in controller, setup and then calibrate. If this does not work, well Since I am a newbie in this board making process, I have to come to the conclusion that I screwed up somewhere. I think my best bet is to start over , test each connection and ask questions. I should have all I need to complete since I ordered just about everything doubled up. I’m just hoping my processors are not fried since I wasn’t able to communicate with them. Please check back in a couple of days for updates,

    Thanks
  8. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    I'm pretty sure you have checked all your connections and everything, but I would do it again. I say this from personal experience that is is very easy to miss-read the port number pins on the drawings. Some drawings show these pin layouts in different orientations, one might look into the PC port, the other into the receiver side, the other might show the landing pattern on the receiving board and it is mirrored/upside down. Always check the numbers on the port and figure out what way you should look at it.

    A lot of times very simple things could cause problems, things so simple that you don't even think about it because it is so obvious. Are you powering up the device when programming?
  9. xb5967

    xb5967 New Member

    Joined:
    Nov 17, 2009
    Messages:
    5
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    A quick question,
    What is needed on the pcb to program just the ATMega?
  10. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    If you are using the parallel programmer, you don't need other components. Connect the supply pins to 5V and Gnd, connect Mosi,Miso,SCK,Reset and Gnd where they should be, and program it.

    With the serial programmer you obviously need the serial programmer circuit, but if you have that just connect the programming pins same as above.
  11. gal476

    gal476 New Member

    Joined:
    Nov 23, 2009
    Messages:
    3
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    hi,

    Frakk in your last update that you gave i have notist that there are no 330 Ohm resistors
    from the ISP to the ATmega16 chip. Isn't needed?

    There are any changes that you are going to make in this design? becouse I want to go and buy the part according to that design.

    there are 2 things i dont understand about the Mjoy,
    What do i need to do with the GND? And what is the INIT.

    Thank you very much.
  12. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    gal, the 330ohm resistors I put inside the plastic case of the parallel port connector instead of the PCB. There are other programmer interfaces around which don't need these resistors.

    There is no change in the parts needed. Make sure you have the PCB with all of the diodes on it.
    What to do with ground? Nothing I guess.. Only thing to look out for is to connect the programmers ground to the circuit's ground (USB). INIT is like a Reset for the controller, see the manual.

    I think it would be a good idea to open a new thread that sums everything up with all the different design files and documentation attached. I have a small writeup that is almost done, I just need to find a bit of time.
  13. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    I rewire old gameporte CH PRO pedal with Mjoy(ATMEGA8) and Suncom SFS+Joy with BU0836 and have a problem: To Windows Mjoy is first device, this cause problem in IL-2, since pedal assume ID0 and joy assume ID1, so is not possible adjust response curves in game for joy, only for pedal.

    After some research I am able to edit one Mercury Mjoy (3 axis 120 mhz) firmware, and change name do ZRUD (name doesn't have relevance) and this VendorID - base on which Windows enumerate controllers. BU0836 use Vendor ID of 0x5824, so I put 0x5858 in Mjoy.

    I draw this simple PCB (40x40mm) to put inside pedal, only have connections for programmer cable and pads for solder cables for tree axis: Rudder, Right and left Brake. This firmware allow 16 buttons and HAT, but as is NO circuits don't interfere in use.

    [​IMG]

    I don't have previous knowledge about programmer and compilations, but this change reveal very simple. If anyone have interest I send the files.

    Sokol1
  14. gal476

    gal476 New Member

    Joined:
    Nov 23, 2009
    Messages:
    3
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    hi again,

    i think i will have a problem finding the right Atmega16.
    If found the ATMEGA16L-8PU and the ATMEGA162-16PU.
    which one is more simuler to the ATmega16 - 16PU?

    thanks

    *edit*

    I found that the different between the ATmega16 - 16PU and ATMEGA16L-8PU is that
    ATMEGA16L-8PU is Maximum Clock Frequency: 8MHz and Operating Supply Voltage: 2.7 V to 5.5 V
    insted of 16MHz and 4.5-5.5

    ATMEGA162-16PU diffeences is: Interface Type: SPI or USART insted of 2-Wire or SPI or USART
    and Operating Supply Voltage: 2.7 V to 5.5 V insted of 4.5-5.5 and is has no On chip ADC.

    i am sorry for the qustion but i dont understand what is importent and what is not.

    thanks
  15. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Just as you said it, the Atmega16-8PU is the slower version that can operate on lower voltages. I don't think it will make a big difference if you can't find the -16PU version, with 5V I think it will handle 12MHz but I haven't tried it. Thanos overclocks the Atmega8535 in his AMC from 16MHz to even 24MHz and I can't see a reason why couldn't you.

    The Atmega162 or Atmega168 are totally different chips, different peripherals and registers, it is unlikely that the firmware works on these without modification.
  16. gal476

    gal476 New Member

    Joined:
    Nov 23, 2009
    Messages:
    3
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    thanks.

    I will start building the board and if i will find the 16-16PU i will change it. :)
  17. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    It has been 4 weeks i have been trying to build my own MJOY 16 C1. I cannot make it work whatever i try!
    Now i am getting frustrated and i would like to ask your help..

    The ATmega16 was programmed on a programmer which is a clone of the STK200/300 ISP from AVR.
    [​IMG]

    The programming was done through PonyProg with WRITE successful! message and these fuses:
    [​IMG]

    I did it with EAGLE (software design tool) and PCB. It didn't work, Windows said USB device not recognized.
    Schematic
    [​IMG]

    PCB
    [​IMG]


    I then did it on a veroboard to see if i would get it ok this time. This did not work either.

    Then i did it on breadboard and -oh what a surprise!- it DID NOT WORK this time either!

    I know that the HEX is programmed on the chip, i can read the EEPROM which has 5 bytes written and the RAM that seems to be ok. Verification from Ponyprog says it is OK... Only thing that does not make so much sense is that the HEX file has CRC: EA4Eh and the written file on the ATmega16 has a different CRC: A674h

    [​IMG] __ [​IMG]
    Sorry to be bothering you with all these information and problem, but i am at a dead end! I want to get back on the air but i am grounded due to these technical reasons!! :crazypilot:

    Thank you!
  18. Sokol1

    Sokol1 Member

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

    The images linked require register in www.hlektronika.gr to see. Put these in Imageshack or similar.

    Probable cause of malfunction is error in circuit or bad USB cable.

    Sokol1
  19. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Sorry guys, thanks Sokol, i am uploading them now!!

    EDIT: I just updated the links to the photos! Looking forward to your help guys! THANK YOU!
  20. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Are you using the parallel port programmer or the STK clone now? You should read back the same file from the device than you put on it, so my first bet is a programming issue.

    I know you said Ponyprog says it is successful but It doesn't necessarily mean it doesn't have errors. Have you programmed AVR's with Ponyprog before that worked, or is this the first? I haven't tried programming with a STK clone and Pony, the parallel port and the serial interface works. Try those.

    I didn't the EEPROM file into the uC and still good for me, try to erease everything then program only the hex.

    Why do you have a diode between PC2 and PD7?