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

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    mohsenk, don't worry about the shorting vcc to gnd. The two ends of the pot are connected in between, so there will always be 100k or 10k to limit the current. The wipers of the pots are connected to the high input impedance of the chip, again this won't short anything.

    Regarding to your board, check the traces and soldering. The original pcb had some really tight spots and very thin traces and pads, and you probably have a mechanical error. The zener diode won't be the problem, it is always better to use higher wattage components, of course they will be more expensive too.
    Personally, I would really like to see my board built and tested. Sokol suggested some modifications with regards to ghost buttons. I don't think this will be an issue with this board, however it hasn't been proven 100%. You can be #1 testing it :D

    Attached Files:

  2. mohsenk

    mohsenk New Member

    Joined:
    Aug 1, 2009
    Messages:
    14
    Balance:
    21Coins
    Ratings:
    +0 / 0 / -0
    Thanks Frakk ! I have checked all the routes and all the connections are correct. That's why I confused.

    What are the ghost buttons ?
    So the board has not been tested ? I can not endure another failure, so please tell me if is it working or not ? I really liked your design since it is an all in one solution and there won't need to build the matrix board.


    Which board do you actually use now ? Is it working completely ?

    The last question :
    The first all in one solution was posted by Senator which had a 100K Multi but your last one didn't have it, what is it actually ? It didn't appear in the original design too. If is it necessary why did you omit it in your design?

    I'm sorry if I'm asking too many questions. As I've already told you, I can not fail another time cause it means another waste of time and money. Just guide me and tell me which board I should design. I need only 6 axis and at most 20 buttons. Should I build the Mjoy with ATMega8 chip ?
    But I really liked your design and having more options is never going to be bad, that's why I decided to create the MJoy16.
    At last I emphasize that I can not handle another failure on this project. Please pimp my board X-Simulator guys :D

    Thanks in advance
  3. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    If you read the posts you get answers to your questions in more detail. I use a breadboard for prototyping, you can see a picture of that too. Using that board I haven't encountered any problems. The extra 100K pot is for setting the reference voltage for the axis. Technically it limits the range of the pots. It was ommited because the firmware uses an internally set value and not the input on that pin, so it is practically useless until the code is modified.

    On my board I used only 12 diodes instead of the original 100+, which should work (I don't use diodes on the breadboard). The other thing Sokol suggested is the 8 pulldown resistors connected to the column connections. Again, I don't use these and gave my reasons why they shouldn't be needed. Of course, I cannot tell these things for 100% as I didn't write the code, neither I have the source code to prove and I haven't had the chance to get my board made. Don't worry, it won't be a failure and if there are problems, additional components are easily added or removed.
  4. mohsenk

    mohsenk New Member

    Joined:
    Aug 1, 2009
    Messages:
    14
    Balance:
    21Coins
    Ratings:
    +0 / 0 / -0
    Thanks for your quick response.
    I appreciate your reply and I'm gonna build the board ( your design ) and when I'm done I'll upload the pictures here.
    Again thanks for your effort.

    Another question
    Why everyone is trying to create a layout for Mindaugas's MJoy16 ? The device is designed about 6 years ago and I think we should build a new one. There is a library called V-USB ( formerly known as AVR-USB ) which is in C language and is built for implementation of such devices. If you are interested in designing our own device. I can handle the software because my expertise is in programming specially C & C++. So If you are in just let me know.
  5. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Are you familiar with microcontroller programming? C is just a platform for programming AVRs and programming is nothing like writing a windows program. The reason I don't bother with the firmware is because it is working as it is. To make it worth writing a new firmware, force feedback would have to be implemented in addition. This proves to be fairly complicated without own drivers. If we can manage to make such drivers working without additional programs running in the background, it will be the next step in the design. There are such dll-s available, I just haven't had time to look at them.
  6. mohsenk

    mohsenk New Member

    Joined:
    Aug 1, 2009
    Messages:
    14
    Balance:
    21Coins
    Ratings:
    +0 / 0 / -0
    Yeah ! I have managed to learn microcontroller programming. And I know it's different, As I've already told you my expertise is in programming ( Professional System Programming ). Force Feed Back needs lots of efforts to be made. Driver making is a complicated process. But building a general USB driver (not exactly a driver) have been made easy. Recently I have find out that there is a library called LibUSB ( LibUSB-Win32 is for windows platform ) which makes building application ( not drivers ) to work with USB Devices very easy. If we can communicate with the device this way then we can send virtual event to the system as a real device from that application.


    I haven't had any experiences in this field but I know that I can do anything if I want to. So programming such applications won't be an obstacle in our way. Actually I don't like the driver-building way. I rather to program the generic softwares which in our case will be the HID-class. I think there should be a generic driver for physical applications ( Force Feed Back and etc. ) too.
    Anyway if you ever wanted to build a new device you can count on me as the programmer.
  7. Sokol1

    Sokol1 Member

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

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    You MUST have a diode for each switch

    Dear Frakk, Senetor, Mohsenk and others,

    I have been pondering these diodes in the Matrix. MJoy is very specific that there be one diode per switch, and I couldn't work out why this was necessary to prevent ghosting. Most of the newer designs here have only 8 or so diodes (as we have been discussing), but I asked about this on simhq.com and Sokol (who is everywhere!) suggested I read this:

    http://www.dribin.org/dave/keyboard/html/ghosting.html

    and, unfortunately for my old eyes and unsteady hands, it looks as though one diode per switch. I am going down this tedious pathway soon.

    Hope this helps.

    Regards,
    George
  9. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    George, that makes sense. That link should have been posted before Sokol! :D Are you making the matrix board? If you want to avoid soldering all those diodes, just do them on the switches, whatever you need.

    I will put back those diodes in the circuit, if anyone already made the board, there are no problems, they can be added very easily to the switches.
  10. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Diodes, 10k Resistors. Pulsar PCB

    Hello again.

    A question for Sokol, because my Russian is limited to Vodka, Cosmonaut!:

    Sokol, you wrote earlier -

    If I do not use the Matrix board, then I will not have any 10k resistors in the circuit. So in swed's setup: is he getting ghosts with ALL the diodes but with NO resistors in the circuit? I think he is, and perhaps I had better put them in, or at least make a space for them.

    My diodes are going into the controller handles (fiddly but that is the way I have to do it) and that is why I have never studied Mindaugas original Matrix schematic.

    I etched a board using photo paper and TTS, and made a shocking mess of it. Then got a touch of swine flu, so hence the delay. While recovering I ordered some PCB Toner Transfer paper from these blokes: http://www.pulsarprofx.com/

    So I will report back to let you know if it is any good.

    Regards,
    George.

    [Edit: 27th November2009: You SHOULD put in the resistors too. See Sokol's later posts. ]
  11. jeffreymstrong

    jeffreymstrong New Member

    Joined:
    Jul 20, 2009
    Messages:
    4
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    I was going to try the PCB DIY TTS, but then stumbled on http://www.circuitboardstogo.com . I'm going to breadboard it first along with a PIC circuit Sokol PM'd. I'll be adding a INA122 to behave as a AMP for a Load cell. But won't get to it for several weeks due to other commitments. I'll end up trying circuitboardstogo for making a PCB out of the one which performs better for me

    Attached Files:

  12. Sokol1

    Sokol1 Member

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

    As far I understand, you need diodes, and resistors, mainly if use all possibles buttons of Mjoy16, that count 112 (64 push, 16 toggle (with different key press if UP or DOWN)=32 buttons and 4 encoder with two mode each (4x2x2)=16 buttons.

    If you don't use all buttons maybe can use only diodes or none - but I don't know what is the limit for this.

    Despite being assembled 5 Mjoy (8 and 16 versions) I never use all possible buttons, put one into Saitek X-36 and in this case use diodes in one button pin, and in old RC Futaba converted to PC use, for model airplane SIM, whit only 4 buttons wired, in this case don use diodes.

    For example, you can use L.Bodnar BU0836 without diodes matrix, but has to limit to 12 buttons. If use more, and press more than 3 at same time: ghost button.

    In local forum a Argentine guy have these ghost key problems with Mjoy(8) build per Flightsim article (the beta Mjoy) and using diodes in matrix for buttons. Solve placing 10k resistors in Columns.

    Back in 2006 Leo Bodnar say in Frugalsworld that ATMEGA is not a true USB device (is a serial device that emulate USB...) maybe this is cause of the need of these additional components.

    But, Mjoy project is free, cheap and useful, probable better than that most circuits find in commercial joystick's. And If you know how programming, you make mods in Mjoy (8) firmware, like made by Mercury. Mjoy16 code is locked.

    I know only 2 free projects based in PIC, one Russian with only 12 buttons, and one Argentine - in first stages. But in local market PIC cost 2 times than ATMEGA.

    Sokol1

    Attached Files:

  13. mohsenk

    mohsenk New Member

    Joined:
    Aug 1, 2009
    Messages:
    14
    Balance:
    21Coins
    Ratings:
    +0 / 0 / -0
    MJoy16 Assembly code can be obtained really easy by disassembling the hex file.

    ( Open it with WordPad, Notepad only accept \r\n line feeds )

    Attached Files:

  14. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    Thanks mohsenk. Although the txt file is rather unreadable, with manual editing it is possible :D
  15. Michael N.

    Michael N. Member

    Joined:
    Dec 27, 2007
    Messages:
    274
    Location:
    Germany, NRW, Düren
    Balance:
    611Coins
    Ratings:
    +5 / 0 / -0
  16. GeorgeBoles

    GeorgeBoles Member

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

    Yes. I am using the same microchip and passive parts as in the Mjoy16 article, but I am using different connectors to suit my purposes better and cheaper.

    Regards,
    George.
  17. Sokol1

    Sokol1 Member

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

    GeorgeBoles Member

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

    Why do you want to remove them from the firmware? Surely it is easier to just not use the functions you do not want to use? Just ground the unused inputs as you have advised us.

    I presume this is for the MJoy 8 and not MJoy 16. Is that correct?

    regards,
    George
  19. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    Yes, this is a first Mjoy version, not Mjoy16.

    That firmware Car_2ped have the desired axis number for rudder pedal : 3 - so don't need to ground any.
    Buttons and HAT are NO (normally open) circuit, if you don't press any, the game ignore...
    Well, the idea is just for cosmetic show in Game Controllers . :D

    Sokol1
  20. Sokol1

    Sokol1 Member

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