Arduino MRSC "Drift Assist" Stability Control Build For 3 Pin RC Servos
Vložit
- čas přidán 28. 08. 2024
- I had some requests for a standalone Arduino MRSC (Micro RC Stability Control) unit. So here comes the version for 3 pin standard RC servos.
In order to use it, you don’t need my open source DIY Arduino 2.4GHz remote control system anymore. Just use the standard servo and receiver!
You only have to add an Arduino Pro Mini, and an MPU-6050 gyro / accelerometer. It is powered from your ESC and is mounted between ESC / servo and the receiver.
What this system can do:
- Basically it works like the Traxxas TSM (Traxxas Stability Management)
- Allows to accelerate with full throttle on gravel, parquet etc.
- Makes drifting a bit easier, because the counter steering is automated
- Makes it easier to drive a straight line, even with spongy steering mechanics
How it works:
- The steering servo signal and the throttle signal are read from the receiver
- Both signals are used to compute the required turn rate
- The gyro measures the effective turn rate
- The deviance of both values is used to compute the required counter steering angle
- The throttle signal is 1:1 passed thru to the ESC
- A new servo pulse signal for the steering servo is computed
This step by step video tutorial shows all the details on how to to build this controller by yourself.
Parts list:
- Arduino Pro Mini 3.3V, 8MHz: www.ebay.com/i...
- MPU-6050 board: www.ebay.com/i...
Download the software for the 3 pin version on my GitHub: github.com/The...
Download the software for the 5 pin version on my GitHub: github.com/The...
Support this channel: / thediyguy999
My other MPU-6050 videos:
- Self balancing robot: • Micro RC: Self Balanci...
- Chevrolet Camaro MRSC implementation: • Arduino MRSC (Micro RC...
- Transmitter with MRSC adjustment knob: • Arduino MRSC Part 2: S...
- Wltoys A959: • Brushless Wltoys A959 ...
- Receiver Software upgrade: • Micro RC Arduino Recei...
- Wltoys K989 „Drift Assist“: • Wltoys K989 Rally Fies...
- MPU-6050 „Micro RC“ shield from OSH Park: • MPU-6050 Arduino "Micr...
- WLtoys 5 pin servo MRSC build: • Arduino MRSC Stability... - WLtoys 5 pin servo MRSC test drive: - WLtoys 5 pin servo MRSC build: • Arduino MRSC Stability...
Check out my other RC videos: • Remote control
I hope this system will help you guys to improve your RC car without replacing the entire electronics!
My GitHub: github.com/The...
Follow me on Twitter: / thediyguy999
on Flickr: www.flickr.com...
and on Google +: plus.google.co...
If you want to support this channel: / thediyguy999
Nice sharing..
Can you explain more about algorithm in one video session? Thank
Finally, with a small adjustment, I will make my Turnigy TR-V7 1/16 control more manageable :) Thanks!
After several requests it's finally here: The standalone Arduino MRSC stability control system for your RC car with standard 3 pin servos and receiver. I hope you enjoy it.
The throttle output for the ESC is also connected to pin 5. The MRSC controller only requires the throttle signal for the countersteering calculations. The throttle signal is not changed at all.
Does it work now?
TheDIYGuy999 I'm new with learning arduino system, and it is because of you and I also own a wltoys a959-b which is very fast. So fast that it takes a lot of effort to steer it correctly which sometimes bores me to use it. But with your projects, it motivates me to learn arduino more. You've become my inspiration on learning this. Thank you very much for making your videos more simple to understand. Hopefully I can make this things that you're doing soon. As of now, saving your videos and will return to it on a later time. Will wait for your more videos and projects. More power and kudos to you!
jeff delacruz Thanks a lot for your kind words, very motivating. I hope, that you can realize your own projects soon.
Widlan Mujahid does your MPU-6050 IC point downwards? If not, you have to change the "mpuInversed" variable from "true" to "false", so that your gyro works in the correct direction. You may also have to change the "mrscGain" variable to fit your needs.
Wow! Amazing, thank you!
You're welcome
@@TheDIYGuy999 I just got all the components, hopefully I can do this. All these are new to me (zero knowledge). Thanks again for all your awesome videos. Yes I would like to buy you coffee through "Patreon", but the page doesn't seem like working.
@@lipinghe40 Hi, I wish you much fun, building your stuff. Patreon should now work. Thank you for your support and have a great day.
@@TheDIYGuy999 Just finished the MRSC 5 pin. Haven't tested it. Thank you. I also subscribed to your Patreon.
@@lipinghe40 Have fun testing it. And thank you very much for subscribing on Patreon
Brilliant guide. Jus trying to do the isp software upload now. Built the mpu6050 sandwich board
Thanks. Good luck with your project
i wa searching for something like this thank you very much man!
You're welcome
Fantastic work! Took me a little time to figure out how to implement this will slightly different hardware, but it works great! Thanks you :-)
Thanks
You my friend are Genius! Can you please tell me something. On 1:27 you show up some other micro board (pro micro 8mhz)
So I need that too? I can see that board(pro micro 8mhz) is attached to some plastic holder with capacitor. Do I need that capacitor as well and that plastic holder or i can just connect it with the pin cables to the Arduino Pro Mini 3.3V, 8MHz and flash it like that?
I can't wait to build my unit and install it on my JLB 21101 racing who runs on 4S. It's very hard to control it at higher speeds and I have change servo but it's not that better. I really want to upgrade it with this stability control like you did.
Thank you so much man for these videos and keep a great work!
Thanks for the praise. The Pro Micro is used as a programmer. The capacitor is not really required. And yes, you can connect the wires directly, without the so called bread board. Upload the code according to this manual for my DIY transmitter: github.com/TheDIYGuy999/RC_Transmitter/blob/master/Manual_English.pdf
See pages 18-20
TheDIYGuy999 Thank you so much for the info! You earn a new subscriber :)
Best regards from Sweden!
Hello there, i just built this and im having an issue. I uploaded the code and the throttle is working on my hpi racing tf40 controller to my rf40 recevier but not the actual servo and i dont have any idea why.
TheDIYGuy999, you are brilliant! Thanks for this! I will try this project thanks to you, my first arduino...
2 questions :
1- can I upload the programm with a simple FTDI instead of using arduino as ISP?
2- can I use the sandwich MPU+ARDUINO only for signals and continue to power the receiver and the servo as before? Doing that, I will use the "aux" canal of the receiver to power the MPU+ARDUINO.
Thanks for the praise.
1. Yes, as long as the required serial pins are accessible, but I always program my ATmega328P based projects with the ISP
2. It does not matter, because the power pins of all your receiver channels are wired in parallel anyway.
Good luck.
@@TheDIYGuy999 can this be used in the K989 wltoys receiver? the thing is the output is only 3 servo pins and 2 pins to the dc motor
Hello bro. I really really really appreciate your videos, I think, and I'm not lying that yours are the best and complete arduino tutorials on the whole web. I really appreciate your contribution, and I think that the network should be promoting persons like you. I'd like also to ask you one thing : I want it to use in my RC rwd drift car, it's possibile to change the "gain" of gyro?that sort of potentiometer that you use to change the gyro intervention percentage. Even directly from aux/3rd channel on the radio, like RC gyros do? Thank you very much for your attention. I'm really happy you do amazing things like this
Hi. Thanks for the praise, I really appreciate it. Yes, you can do that. Just use a free channel of your remote.
I have just uploaded Version 0.3 on my GitHub: github.com/TheDIYGuy999/MRSC_Adapter_3Pin_Servo
For details have a look at the Readme.md, which also contains several video links.
Thank you very much my friend. I will build one asap and I will let you know.
Very nice work. Got it to work.
I have two channels left, a push button and a three step switch. Is there some way I can use the button to rotate between settings?IE. Off - 50% - 75% -100%
Thank you!
Thanks. The best way would be to replace the 3 position switch on the transmitter with a 10kOhm potentiometer.
Martin Hello )) Is this the best thing I've seen on atmega328 -
1) tell me please - in all such - "Gyro Stability Control" does it work with the throttle? Traxxas TSM - Or is there an option to just stabilize the steering wheel ??? What is the question? Can you just stabilize the steering wheel? No throttle??
2) And another question - is it possible to make such a project - without a receiver, but with NrF 24 ?? And I don’t understand why the gas signal is for this?
Hi, thanks very much for the tutorial, as with some ppl in this comment section this is my first arduino project too. I tried doing this with the mpu6050 and arduino nano instead of the pro mini, manage to upload the code and wire everything correctly (I think). However I have one problem, the mpu6050 does not seems to influence the steering servo (output end) at all even when the throttle input is press in on the transmitter. Can you give me some suggestion on how to fix this problem? Thanks for the tutorial and help in advance
If I use Arduino mini 5v 16mhz, what changes should I make? Please help.
if my rc car (hsp 94123) receiver and servo is 4.8v-6v input, then should I use a 5v version mini pro board ?
No, the signals of most receivers are 3.3V. The supply voltage always needs to be higher than vcc
Can you make gyro for rc helicopter for tail Motor to manage main Motor torque ( specially for brushed motor)
does it work with your 2.4 ghz transmitter and receiver
Excellent video Master, Excuse Me, I have a question, an online store that you recommend to buy electronic devices (resistors SMD, capacitors SMD etc) of international shipping?. Thanks to your videos I have managed to design my own receiver.Thanks so much. Regards
Thanks for the praise. Alice is usually pretty good for Arduino stuff: www.ebay.com/sch/m.html?_odkw=&_ssn=alice1101983&_armrs=1&_osacat=0&_from=R40&_trksid=p2046732.m570.l1313.TR12.TRC2.A0.H0.Xesp32.TRS0&_nkw=esp32&_sacat=0
can i use the code on a arduino uno?
can this be used in the K989 wltoys receiver? the thing is the output is only 3 servo pins and 2 pins to the dc motor
Yes, if it is 3 pin, it should work. I also have a version for 5 pin servos BTW
@@TheDIYGuy999 for 3 pins the throttle input is connected to which pin on the receiver wltoys k969? i am still confused how to connect the throttle input. the problem is the receiver with internal ESC. please help me
@@TheDIYGuy999 please help me ,i try on wltoys k969 but not working...help me to make a wiring diagram and the sketch...please😢😢😢
This is very impressive. I'll have to have a go at making this at some point. Would you consider making the gain adjustable with a 3rd chanel?
Thanks. Making the gain adjustable using a 3rd channel is no problem. Is someone else out there who woluld like to have this feature?
TheDIYGuy999 You're a legend! Have you ever tried using this on a rwd car? I'm wanting to make a 1/27 scale drift car and was curious if I could get away with just using 2wd instead of 4wd
I've just been ordering the parts to make a couple of these. I'm curious as to why you are using a 3.3v pro mini when servo voltage is around 5v and the mpu board can take 5v? Is it just to drop the voltage down for the mpu board?
that would definitely be a great feature !!
Can this be used with a different gyro module, like the mpu-6500? I ordered 2 mpu-6050 from aliexpress, and they sent me one 6050, and one 6500 accidentally. I damaged the 6050, and it'll be 5 weeks before I get the replacement 6050 due to aliexpress shitty methods, so I would like to use the 6500. Just wondering if it would be possible.
I wired up a 10k pot, but it didn't work.
I'm sure I wired it correctly. Variable (pot pin 2) to pin A1, and the other pot pins to positive and negative. The pot works, as my multimeter showed, but there was no gain adjustment happening on the gyro.
Is it specific which way the + and - go into the pot?
If you want to use a pot for the gain adjustment:
comment out code one 170 , using //
uncomment code line 204
But you can draw a connection diagram, I can’t figure it out how?
Sorry if I've missed the explanation but why does your bootloader need writing to the board? What does it add & why is this required?? Why does this process require your board definitions? I built your 5 pin version without having to do this and it worked perfectly (thank you!) I currently don't understand why the 5 pin doesn't require the above but the 3 pin does? Thanks
My bootloader is lowering the brownout voltage to 1.8V. The stock loader is adjusted to 2.5V, I believe, which is too high for the 8MHz version and can cause unwanted reboots (depending on how stable your supply voltage is). Of course you also have to burn the bootloader, if you use a new, blank 328P IC.
TheDIYGuy999 That makes total sense, I didn't realise that could be adjusted. Thanks for your reply and explanation :)
In your opinion - where should the gyro best be located? In the X of the four whels? Low or high? Middle of the fron wheel? Low or high?
it doesn't matter, because the accelerometer is not used in this application, only the gyro. Make sure, that the MPU is facing upwards or downwards. Change the "mpuInversed" variable from "true" to "false", if the counter steering works in the wrong direction
Hello There! I recently made this with a arduino Nano and it works really good! But ive been researching on how to get this working with an arduino pro micro with no luck. I was going to ask if maybe you could help me with the code because im sort of a beginner
THE MISO and MOSI pins on the Pro Micro are different google for it.
Hi. So I've finally made one for the A959b. I love it but I have a problem. When I turn on the power it fully locks the steering right cracking the gears in my servo. It doesn't stop till I touch the steering on the remote it then centralise. I'm pretty sure my servo is f#&@ed now. Any ideas why it does that?
Hmm, this one is for 3 pin servos. If you talk about the 5 pin version, then your two servo motor wires may be reversed, so it's turning in the wrong direction.
TheDIYGuy999 sorry yes I realised I posted on the wrong video. TS the 5 wire one.
I will double check the two wires against your video again and see. Meanwhile i need to buy a few spare servos just in case. Thanks.
Can i use a usbasp device to burn the bootloader and upload the program, instead of using a pro micro as ISP?
Awesome project, it would be really helpful if you can provide a circuit diagram or so..
Thanks. Yes, you can use it. You can find the schematic, the pcb files and the software in the GitHub link in the video description 😉
Sorry, I was wrong. There is no schematic, but everything is clearly labelled on the pictures.
yes... i tried making it.. guess some problem in burning the bootloader or program.. am not able to figure it out.. if possible can i email you... my email id is rufusvargis@gmail.com
Thanks a lot..
Hello again (hope you won't tired replying my question and rants *peace). It might be an optional, but it's still bug me....How to wire Variable Resistor (3 wire pot wiper) for MRSC gain adjustment? From what I can see at the bread board, it is GND, arduino VCC, and Arduino A1 (for pot wiper's middle wire). Is it correct?
Is 501 (5K) Var. Resistor can be used instead 10K?
Analog input A6, according to the schematic: github.com/TheDIYGuy999/RC_Transmitter/blob/master/Eagle_PCB/Micro%20RC%20Transmitter.pdf
You can use any pot value between about 5k and 100k
I want to put pot. wiper on MRSC board using 5K VR. Just now, connect it to Arduino VCC , GND, and A1 following trimpot position at 0:39 ...But somehow the resistor noticeably did nothing. Sometimes the servo signal didn't respond well (might be wiring issues).
Sorry, I was wrong. On this board, you have to connect the pot wiper to A1. Have a close look at your wiring, use a magnifying glass. Maybe you should test the circuit with a multimeter. Good luck.
TheDIYGuy999 So I assume that the trimpot must connected to A1 on one end, and GND on another end. The resistor value then can be adjusted from 0 to 5K ohm. Is it correct?
And yes, it was wiring problem...But after it works seems it draw too much current (at gain=80). Trimpot wiring also seems wrong (was connected to Arduino A1, VCC, and ground) , might contribute to any failure. Too sad that I killed another 20A esc. Good thing that replacement is cheaper than k989 rx. Gonna set it about 30~40 at gain for next time
Hello, I can say with all my heart that I am delighted with your films and just started to assemble a gyroscope to my 2wd truggy according to your design but I have a small problem. I stopped at the very beginning of construction because I have arduino Leonardo or arduino nano to program the arduino Pro Mini. Unfortunately, I'm very green in writing advanced programs and I do not know how I can use arduino that I have instead of which you used as a programmer. I am asking for a little help on how to modify the program so that I can use Leonardo or Nano as a programmer. Thank you very much in advance for your help.
Hi, It works exactly the same. For more detail on how to program it, have a look at pages 18 - 20 of this manual. Please note, that you have to wire 1k resistors in series with your mosi and miso wires, if you programmer runs at 5V and your pro mini on 3.3V. Good luck
Thank you very much for response :D. I'm going to try next day :D
What instruction is it? Because, unfortunately, I can not go on with programming this one :(
Sorry, looks like i forgot to attach the link to the mentioned manual: github.com/TheDIYGuy999/RC_Transmitter/blob/master/Manual_English.pdf
You can find the details on pages 18 - 20
Tank you very much again :D I have hope i can do this myself :D
Hello there!
I sent you a pm as well on instructables. Awesome work.
I am trying to adapt the gyro stabilization for my R/C but i don't have the 328P arduino, I have the 2560 mega. Can it be done like this? I assume the signals/interrupts are not the same?
I downloaded the program as-is, but also tried changing the servo pin to 7 instead of A0, it does not work in either case. the servo does not move with steering input, or by moving the gyro. But it remains centered with force, which means it receives a signal. Both A0 and 7 do that.
My 6050 and servo wirings is fine, i tried another program to simply add gyro angle to the steering and it works. SDA/SCL is at 20/21 on the mega, and I have INT of 6050 to pin2 on mega. I suppose its either the steering input or processor loop time / interrupts issue as its different than the 328p.
Much appreciated if you could help.
Hi, yes the Mega needs different code, but I can't help you with the details. I recommend to use the ProMicro, it is very cheap and small, so it is perfect for applications like this.
@@TheDIYGuy999 Thanks. I just wanted to know if it will work speed-wise, i might give it a try, just to say i did something :D. Do you think it needs modifications in the input pin masked interrupt routine only? I will also check the MPU data validity, the pins are different there. I will order a 328P in any case.
@@TheDIYGuy999 ok i have made progress understanding your code, i am close to making it work on 2560. the only difference will be the interrupt codes and mask inside interrupt routine. May i ask why you decided to go with creating your own pulse count interrupt routine on steering input, instead of just pulseIn() function? Is it more steady?
@@mefuzion The pulsing() function is blocking. We don't want that.
@@TheDIYGuy999 Not as blocking as your interrupt function? Whats the difference here really i don’t have the knowledge to tell. -> BTW for a quick test, i replaced uSec[0] with pulseIn(mysteeringpin , HIGH) and it seems to work very well. Testing live on a traxxas erevo brushless.
heres a quick video. only thing noticing is some pulses every second to he servo when it sits still without input: czcams.com/video/oSgvUbO-1iI/video.html
Is anyone interested in selling one already assembled?
Sorry, but I'm just too busy to do it
@@TheDIYGuy999 Can the device be adapted to act as an electronic no-wheelie? Sorry for my translate.
" vakanoff Snyder3 months ago
TheDIYGuy999
After got k989 receiver replacement, I redid the MRSC board...At first, it makes servo twitching abruptly...
But after some adjustment on gain, centering code, and added capacitor on GND/VCC, the twitch is pretty much decreased. It works like a charm now. "
am having the same problem.. steering not responding to signals.. just servo twitches abruptly... can you guide me on wat modifications in gain, code i should do.. and how much rated capacitor should i use..
You can find all the required component values on the pictures in the video. Everything is labeled. The code on my GitHub works flawlessly for me. There must be an error in your wiring.
He's right, if steering not responding then it must be wiring problem. A way to fixing wiring problem is redid all soldering process.
for reducing twiches, I just tweak some parameters a bit
// Servo limits
byte limSteeringL = 46.308, limSteeringR = 133.692; // usually 45 - 135° (90° is the servo center position)
And
// Compute steering compensation overlay
int turnRateSetPoint = map(uSec[0], 990, 2010, -50, 50); // turnRateSetPoint = steering angle (1000 to 2000us) = -50 to 50
Then add 220uF 10V capacitor for stabilize voltage trough MRSC board
But after some trial, I conclude that k989 stock receiver is not really compatible with this MRSC board since throttle function is vital for this very application, and servo mosfet likely get burned soner or later.
That's why I used the fully "Micro RC" receiver integrated MRSC solution for this car. This standalone unit works absolutely flawlessly in my JLB Racing Cheetah, though.
Sure, I highly interested om making full set of these....Even the transmitter looks so cool and has very good performance. Just need more time for getting some components and a set of air solder for this project. Soldering SMD components is very challenging to me but I might did it in future. Thanks and nice project btw
how can I learn to program, thanks. Some book
I never had a book. I just had a look at examples and if I didn't know the syntax I had a look here: www.arduino.cc/reference/en/
You can also find tons of examples with Google
very nice project! Would a 5V arduino also work? Why 3.3V?
Thanks. All recent RC electronics use 3.3V for the logic signals. The MPU-6050 also is a 3.3V device. That's why I'm using the 3.3V version.
@@TheDIYGuy999 would the 5v version work though? Using the 3.3v output pin instead of the 5v?
@@TheDIYGuy999 or even one of the 3-5v input mpu6050 units? If you are unsure, I'll be testing it out in a couple weeks when I get my parts in, and I'll let you know.
@@oldmanbluntz did your 5V version work ?
I wrongly bought a 5v board
@@singlag yes, the mpu6050 worked fine, as they have a regulator on board to drop the 5v to 3.3
Hi, can i use adruino pro 5v 16mhz
No, because the analog signal level of the WLtoys receiver is 3.3V
@@TheDIYGuy999 thanks
@@TheDIYGuy999 but the nano has a 3.3v output. That one wouldn't work to power this?
Arduino : 1.8.4 (Windows 10), Board: "TheDIYGuy999 328P (8 MHz ext. Oscillator), ATmega328 (3.3V, 8 MHz, 1.8V Brownout)"
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03
I have this error while trying to install bootloader
could you help me please ?
Hmm, I know nothing about your hardware. Pro Mini 8MHz? Programmer? I assume it is wired incorrectly
TheDIYGuy999 I have this arduino :Pro Mini atmega328 3.3V s.aliexpress.com/VFvQBFNZ
And I am using a pro micro as isp programmer
I think wiring is good but do you a a diagram? To be sure my wiring is good
pro micro -> pro mini
raw -> raw
gnd -> gnd
15 -> 13
14 -> 12
16 -> 11
10 -> rst
This wiring is OK. Is the "ArduinoISP" sketch installed on your Pro Micro programmer? Is the Pro Micro a 3.3V, 8MHz version?
TheDIYGuy999 Oh the pro micro is 16mhz....
can you help me, iam with arduino nano tutorial... thx
The nano pins are exactly the same
TheDIYGuy999 oke thx
would it be possible to have this on coca cola car? :) i know it doesen't have servo, but stand alone MRSC for acceleration?
No way. There is just no room inside a CCC. Why not just use the "Micro RC" remote?
TheDIYGuy999 I'm short of one nrf24, but I'm going to make it though. I was about to make more simple version of it, but after some time I realized that it would be easier to build your version, so I wouldn't quit the whole project out of frustration.
Why do you sound like Andreas Spiess
? neighbour? :-)
Because I am ;-)
Well, almost
@@TheDIYGuy999 The "Bye~" in the end is 99.99% the same. :->
Will this work for coke can cars?
No, it will not fit, but it's not required. The MRSC software is included in the "Micro RC" receiver. See this video:
czcams.com/video/jr5yYBal3vk/video.html