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

Another way to do motor current sensing for balance

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by Zed, Jul 4, 2017.

  1. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Here it is in action. Works great! This is a replay of a balls out run at Donnington Park in PCars2. Sorry about the shaking but it was pretty violent. Post on page 2 has more info.



    My seat reclines so I can approximate seat style when flying and driving but that changes the CG, unbalances the platform, and make the motors work harder in one direction than the other. I had the idea of putting auto ammeters in the motor circuit which would show the balance of the sim through the needle swings but turns out this isn't such a good idea the way I was doing it. The ammeters pass the full current so need heavy gauge wire run wherever the meters are mounted, the resistance of the meter is fairly high so it shaves voltage and torque off the motors, etc.

    I found these on eBay from a seller called "ledbargraph": http://www.ebay.com/itm/30seg-66mm-...sure-and-Display-DC-Value-0-5V-/162566320763? for $35 each. I think it's just the Chinese company that makes them but not sure. I got his last two in this listing but bet they post more.

    image.jpeg

    Here is the datasheet from the manufacturer: Http://www.barmeter.com/download/as230p-66s 1.0.pdf The part listed at eBay (AS230P-66S 05L8511R8511) is a 0-5V voltmeter with both displays the same with green, yellow, red segments. The zero and max is adjustable. I figured that the two displays would be the positive and negative swings of a single motor and two modules would be needed for a 2 DOF rig. Since it's a 0-5 V meter on each side, it will take a little bit of op amp circuitry to rectify, split, and filter the PWM output of the motor controllers and turn it into a 0-5V signal for the meters but that really should be pretty simple. A differential amp on the front end will solve the polarity swap issue and the rest is standard stuff. I'll post more details as I work it out.

    It still needs a shunt to convert the current into a voltage, but there are some 0.001 ohm shunts that will only drop 50 mV at 50A and shouldn't cause problems with voltage drop or torque. Routing a low impedance low voltage to a remote meter location is trivial. Costs a little more than cheap auto ammeters but should still be around $75 per motor give or take.

    Probably not necessary for fixed seats, but I think it will be for reclining and adjusting at will.
    • Winner Winner x 1
    • Informative Informative x 1
    • Creative Creative x 1
    Last edited: Oct 9, 2017
  2. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Just an update if anyone cares - I got the schematic worked up for an adapter/signal conditioning add-in board and have started routing it. To use these bar graphs, I need to turn the motor PWM duty cycle and current into a 0 to 5 volt voltage that the bar graph voltmeters can turn into a proportional number of lit LEDs.

    It turns out this may be very simple thanks to some newish chips from Analog Devices for measuring small voltages on big common mode offsets - the chip I'm using is a differential amp designed specifically for amplifying shunt current voltages in this kind of application. The voltage generated across the shunt by the current flowing through it will be proportional to the current. By low pass filtering it, since it's both the current and PWM duty cycle, we get the output voltage proportional to both the current and duty cycle to get total effort of sorts.

    Under low load, the duty cycle can be high but the current low. Under heavy load, the duty cycle can be low but the current high. This convolutes the load with the motion but in periods of high motion back and forth, the extents of lit LEDs should then be mostly due to current and motor loading. But all I'm really looking for is each of the two bars to light up about the same length when the motors are doing some kind of oscillation. This could especially benefit form @value1's sinusoid plugin for setup. (https://www.xsimulator.net/community/threads/output-a-sinusoid.10283/#post-133006)

    A simple passive low pass RC filter turns the PWM duty cycle and current into a simple voltage level, and that feeds into a voltage follower with gain to make the output range 0 to 5 volts for a 0 to 50 A and 0 to 100% duty cycle. That's what goes to the meters. I use twin parallel circuits with the differential amps' inputs wired with different polarities on the same shunt so each path lights up on one polarity current or the other to drive the two bar graph displays that make up each module.

    Everything uses a single supply voltage of +5 V and there are now 7805 pin- and footprint-compatible switching power supplies that I've just got being a parasite off the 12 volt lines that feed the motor controller. These boards will just get inserted into the connections between the power supply and the motor controller and the motor controller and the motors, one for each DOF axis. Four wires in and four wires out though one motor leg doesn't need go go through the board and can just bypass it and the 12 volt power doesn't need to be pass through either. The board just needs 12 volts. I'm setting it up for pass through though in case that's more convenient.

    It's looking pretty trick, pretty simple, pretty cheap, and pretty small. Hope to send out the boards this weekend to get burned and have everything arrive in the next week or two to test it out.

    Then it's just fingers crossed it actually works the way I think it will.
    • Like Like x 1
    • Winner Winner x 1
    • Creative Creative x 1
  3. 1oldbiker

    1oldbiker Member

    Joined:
    Apr 4, 2014
    Messages:
    76
    Balance:
    281Coins
    Ratings:
    +39 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    I was thinking of something close to this. Keep plugging away. I had decided that extending the wires to the motor amps was a bad idea. I'm glad you found that Analog ic. James
    • Like Like x 1
  4. ferslash

    ferslash Active Member

    Joined:
    Feb 8, 2011
    Messages:
    495
    Balance:
    4,798Coins
    Ratings:
    +180 / 2 / -0
    as you can see i am saveless about electronics, but, all this stuff is to "balance" the speed of the motors?....

    ifso, what about bigger motors that counteract the unbalance with more force (brute force) :D

    man you are a little idea machine, keep that way.

    best regards...

    fer
    • Like Like x 1
  5. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Hey @ferslash, a lot of this has come about as I work through the design for my platform. I had seen a lot of discussion on getting proper balance and not using any adjusters on the seat itself, but for me I wanted to be able to adjust recline to fit different sim cockpits more accurately. And I had already ordered my motors. This is my first motion platform and it has been a big learning curve with mistakes made along the way. ;)

    Brute forcing it is certainly a solution but that means bigger motors, power supplies, and motor controllers too. I was trying to go simple on this platform and you can see where that has gotten me, but it would be a major upgrade and revamp to go with larger motors and it would have relegated lots of already bought stuff to the shelf to probably never be used again or at least for a long time and added even more delays.

    On the other hand, having the platform in balance is always good. I would think you would need a lot of overkill to get essentially equal speed both directions depending on how out of balance you are. I also think this will just be cool looking too. I've already printed the housings/mounts for the displays and I think they look pretty good. Smaller and better than the ammeter housings and ammeters I was going to use and the dancing light bars should be pretty trick besides being useful. My seat is on regular seat rails so I can recline as desired and then move the seat forward and back to make the two bars match. I really probably only need one (dual bar) meter since all I am doing is balancing front to back, but two looks better. :thumbs

    It's all still untested though and even if it works, maybe it won't be as useful as I think it will be. If it works as I hope, I'll post the files and parts list if anyone else wants to do it too.

    Thanks!
  6. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Yeah, that was not my best idea. When my motors were going to be towards the pedals end of the platform it wasn't so bad because the wires would go right by where I wanted to mount the meters. But once I got all the parts and started fitting them, I didn't have the space to put the motors in the front and had to move them to the rear. Then a wire would have to loop way forward and back. It was doable but not the best solution.

    Then @mirkobastianini mentioned a panel meter set up to measure current that he wanted to use and it had a shunt. That solved everything and I feel kind of silly for not thinking of this right out of the gate. The shunt can go close to the power circuit and the voltmeter can be remote mounted. I'm putting chokes on the power wires between the motor controllers and the motors to block the reverse EMF slams with PWM and that will also protect this stuff since I'm putting these circuits between the motor controllers and the coils so they will also be on the lower noise side. Voltages and currents should be pretty tame.

    The amp I'm using is the AD8210 (~$5 at DigiKey) in unidirectional operation with ground referenced outputs. I just swap the polarity of the wiring to the shunt to have one read current in one direction and the other read it in the other. They will each just hang at 0V output when the current is flowing the wrong direction for them so that way one bar lights one current direction and the other bar lights the other. After that and as above, it's just a simple RC low pass filter with center frequency of 100 Hz and another AD chip (AD8692) which is a rail to rail 5 volt single supply dual op amp as a voltage follower with gain of 5 to take the 0-1V outputs of the 8210 and make them 0-5V for the Barmeters. The 100 Hz filter should still make for lively displays while turning the PWM into a fairly steady voltage for whatever the PWM and current are at the time. Power for this stuff is from a CUI P7805 which has basically the footprint and pinout as the old linear 7805 regulators. Never had seen those before but they are a thing now and very cool. It's got a 500 mA output so will easily power the Barmeter it's connected to as well as the analog circuitry all from the 12 volt rail.

    Hopefully. ;)
    • Like Like x 1
  7. 1oldbiker

    1oldbiker Member

    Joined:
    Apr 4, 2014
    Messages:
    76
    Balance:
    281Coins
    Ratings:
    +39 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    I like just the bar graph. I'm so nerdy that I want to see it. I have ordered a couple of 100A shunts and am first going to look at the current with my oscope. I'll post findings.
    • Like Like x 1
  8. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    The final schematic.

    BarMeterCircuit.jpg
    Last edited: Jul 10, 2017
  9. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    The tentative board. I'm waiting on the parts before I submit the board for fabrication just so I can make sure everything has the right footprints and fits. Once you get a stack of otherwise good boards back that you can't use because you dorked a footprint, you don't want to risk it again.

    Final board size is 3.0" x 2.8". I set it up for both high current connectors as well as through holes for up to 8 AWG wire.

    So close to dancing bars... :popcorn

    Update - once I got the parts in I had to make a slight change and after not looking at the design for a few days, changed a few other things, added a legend for the connections, etc.

    ZedBar.jpg

    Just got through placing the order for the boards so should have them in a little over a week and can finally see if it works.
    • Like Like x 1
    Last edited: Jul 14, 2017
  10. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    The Barmeters arrived today and they are beautiful! Photos don't do them justice. They are brighter than I thought they would be but I'm going to be in VR except when specifically watching them to adjust the balance. The display surface is flat though it is two separate displays butted together for each dual bar graph so it wouldn't be hard at all to cover them with a cheap neutral density film filter if they are too bright for anyone.

    They are bright enough that my camera couldn't capture the beauty of the colors (washed out) but they are bright green, bright yellow, and bright red and all of about equal perceived intensity. Very impressed with these and can't wait to get them dancing! Circuit boards should ship tomorrow and be here next week. If all goes well and the circuit is good, these will be operational by next weekend.

    IMG_0380.JPG IMG_0382.JPG
    • Like Like x 3
    • Friendly Friendly x 1
    Last edited: Jul 21, 2017
  11. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    And in their housings, ready to mount and wire up when I get my circuit boards built.

    IMG_0383.JPG IMG_0384.JPG
    • Like Like x 2
    • Friendly Friendly x 1
  12. ferslash

    ferslash Active Member

    Joined:
    Feb 8, 2011
    Messages:
    495
    Balance:
    4,798Coins
    Ratings:
    +180 / 2 / -0
    i dont get what this bars are for... are there for to measure current passing to motors? (in simple words what are they?)
    fer
  13. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    They are there to measure current passing to the motors. ;)

    I'm building a 2 dof rig and it has two motors and for the motion. One module each. Obviously the motors go one way and then the other. The polarity swaps to drive the motor in direction or the other - that's what the H-bridge does. If the rig is out of balance, the motors will work harder and pull more current in one direction than the other. The motor controllers will also run the PWM to higher percentages in the loaded direction. Each module has two LED indicator strips - one lights up with a bar length proportional to current in one direction, and the other LED strip lights up when the current is going the other direction. This should hopefully make it a very simple matter to adjust the rig to put it in balance so that the bars dance back and forth equal amounts. One set of two indicators for each motor.

    The lit bar graph in the image above is misleading. I just hooked both indicator inputs to the same variable power supply to get a feel for the response time of the displays and see what they look like. In this application, I shouldn't have both bars lit at the same time. It should always be one or the other. The only thing that will possibly keep a bar lit when it shouldn't be is the low-pass filter I stuck in the circuit that has a 100 Hz cutoff. With high frequency changes in motor direction (driving over rumble strips, maybe?), it could be that I'll see both bars lit up.

    The reason I don't just find my balance point and put the U-joint under it and be done with it is that I drive cars and fly planes that have the driver or pilot in different amounts of recline. A Formula 1 driver is reclined way back but driving in a stock car or similar has you sitting up pretty straight. I want to be able to adjust my seat to match that and that will change my center of gravity and make the motors work harder in one direction or the other. My seat is on adjustment rails and so are the controls so I can set to the position I want and adjust my CG to make the rig balance - hopefully.

    That's how I think/hope it will all work but I'll find out soon if I'm right or if I've just wasted time and money. :popcorn
    • Like Like x 1
  14. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Getting ahead of the cart, but here are the .stl files for the mount box and the back cover. This is set up to fit 80/20 10 series strut. Slice off that strip on the base that fits into the channel and you can mount it on anything. I'd wait to see if this works first, though. If it does work, I'll also post the board files and parts list for the circuit board.

    BarMountFront.jpg BarMountBack.jpg

    Attached Files:

    • Like Like x 1
  15. mirkobastianini

    mirkobastianini Active Member

    Joined:
    Jan 23, 2017
    Messages:
    193
    Occupation:
    informatic
    Location:
    italy
    Balance:
    1,300Coins
    Ratings:
    +77 / 2 / -0
    My Motion Simulator:
    2DOF
    It's very beautiful and shining @Zed :)
    • Friendly Friendly x 1
  16. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Boards are here. Will build them tomorrow and see if the circuit actually works. Didn't get soldermask. Costs way more now than last time I had my own boards burned. Silkscreen was cheap, though, so did get that. $30 per board so a bit expensive. Would get cheaper fast in quantity though.

    Now I can finish the power wiring. :thumbs

    IMG_0385.JPG
    • Like Like x 2
    • Informative Informative x 1
  17. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    The circuit works perfectly. It outputs a 0-5 volt output on the two channels depending on the polarity of a 0-50 amp current through the shunt. There is a 30 mV offset and I haven't tested the top end since my current source doesn't go that high, but it appears to work as planned. Only question now is if the displays are actually valuable for adjusting the platform balance. Printing mounts for the boards now. :thumbs

    IMG_3037.JPG
    • Like Like x 2
    • Friendly Friendly x 1
  18. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Got the power and motor connections in as well as printed the housings for them. Almost ready to wire them on in. Beefed up the traces on the back to better handle the current. Boards are 2 oz copper to help with current.

    IMG_3041.JPG IMG_3050.JPG IMG_3052.JPG
    • Like Like x 3
  19. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Just a progress report. I'm bringing up my motor controllers today and these displays work perfect. I had braking turned on initially and they even catch the reverse braking current.

    I'll post the circuit board files and parts list later.

    Attached Files:

    • Like Like x 1
  20. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,044
    Location:
    USA
    Balance:
    5,828Coins
    Ratings:
    +1,042 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    If anyone else wants to build these, here are the parts list and gerbers for the board. Some board houses want to know what software built these files - Ivex WinBoard. I've included two zips of the gerbers. One has the top and bottom copper, the drill (Excellon and gerber) files, the silkscreen, and the WinBoard source file itself. The other one has just the solder masks. I didn't send those when I got my boards burned since it added so much to the price, but it sure is pretty and makes the boards look like a pro. You probably want to repackage as necessary to fit with whatever the board house you use requires. I used PCBExpress.com and they have pretty good prices. Since the wide traces in the high current side need to carry lots of current, I went with 2 oz copper and then flooded the back side of the traces with solder to add more metal volume. Board size is 3 inches by 2.8 inches and I went with standard FR4.

    The 2 mm spacing connectors are small and the crimp connectors really small. I used good quality 4-conductor flat phone extension cord to route to the bar graph displays. The runs are at least 6 feet and I get what looks like full brightness so it can handle the display current well enough. I tested the displays by running both inputs to 5 volts (full bars) using the cable and not a problem. Both bars won't be fully lit in operation anyway.

    Parts list with DigiKey part numbers - Qty for one board:

    RS1 1 each CSS4J-4026R-1L00FCT-ND CSS4J-4026R-1L00F RES SMD 1 MOHM 1% 4W 4026
    U1,U2 2 each AD8210YRZ-REEL7CT-ND AD8210YRZ-REEL7 IC CURRENT MONITOR 0.5% 8SOIC
    U3 1 each AD8692ARZ-REEL7CT-ND AD8692ARZ-REEL7 IC OPAMP GP 10MHZ RRO 8SOIC
    J1 1 each 455-1706-ND B4B-PH-K-S(LF)(SN) CONN HEADER PH TOP 4POS 2MM
    (for cable) 2 each 455-1164-ND PHR-4 CONN HOUSING PH 4POS 2MM WHITE
    (for cable) 8 each 455-2148-1-ND SPH-002T-P0.5L CONN TERMINAL 28-24AWG TIN
    R1,3,5,6 4 each CR0603-FX-1002HLFCT-ND CR0603-FX-1002HLF RES SMD 10K OHM 1% 1/10W 0603
    R2,4 2 each CR0603-FX-4022ELFCT-ND CR0603-FX-4022ELF RES SMD 40.2K OHM 1% 1/10W 0603
    C1,2 2 each 399-9096-1-ND C0603C473K1RACTU CAP CER 0.047UF 100V X7R 0603
    U4 1 each 102-2705-ND P7805-Q24-S5-S CONVERT DC/DC 0.5A 5V OUT
    C4 1 each P19739CT-ND CAP ALUM 10UF 20% 10V SMD
    C3 1 each C5PCE4976DKR-ND CAP ALUM 10UF 20% 50V SMD
    R7 1 each 541-124CCT-ND RES SMD 124 OHM 1% 1/8W 0805
    D1 1 each 67-1555-1-ND LED RED DIFFUSED 0805 SMD
    C5,6,7,8 4 each PCC2277CT-ND CAP CER 0.1UF 25V X7R 0603

    The high current connectors, J2 and J3, are DigiKey 732-11033-ND, TERM BLOCK 4POS SIDE ENT 10.16MM but I soldered wires right into the board. These connectors fit the hole pattern though.

    BarMeter.jpg

    Once I get the platform moving, I'll get a video of the bar graphs in action. They look pretty cool. Still very bright but also very cool. :thumbs

    Edit: I can tell these are going to be very useful for balance adjustments but they also are working great for tuning. I can see the current levels just by inspection and persistence of vision plus the low pass filter (and whatever filtering is in the bar graph meters themselves) lets you see peak values. It's like having four ammeters ready and always connected. Which bar lights up tells the polarity of current applied. A bit expensive but I'm finding them very useful. And now that I have the motors and feedback all working, I can see the PID stuff working as they overshoot and swing back. It's really amazing.

    Attached Files:

    • Winner Winner x 2
    • Informative Informative x 1
    Last edited: Sep 4, 2017