RC India

RC Models => Self-designed, DIY and College Projects => Topic started by: saikat on November 30, 2014, 11:44:41 AM

Title: Multirotor board - balancing robot
Post by: saikat on November 30, 2014, 11:44:41 AM
Can anyone suggest how to make a two wheel balancing robot using a multirotor board.

I can't write code so please consider that when replying.
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 01, 2014, 10:07:24 PM
Are you determined on using a Flight control board for a Segway like balancing robot ?
Otherwise you can make a special control board out of arduino and sensors.
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 02, 2014, 12:44:36 PM
yes i know about the uc/acc/hbridge method - i want to use a FC ,
as i have a couple lying around.

i was thinking of using multiwii in airplane mode and using two servos (modified for continuous
rotation) for the drive.

i can also attach a reciever a drive it around.


any drawbacks to the above ?
Title: Re: Multirotor board - balancing robot
Post by: SK1701 on December 02, 2014, 12:55:36 PM
Seems like a very interesting concept. I would love to see it in action. instructables.com has several self-balancing robots but from what I have seen, they use the Arduino/sensor method. Good luck sir.
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 02, 2014, 04:51:32 PM
@saikat ji, It should be working,

meanwhile, see this, http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-and-/ (http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-and-/)

you can even try tweaking the code there to run in multiwii h/w
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 07, 2014, 12:05:52 AM
Hi Saikat,
Wow what a coincidence!!
Me too trying to do exactly the same thing. A self balancing robot using the MultiWii SE 2.0 board. I decided to use this board, as I see lot of similarity between the individual boards setup & this FC board.

I have found links giving info on this. Could be of use to you too,

https://communities.intel.com/message/249321 (https://communities.intel.com/message/249321)
http://forum.arduino.cc/index.php/topic,7943.0.html (http://forum.arduino.cc/index.php/topic,7943.0.html)
http://www.x-firm.com/?page_id=148 (http://www.x-firm.com/?page_id=148)
http://forum.arduino.cc/index.php?PHPSESSID=pgqgui4snvnrj9jl7mmhr9j4n2&topic=8871.0 (http://forum.arduino.cc/index.php?PHPSESSID=pgqgui4snvnrj9jl7mmhr9j4n2&topic=8871.0)

One info I have found out is that servo's don't serve this purpose. You need a motor which has atleast 200RPM minimum for the faster corrections.
I doubt if servo's would give that RPM. I suggest using the DC motors with L293/L298 driver.

If you have already finished this project, please share the details. Else once I complete, will post the update here.

Cheers!
Sudhakar
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 07, 2014, 11:22:23 AM
Hi Sudhakar

yes .. unfortunately servos are not fast enough ... I realised that
only after hacking two perfectly good servos.

I tried fitting CDs as wheels ... reasoning that larger dia would result in faster travel
only worked partially . could balance on a bed (that too not very well) and not at all
on the floor.

next line of action will be to use two brushed motors (speed 300) size and drive
them using two brushless esc flashed to drive brush motor with reverse.
this will let them be driven off a servo pulse.(hopefully)

pls keep me updated on your progress.

Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 07, 2014, 11:54:15 AM
why not  brushless motors ???
they give ultimate response.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 09, 2014, 11:20:47 AM
Hi Saikat,
What code did you use for your bot? Did you wrote your own code or used the MultiWii original one?
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 09, 2014, 01:01:08 PM
multiwii original - options changed to #airplane in config.h

does any one have any cheap atmega based brushless ecs (6-10amp) for  sale ?

I require two.
.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 09, 2014, 03:16:59 PM
How would air plane configuration support the balancing bot, air plane has only single motor & balancing bot has dual motors attached.
Can you please explain.
I was trying with Dual copter or BI config which has 2 motors in it. What is your though about it?
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 09, 2014, 04:37:36 PM
the airplane mode can use servos for each wing- I was using servos modified
for continuous rotation with wheels attached instead of normal motors.
dual copter will also work but you will either need motors attached to reversible
esc's or use servos.

for balancing (only) you need both motors to move in the same direction
so it is possible to drive both from a single signal pin using a y lead.
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 09, 2014, 04:44:07 PM
You can use two motor output of a quadcopter ???
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 09, 2014, 04:49:57 PM
you cannot

1. the motors will spin only with application of throttle
2. the motors have to be reversible. (the robot while balancing will move both forward and backward)
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 09, 2014, 05:01:33 PM
yeah I got it,
Why not use a custom firmware with multiwii h/w ?
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 09, 2014, 05:13:21 PM
aah ... the million dollar question.

My knowledge of C+ is very rudimentary - certainly not good
enough to write a program of this level.

Am learning though...

Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 09, 2014, 05:17:18 PM
You don't have to be a master in C for Arduino programming.
You can use Arduino codes written by other peoples for this purpose, and tweak it for multywii board :) .
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 09, 2014, 05:56:09 PM
I understood your point Saikat.
L293/L298 boards provide dual motor forward-reverse option for driving DC brushed motors.
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 09, 2014, 06:25:30 PM
L293 can drive 2 Brushed motors b/w or f/w - But this IC can't be interfaced with a multiwii firmware.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 09, 2014, 09:16:38 PM
You are right sooraj, But we need to design a custom firmware for this driver.
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 09, 2014, 09:22:48 PM
Use a code written for atmega 328  (Arduino UNO) and tweak it to run on multiwii sensor (MPU6050)
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on December 10, 2014, 01:00:00 AM
Quote from: sooraj.palakkad on December 09, 2014, 09:22:48 PM
Use a code written for atmega 328  (Arduino UNO) and tweak it to run on multiwii sensor (MPU6050)
look at your Reply #4 if you are using L298N, that code should work without modifications for the multiwii boards.


EDIT:  Arduino UNO + MPU6050 +HMC5883L + BMP085 - FTDI (redesigned with removed some regulators) = MultiWii SE 2.0
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 10, 2014, 06:30:17 AM
Yeah, I forgot I pasted that link here !.
In that instructables, H/w similar to multiwii board is used. So it's as easy as load and run , but if the configured o/p pins with that f/w is not any of the multiwii motor o/p pins, yo have to either hack the multiwii board or the code (Hi hi, that rhymes !) .
Sorry I am too lazy now to read the code used in that instructables and find which are the o/p pins, but if you couldn't make it out, I can do that :)
Title: Re:
Post by: akhilzid on December 10, 2014, 10:30:57 AM
Pins in that configurations is D10, D11 (PWM) Pins, same pins available @ multiwii se  too (Look at the ESC Connection Pins). So no need to change code for that.

Still you need to change that just modify 4th and 5th line (#define PWM_L 10 #define PWM_R 11) to any of the pwm pins(3,9,10,11 are available) in multiwii se.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 10, 2014, 02:08:18 PM
Hi Akhilzid,
For the code given in http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-and-/ (http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-and-/)
Following are the changes I could see in the definitions as per the attached L293 & Multiwii circuit diagram.
Let me know if you think any thing else need to be changed.

MultiWii Board                     Peripheral Connection
-------------------------------------------------------------------------
#define LED 13                       LED
#define PWM_L 10                            L293-Pin1
#define PWM_R 11                            L293-Pin9
#define DIR_L1 6                            L293-Pin2
#define DIR_L2 12                            L293-Pin15
#define DIR_R1 8                            L293-Pin7
#define DIR_R2 9                            L293-Pin10
#define SPD_INT_L 3//1      
#define SPD_PUL_L 4
#define SPD_INT_R 4//7
#define SPD_PUL_R 5
#define MPU_INT 2//0
#define K_AGL_AD A0                    Change A0 to A4
#define K_AGL_DOT_AD A1            Change A1 to A5
#define K_POS_AD A2                    Change A2 to A4
#define K_POS_DOT_AD A3            Change A3 to A5
-------------------------------------------------------------------------
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on December 10, 2014, 02:41:37 PM
i think two pin mappings need to change like this.

MultiWii Board                     Peripheral Connection
-------------------------------------------------------------------------
#define DIR_L2 12                           L293-Pin7
#define DIR_R1 8                            L293-Pin15
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 10, 2014, 02:53:59 PM
Thanks akhilzid, What about the Gyro/Acc pins is that ok?
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 10, 2014, 02:57:58 PM
The sensors (gyro / acc) are interfaced through I2C, so you don't need to do any thing there :)
Just do the modifications in code as suggested by akhilzid, and you are ready to go !
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 10, 2014, 03:03:37 PM
Cool, Will try out & post my experiences..
Thank you team!!
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 10, 2014, 03:16:06 PM
Best of luck, and don't forget to post a build log so that others could get help from it .
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 10, 2014, 04:15:47 PM
You will not be able drive a l293 just by reassigning the pins in
the multiwii code .

the output  for multiwii is ppm - used for driving servos and esc's (using write() and
writeMicroseconds() ) this will not work with l293 which requires PWM.(using digital write() )

You need to change some other parts of the code also - and
please let me know once you have found out.


Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 10, 2014, 05:33:46 PM
Hey, dude, you should read the previous posts, we are not speaking about multiwii code, I have given link to a instructible , the code in it can be easily run in multiwii board.
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 10, 2014, 09:53:49 PM
yes .. my mistake

going to try out the program now
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 10, 2014, 10:01:16 PM
Best of luck, :thumbsup:
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 11, 2014, 02:12:41 PM
I tried uploading the code & rigged up the bot, but did not see any movement in bot. (Multiwii+L298+Motors+Battery)

Later I tried uploading the multiwii firmware with airplane configuration, This too did not make any difference. I dont see bot moving or cant even stand. (Multiwii+Single brushed ESC+2 DC Motors+Battery)

But my multiwii board seems to be working fine. I can see that on the multiwii tool.

Not sure what is the issue, will have to check it tonight..
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on December 11, 2014, 03:42:03 PM
can you post an image/drawing of that wiring?
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 11, 2014, 04:43:44 PM
For L298, I have connected the same way as per definition in code.

I will share the circuit diagram in some time..
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 11, 2014, 04:44:09 PM
does the interrupt pin in the MPU need to be connected ?
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on December 11, 2014, 06:55:42 PM
i think no, code is using dmp to read values and yes that code is checking mpuinterrupt is active or not but cant find any code that mpuinterrupt is madatory.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 15, 2014, 11:16:31 AM
Hi Akhilzid,
Sorry for delay, PFA the wiring diagram.
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on December 15, 2014, 11:18:56 AM
cant see uploaded image, is zero KB? Please re upload.

Edit: Ok, i can see now.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 15, 2014, 11:27:42 AM
Ok, Just remembered, I have common grounded both boards.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 18, 2014, 10:25:44 AM
Hi Saikat,
Any luck with your bot?
Mine still having issues using L298.
BTW how did you wire your bot with servos? On multiwii board, which pins did you connect the servos to? Can you please share the schematic of your bot with servos?
Title: Re: Multirotor board - balancing robot
Post by: sooraj.palakkad on December 18, 2014, 10:32:03 AM
HEy, what I have last heard, Akhil eattan (Akhilzid) Already made a prototype ! He send me a video of it last week - but it was not RC then- don't know whether he have added remote control now :)
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on December 18, 2014, 11:26:40 AM
Wow!! thats a great news... Akhilzid, can you please share the video & the details of bot?
Title: Re: Multirotor board - balancing robot
Post by: saikat on December 18, 2014, 01:27:34 PM
i have ha some success - with servo a amp board driving a l298 from multiwii.

that way  I was able to use the multiwii code to drive a l298


i am away now - will post some pics when I get back.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on January 02, 2015, 10:41:50 AM
!!Wish You All Very Happy New Year!!
Did you all have any progress on this? Please post your update.
My progress is, wheels rotates to the direction either forward or backward the way multiwii board tilts to. But balancing doesn't happen. Looking into this issue.

Thanks
Sudhakar
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on January 02, 2015, 11:29:54 AM
here is mine
still need lot of tuning.

http://docs.google.com/file/d/0B83oq3WVM0KWQkRMN3JDU3VieDQ/edit?usp=docslist_api (http://docs.google.com/file/d/0B83oq3WVM0KWQkRMN3JDU3VieDQ/edit?usp=docslist_api)
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on January 02, 2015, 03:00:33 PM
Good one Akhil.
Can you please share hardware & arduino code details of your build? 
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on January 02, 2015, 04:08:00 PM
Hardware:

Arduino Mega2560 + MPU6050 (Can Replace With Multirotor Board)

Brushed ESC 20A Without Reverse

6v Relay (To Reverse Motor Direction)

Normal Toy Car Brushed DC Motor + Gears + Wheels (Taken as Whole assembly)

Firmware:

MPU 6050 Library

Kalman filter library (Kalman.h) is from https://github.com/TKJElectronics/KalmanFilter Doveloped ByKristian Lauszus.

And some Modifications From Me To Be Balanced.

And the code is attached here.
https://drive.google.com/file/d/0B83oq3WVM0KWMGZzSEhRM19Wb2c/view?usp=sharing
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on January 02, 2015, 05:49:09 PM
Cool. I will post details of mine soon I am done.

Thanks.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on January 23, 2015, 12:07:01 PM
My SBR is up after long effort, still needs lot of fine tuning. Thanks Saikat & Akhil for the info provided.
Here is the test drive link,
http://youtu.be/rUtU7_Cgufg (http://youtu.be/rUtU7_Cgufg)

Cheers
Sudhakar
Title: Re: Multirotor board - balancing robot
Post by: akhilzid on January 23, 2015, 12:48:36 PM
good progress sir.
increase height of that platform will help balancing better.
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on January 23, 2015, 12:52:12 PM
Thanks Akhil, Planning to do it over weekend. Will try it & share the progress.
Title: Re: Multirotor board - balancing robot
Post by: saikat on January 23, 2015, 05:06:54 PM
Hey good work man - what motors are those ?
Title: Re: Multirotor board - balancing robot
Post by: roshan.dixit on January 23, 2015, 07:44:52 PM
Sounds cool
Title: Re: Multirotor board - balancing robot
Post by: sudhakar_yg on January 24, 2015, 02:23:44 PM
Thanks Saikat & Roshan,
Its 300rpm 12v motor driven directly from L298 board.
Title: Re: Multirotor board - balancing robot
Post by: keshv14 on December 16, 2022, 02:42:42 PM
The details of arduino based self-balancing robot are available at https://robu.in/.