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
    MJoy encoders: fast and slow rotation

    Dear Sokol,

    I was just looking at the MJoy encoders Google translation page.

    Does this board have the fast and slow rotation capability that Mjoy16 itself does? I cannot be clear from the translated page.
    Also, is there a circuit diagram anywhere?

    Regards,
    George.
  2. Sokol1

    Sokol1 Member

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

    No, Mjoy-Encoders don't have two modes for encoders like Mjoy16.

    I don't find schematics for this, only the PCB layout (and files) in Polish board, so I open .LAY in Sprint Layout and made a simplified version, single side and .8 trials.

    I buy necessary components to build one, as I find time, I try.

    Sokol1
  3. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Yes, bad thing about PPJOY stoping the development.. The guy was really disappointed by the community's response to all his effort. He did a great job, and he has enabled all who built custom joysticks to join them in one! THANK YOU Deon van der Westhuysen!



    ...(yes, i have sent a donation :yes: )
  4. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    CH Gameport mod to USB - Finito!

    Hi Folks,

    I wired up the rudder pedals last night and fitted everything together. Got the polarities for the potentiometers right, plugged in and it works very accurately. This equipment was CH but worked via a Gameport. It had wobbly axes (so that the control surfaces of the aeroplanes wobbled around at rest), the centre of axes was unstabe and often not centred, there were ghost buttons showing up all the time (nowhere near enough diodes on the switches), it was impossible to program from within Windows XP, and I couldn't get the CH programmer to recognize the stick lots of time. I suspect that this latter might have had something to do with my old Soundblaster, but I am not sure. Some have said that it is because newer computers do not work reliably with slow old gameport gamecards.

    This new USB setup appears to be dead stable, and using Autohotkey and SVMapper will be fully programmable.

    Thanks to Mindaugas for his original work, and to those here (Sokol, Senetor and Frakk, especially) who provided the encouragement to get it all done.

    I have two more sets of CH controllers which I can fiddle with now, but this one will have been the hardest: the greatest number of buttons of all my sticks, reverse engineering all of the PCB's in the heads of the controllers, fitting the MJoy into the base of the Throttle, and double and triple checking everything. Actually I am very happy, because, except for always getting my DSub connections the wrong way around, everything else worked correctly as it was powered up throughout the project.

    Regards,
    George.

    P.S. I still cannot work out how to use those big pedals with my wrists. For all the trouble they are giving me, I might as well use my feet. :rofl:

    Attached Files:

  5. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Well done mate! Nice rig! ....but a Laptop? You are murdering all your effort! :gamer1:

    I didn't have time to work on my MJOY this weekend because of university pressure, i hope i will start RE-building (4th time) my MJOY on monday..
  6. GeorgeBoles

    GeorgeBoles Member

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

    That was just out of necessity: my wife was using my big computer!

    But I still have a problem, and this relates to games and things ...

    Regards,
    George
  7. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Strange behaviour of Button 1 in Red Baron

    Dear Experienced Users of MJoy16,

    With my new USB joystick, Red Baron does not respond to Button 1 (the trigger to shoot down the baddies with!) as it used to. Button 1 lights up nicely on the Games Controllers window in Control Panel, but my machine guns are silent in the game. (It works fine in Combat Flight Sim 3 though.)

    It is almost as if USB buttons do not work the old games, but I am pretty sure that the Saitek X-45 (USB) works with Red Baron, but there was another odd does not work button in Red Baron with that stick, but I think it might have been Button 5 ...

    I have mapped the Trigger to the Space Bar (the keyboard command for trigger) using Autohotkey after a crash course in this huge and powerful program, and I am shooting down the bad blokes, but is this sort of aberration normal?

    With thanks,
    George.

    P.S. So much for my effort at wiring everything as Plug and Play at least for the Trigger and Bombs. That was one of the reasons for the somewhat clunky wiring I described above.

    Regards,
    George.
  8. crobol

    crobol New Member

    Joined:
    Nov 8, 2009
    Messages:
    10
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi.

    A little question. Maybe it was answered before, but it's no easy to find specific information in 25 pages... :blush:

    Anyone has test Mjoy16 on a Windows7 computer?
    Any problem or incompatibility? or works fine like under XP?

    I'm interested to know about that before to start tu build my Mjoy, because our DisplayXR project has some troubles with the button part under Win7.

    Thanks.
  9. Mambo

    Mambo New Member

    Joined:
    Aug 5, 2008
    Messages:
    168
    Location:
    Czech Republic
    Balance:
    288Coins
    Ratings:
    +1 / 0 / -0
    Well axis work normal under W7 64bit, but i dont use buttons so i dont know ...
  10. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    I tested one Mjoy16 under Win7 64 bits - using SVMapper to emulate keys, and assign functions direct in game setup - in game IL-2 Sturmovik, no problems.

    Sokol1
  11. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    Trim-pot between Gnd, AVcc & Aref: Settings

    Hi Folks,

    I have finished and am using my MJoy16 and it is all very successful.

    With regards to the little pot between Ground and AVcc:

    The pots in my CH-stick and throttle only turn about 90 degrees rather than the 270 degrees. Which way should I alter my little pot: so that Vref approaches Ground OR so that Vref approaches AVcc?

    Currently I have it in the middle and the voltage from it is about 2.5V.

    I just do not want to waste a lot of time fiddling or, worse, wreck anything.

    Thanks for the help.

    Regards,
    George.
  12. Sokol1

    Sokol1 Member

    Joined:
    Jul 6, 2009
    Messages:
    126
    Balance:
    14Coins
    Ratings:
    +1 / 1 / -1
    In USB circuits pot's work as voltage divider, varies 0 to ~5v (3,5v in some circuits, like Logitech).

    If in middle yours read 2,5v is OK.

    Pot's made for joystick have a limited course, around 60 degrees.

    The only cons is that original CH gameport pot' is 100k.For USB circuits is better use 10 ~ 25 k pots. But I rewire one CH Combatstick with BU0836 and with this 100 K pots and work fine.

    If yours pot spike, disassemble and clean whit isopropyl alcohol.

    Is is bad, a good option is mod these pot's to HALL Sensor. Ie. allegro A1302, Honneywell SS495A.
    See in these pictures from Aviaforum (text in Russian)

    http://www.sukhoi.ru/forum/misc.php?do= ... ts&t=48496
    http://www.sukhoi.ru/forum/showthread.php?t=48496

    Sokol1
  13. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    100k will work good in anything USB-based, but it will be more spiky...
    For more smooth results, it is advised to use 10k, but then you will have more current consumption (with some impact on your laptop's battery autonomy)...
  14. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    AXIS recognition problem

    Oh, deary me:

    I have LOTS of problems, and I think many of these might relate to MJoy16 firmware.

    1. As I mentioned above, Joystick Button 1 lights up beautifully on the Game Controller setup in Windows XP, but does not fire the machine guns in Red Baron.

    2. Rudder Axis is not recognized in Red Baron:

    Background information about Red Baron -
    a. Red Baron does not have a mapping facility for any of its functions. That must be done externally. (I used to map the buttons using the software that came with my CH Gameport controllers.) I am doing it now with SVMapper or Autohotkey.
    b. Red Baron only accepts one controller and ignores anything else.
    c. Red Baron II came out in 1995 and the 3D patch came out in 1998.

    My MJoy setup is this:
    X-Axis as normal
    Y-Axis as normal
    Z-Axis is throttle
    Rudder is wired up to the fourth axis on the Atmel chip. It is beautifully centred in Game Controller window and moves smoothly.

    BUT it is not recognized within the Red Baron Game.

    I started wondering about the labelling of the axes in the code.

    The label for the fourth axis in the MJoy documentation is Rx.
    The Game Controller XP window recognizes it as: X Ro.
    Microsoft Combat Simulator 3 recognizes the rudder as: Axis Rx, which looks about right.
    BUT Autohotkey has a joystick test aplet which recognizes it as axis V, which is a worry, but it is the SIXTH axis in its list (X,Y,Z,R,U,V) which makes me think there might be something wrong with its DirectX labelling within the MJoy software. I am pretty sure that Red Baron would only recognize four axes: X, Y, Z, Rudder.

    Can anyone read AVR code?
    Sokol, do you know where Mindaugas Mislauskas has gone?
    Or perhaps some of the Polish chaps you know might be able to shed some light on this for me?
    Can anyone suggest where else I might ask for assistance?

    With thanks and regards,
    George.
  15. GeorgeBoles

    GeorgeBoles Member

    Joined:
    Apr 27, 2009
    Messages:
    66
    Balance:
    4Coins
    Ratings:
    +2 / 1 / -2
    That little pot again:

    And now for a simple question about that little pot again:

    Should I crank it up so that the voltage is 5V to Aref to improve signal quality?

    Thanks,
    George
  16. Sokol1

    Sokol1 Member

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

    AFAIK, Mindaugas end support for Mjoy - now is botanic an no more involved with simulation...

    Mjoy16 firmware is locked - you are able to change device name and VendorID only.

    In this recent thread in AviaForum (in Russian), one guy try change axis name... not conclusive.
    http://www.sukhoi.ru/forum/showthread.p ... ost1333922

    Mjoy - know too as Mjoy8 (ATMEGA8-16PU) firmware is open to edit, but have only:
    -6 axis (and firmware versions with 2, 3, 4 and 8 axis).
    -24 buttons (or minus in fast versions - 120 MHZ).
    -HAT

    Red Baron? And Rise of Flight, Over the Flanders Fields... :brows:

    Some about AREF in Aviaforum (Google translator);
    http://translate.googleusercontent.com/ ... ost1078316

    Sokol1
  17. GeorgeBoles

    GeorgeBoles Member

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

    Hi Sokol.

    This is worth while persisting with.

    I love Red Baron because ANYONE can set up a server to play a game they like, with easily 32 players per game with a very efficient server program. No-one else has done this.

    Also I still like Red Baron's flight and damage models best (WITH all the additions).

    But, I don't want to have a separate Joystick setup to use with Red Baron

    I have been able to get the rudders working using PPJoy, but that will not work on Vista or Windows 7, and I really want to be able to keep on using Red Baron.

    I have used Over Flanders' Fields: Between Heaven and Hell and I really like it too, but my experience is much less with that game ... I have had to fit out my Joystick, Throttle and Pedals with an MJoy16 :yes: ! (Haven't tried Rise of Flight yet.)

    I have not been able to understand USB HID codes. If I could, I could find where they were in MJoy, and just change the name or the code without interfering with Mindaugas' programming. But I don't see that happening.

    If you come across anything else that might help, please let me know.

    Regards,
    George
  18. NuMcA_[.gr]

    NuMcA_[.gr] New Member

    Joined:
    Jul 12, 2009
    Messages:
    66
    Balance:
    3Coins
    Ratings:
    +0 / 0 / -0
    Unfortunately, we have no ASSEMBLY file for MJOY, so editing is out of the question.. Even DE-compiling seems difficult (Russian forum)..


    I still have not managed to get my MJOY running.. I just programmed it through serial port, but no luck. I will go out and buy new Zeners and Capacitors, to see if there is a problem with those...
  19. Frakk

    Frakk Active Member

    Joined:
    Apr 15, 2009
    Messages:
    1,144
    Balance:
    328Coins
    Ratings:
    +4 / 0 / -0
    George, the problem is not in the firmware. Windows recognizes the analog axis, Red Barron can't use them the way you think.

    Try using different analog inputs on the MJoy.
    X, Y, Z, XRotation, YRotation, ZRotation, Slider, Dial. These are the 8 axis (might be in different order, I can't remember), Red Barron might use the Slider for the Rudder input, or ZRotation for example. Try them and see how that works.

    Changing the firmware is out of the question. It is possible to de-compile the hex file, that would result in an Assembly file. Now, I don't think anyone around here can program a USB HID Game Controller in ASM:) Right now I have about 4 AVR projects going, but as soon as I'll have time I will look into the firmware USB. Once I will have that figured out I can make you a new firmware for the MJoy.. But that won't be MJoy anymore :D

    edit: about the pot for Vref, don't worry about it. The firmware is not using it. I posted about this when I tested it on a breadboard, the pot had no effect on the Analog Reference Voltage what so ever, except when you turn it all the way to 0V (then it makes the analog signals maximum).

    A little background: The voltage on the VRef pin on the AVR is the reference voltage used for the A-to-D conversion hardware if set up that way. That means the greatest value for the conversion (255 for 8 bits, 1023 for 10 bits) will be the voltage on Vref. If you have a 5V and 0V for your pots, and 2.5V for Vref, that means a 270 degree pot will reach the maximum value at 135 deg (half of 5V which is 2.5V).
    There are options when you program the AVR what to use as reference voltage: 1.1V, 5V, or Vref pin. Mindaugas set this to 5V Vcc, therefore the Vref pin is not used at all, it needs to be decoupled to GND with a 0.1uF cap to reduce noise.

    Hope this helps
  20. Sokol1

    Sokol1 Member

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