Introduction: Arduino Quadruped Robot

Picture of Arduino Quadruped Robot

Latest Hexapod: https://www.instructables.com/id/Arduino-Mega-Hexa...


This is my first robot that relies on calculations to position the servos vs. relying on pre-programmed sequences. I chose a quadruped to help keep the cost down.

Build Time 8 weeks
Weight 2 Pounds 14 Oz.
Dimensions 8 inches, 8 inches, 7 inches (L:W:H)
Run Time 15-30 minutes
Programing Language Arduino IDE
Control Method Blue-tooth Remote
Cost ~$540.00

Powersource: LiPo

1x 7.4V 1650Mah 2S LipPo

I am powering everything using a 2S LIPO & Turnigy 15A UBEC (Ultimate battery elimination circuit). I love the UBEC and will definitely be the regulator of choice for future robot projects.

Locomotion:

The body's roll, pitch & yaw are calculated using a rotation matrix. That in turn feeds into the Inverse Kinematics equations that position the legs. I am using a ripple gait for walking although I am still fine tuning that portion of the code. A few modes exists, 1: Body Translation/Body Position 2:Walking Mode 3:Accelerometer Mode. The first two modes are pretty self explanatory; accelerometer mode takes the x-axis & y-axis from the accelerometer, maps the values to (-20, 20), then use those values as the body's pitch & roll respectively. This allows the robot to stay level on uneven surfaces.

It has been some time since I have been enrolled in a math class. I also don't believe in re-inviting the wheel; I used the rotation matrix & inverse kinematics from NUKE (Nearly Universal Kinematic Engine). I am not using the micro-controller is was designed for so I could not use their python tools to generate the code I borrowed from. Instead they had an already completed sketch for a quad which is what I modeled my program after. A big thanks to the people that put that tool together, it was true to its name! Also big thanks to "tom_chang79" his discussion, "Let's Discuss Kinematics, Shall We?" was very helpful. Thanks, & thanks for your email responses!

I have built a blue-tooth remote control which has worked great so far. As I continue to progress I intend to build more functionality into my remote and robot. I found some 3-funtion joysticks at servo city that will replace the parallax joysticks I have now.

Here is the link to the ideal joysticks from servocity:
http://www.servocity.com/html/3_function_joystick...

Controller/CPU: Arduino MegaMini 2560, Lynxmotion SSC-32

The Arduino Mega handles all of the computation along with taking input from the accelerometer & blue-tooth. Once all the calculations are complete it sends the appropriate commands to the SSC-32 servo sequencer. I love the SSC-32 it is super great!

Sensors

Triple Axis Accelerometer (ADXL335)

When I started off I thought that I would need a 3-axis gyroscope in addition to the accelerometer. My thought was that I would need to mesh the data together using a Kalman filter. I have worked with IMU's (Inertial measurement unit) in the past and needed to use directional cosine matrix's to mesh the accelerometer, gyroscope and compass readings together. This creates very stable orientation data and outputs a single yaw, pitch & roll that doesn't drift. In the end I was able to get the data I needed from just the accelerometer. This is good thing, I would most likely need another MCU to process all that data.

Actuators

I am using HS-422 servo's; I have been very impressed with all the HITEC Servos. At some point I will replace the HS-422 servos with HS-465MG servos which have more torque and metal gears instead of composite.

Step 1: Acquire Parts

Mechanical Parts:

Robot Body (Qty. 1)         Price: $19.95
http://www.robotshop.com/lynxmotion-symmetric-quadrapod-body-kit-mini.html

Aluminum Femur Pair (Qty. 2)         Price: $16.95 (each)
http://www.robotshop.com/lynxmotion-3-aluminum-femur-pair-2.html

Tibia Pair (Legs )(Qty. 2)          Price: $19.95 (each)
http://www.robotshop.com/lynxmotion-robot-leg-rl-01.html

Arduino Mega Platform(Qty. 1)       Price: $8.99
http://www.allerc.com/gaui-330x-payload-mount-set-p-5495.html

Electronics:

HS-422 Servos (Qty. 12)         Price: $9.99 (each)
http://www.robotshop.com/productinfo.aspx?pc=RB-Hit-27&lang=en-US

Lynxmotion SSC-32 Servo Controller: (Qty. 1)          Price: 39.95
http://www.robotshop.com/productinfo.aspx?pc=RB-Lyn-100&lang=en-US

MegaMini 2560 (Qty. 1)         Price: $42.00
https://www.tindie.com/products/jkdevices/megamini-2650-atmega2560-breakout-with-usb/

Triple Axis Accelerometer ADXL245: (Qty. 1)         Price: $27.95
https://www.sparkfun.com/products/9836

Parallax Xbee Wireless Pack(Qty. 1)         Price: $79.99
http://www.parallax.com/Store/Accessories/CommunicationRF/tabid/161/CategoryID/36/List/0/SortField/0/catpageindex/3/Level/a/ProductID/785/Default.aspx

Battery & Regulator For Robot:

1300mAh 2S 7.4V 20C Li-Po, 13 AWG EC2 (Qty. 1)         Price:18.99
http://www.hobbytown.com/Shop/1300mAh-2S-7-4V-20C-Li-Po-13-AWG-EC2/

TURNIGY 8-15A UBEC for Lipoly (Qty. 1)         Price: 15.40
http://www.hobbyking.com/hobbyking/store/__6233__turnigy_8_15a_ubec_for_lipoly.html

Remote Control Part List:

Black Plastic Project Box (Qty. 1)

Circuit Board (Qty. 1)          Price: $4.49
http://www.radioshack.com/product/index.jsp?productId=2102843

Arduino Nano (Qty. 1)         Price: $34.95
http://www.frys.com/product/6745715?site=sr:SEARCH:MAIN_RSLT_PG

Parallax LCD (Qty. 1)          Price: $29.99
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/lcd/List/0/SortField/4/ProductID/50/Default.aspx

Joysticks (Qty. 2)          Price: $3.99
http://www.parallax.com/Store/Accessories/HumanInterfaceDevices/tabid/822/CategoryID/90/List/0/SortField/0/Level/a/ProductID/581/Default.aspx

5 Cell 6V 1600mAh NiMH Battery(Qty. 1)         Price:17.49
http://www.hobbytown.com/Shop/5-Cell-6V-1600mAh-NiMH-Flat-Receiver-Battery/

Total Cost For Robot : ~$540


Tools Required:

Phillips Head Screw Driver
Soldering Iron
Solder
Dremel
Hex Screw Drivers
Small Philips & Flat Head Screwdrivers
Pliers
Patience

Step 2: Build Front Left Leg

Picture of Build Front Left Leg

Note: Pay close attention to the orientation of each part; the left & right legs will look a little different.  All of the screws and plastic servo retainers come with the parts and for the most part is pretty self explanatory.

When building the legs I connected all of the servos for one leg into ports 0, 1, 2 on the SSC-32. Afterward I uploaded the following sketch to the arduino to center all of the motors on those ports:

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  Serial.println("#0P1500T100 #1P1500T100 #2P1500T100");
  delay(500);
}

I used one of my batteries to power everything; The same thing is done when attaching the legs to the body to assure that everything is centered correctly.  If you don't get it exactly right don't panic because you can always re-adjust things later if needed. 

Step 3: Build Right Front Leg

Picture of Build Right Front Leg

Note: Pay close attention to the orientation of each part

The build process for the right leg is the same as the left leg; the only difference being the orientation of the parts.

Step 4: Completed Legs

Picture of Completed Legs

This is how the front two legs should look when finished; this is also how the rear legs will also look when finished.  

You will want to go ahead and build the rear legs which will also look exactly like the front two legs.  Once that is complete you can move to step 5 and attach the legs to the body.

Step 5: Attaching Legs to Body

Picture of Attaching Legs to Body

Note: Sorry for the bad picture quality.

When connecting the legs to the body I would suggest a friend hold the body while you attach the leg.  All of the servos are being centered while I attached the legs to the body.  If you are confused as to how I am centering the servos please refer to step 3.

You will want to attach each of the coxa (hip) servos at a 45 degree angle to the body.

Step 6: Preparing Arduino Mini

Picture of Preparing Arduino Mini

At his point you will want to go ahead and solder some pin headers onto the Arduino Mini 2560 as seen in the picture above. This makes it easier to disconnect things later if needed.

The pins that needs headers are listed below

VIN, GND  (The Arduino gets power from the 5V, GND on the ssc-32 which is also used to power the servos)
18               (Connects to SSC-32 RX Pin)                
GND           (Accelerometer Gnd)        
3.3V            (Accelerometer Power)     
5V, GND    (Xbee Power)     
17               (Connects to Dout from Xbee)  
GND           (Connects to GND on SSC-32)   
A0, A1, A2  (Accelerometer X, Y, Z respectfully)   

Step 7: Preparing SSC-32

Picture of Preparing SSC-32

There is very little that you will need to do concerning the SSC-32.  Firstly you will want to make sure the corrected baud rate is selected on the SSC-32.  There are 6 sets of pins in the middle of the board; they are labled "BAUD" & "ABCD".  You will want to make sure that there are jumpers on both of the BAUD Pins and no jumpers on A,B,C,D.

You will also want to remove the jumpers on the RX, TX Pins down below the Serial Connector.  This is because will will attach a wire to the GND & RX pins that will run to the Arduino.  This is how the SSC-32 gets it's commands from the Arduino.

Step 8: Install Electronics Onto Body

Picture of Install Electronics Onto Body

The arduino mega is installed on a plate that sits above the SSC-32 pictured above.  I mounted the SSC-32 upside down to make the wiring cleaner, it really helped to do it this way. The xbee radio is also attached above the servo sequencer; I used jumper wires to make the necessary connections between the boards.  This way it is easier to change things later on without having all the connections be permanent.

The layout of things is not set in stone you can deviate from what I have done.  If you have a different look in mind you can change the layout just keep in mind that you will need space for your battery.  In my case the battery and UBEC are installed inside of the body.  That is also why I installed most of my electronics on top; so I could easily access the battery. 

I suggest removing the battery while charging; if something went wrong things could melt or worse.  I used Velcro tape to secure my battery to the robot.

Step 9: Assemble Remote Control

Picture of Assemble Remote Control

This is how I decided to layout my remote you can change it if you want it to look different.  At some point I will change the joysticks used on this remote with ones with potentiometers at the top.  The plan would be to used the extra potentiometer to adjust the height of the robot.   I will have to create a schematic for the remote; although for the most part it is pretty basic.

I got a plastic enclosure box from Frys electronics here in Austin to install the electronics in.   To make everything stay in place I have installed a sock behind the board that keeps everything in place.  There is a USB cord that connects to the li-po charger and fits through an opening in the back of the plastic box. 

Step 10: Upload Source Code

The code for the robot & remote are available through github at the following URL:

https://github.com/davidhend/Qaudruped

Comments

JürgenK4 (author)2017-02-12

Hi David,

The query of the SSC-32 finally results in "GP"

if ((cbRead > 3) && (abVer[cbRead-3]=='G) && (abVer[cbRead-2]=='P') && (abVer[cbRead-1]==13))

The new SSC-32U has a different ending, can it be that I therefore have no sensible leg movement?

What type of extension do I need to enter?

Thank you

Sorry for my english

Juka

miaw so expensive

BenjaminW52 (author)2016-03-29

Hi David,

Are you able to explain the logic for the radToServo function in the quadraped repository under nuke.ino? This doesnt not seem to return a servo offset for a Hitec Motor, i would expect (-pi/2,pi/2) to map to (500,2500) (or +/- 1000 because you add the offset to 1500 when calling make_command)?

I tried uploading the code to my own quadraped and set it to the walking mode with a hard coded Xspeed of 10; the femur and tibia seem to move correctly, but the coxa never move. If i inspect the serial commands, i can see the coxa IK changes but not sufficiently to move more than an integer degree?

I happen to have the same dimensions as your quad defined in one of the header files.

davidhend (author)BenjaminW522016-04-02

To be honest I never got that robot to walk; at the time I was convinced that the motors were not strong enough for a quadruped. With body balancing they might have been up for the job, but I didn’t know how to implement that.

The original code was written for robots using "Dynamixel" servos, it could be part of the reason that you aren’t getting the range of motion you expect. I had to make a change to the leg lift height for example.

Ultimately, I used the parts from this robot to create a hexapod and swapped over to the "phoenix" code base.

At any rate, I found this, maybe it will help you:

http://forums.trossenrobotics.com/showthread.php?7...

Let me know if you have any other questions, I will do my best to answer them.

BenjaminW52 (author)davidhend2016-04-02

Thanks for getting back to me. I'll take a look at the post thanks.

I've got slightly more powerful motors myself (HS-485HB), however mine are slightly oversized which is why I ended up getting the same tibias you have since they only attach the the front of a servo instead of both sides.

I think my servos are strong enough, however I think i've been going about how to balance this thing in the wrong way... I think I need it to shift its weight onto its hind legs while one of the front is extended. Exactly like you are doing at 0:52 and 0:58 in your video when you have it standing on 3 legs. I've been trying to make it stand while keeping 3 of the legs perfectly centred,which is not ideal mechanically, but it would have looked pretty cool.

I had mine balancing on 3 legs using the SSC32-u servo sequencer application: http://www.robotshop.com/ca/en/ssc-32-servo-sequen... Currently trying to get it to walk with no load, trying to simply my problem by removing the weight of my heavy 6v battery. I forgot to save the inputs I gave it, so I'm currently trying to recover that.

Thanks again

MahaderS (author)2016-04-01

amazing, can u send me the arduino code for its four direction motion ?? my email : mahader.sob@gmail.com

MahaderS (author)2016-04-01

amazing, can u send me the arduino code for its four direction motion ?? my email : mahader.sob@gmail.com

sdas52 (author)2015-11-06

Sir I have completed my quadruped and I have successfully modified your code to control it via ps3 controller but the problem is I couldn't find the proper supply for powering my towerpro mg946r servos..here in India I am not able to find the specified ubec so can u help me drive me out of this problem ....any suggestions Will be helpful to me

AKSHAY RAJ (author)sdas522016-03-07

bro....can u send me the arduino code for its four direction motion ??

davidhend (author)sdas522015-11-06

Congratulations, that's awesome! I would think you could get away with using 6V NiMh batteries. The biggest concern is getting enough current to each motor/control board. It might take a little bit of experimentation but you could try powering things with a similar battery to this:

http://www.hobbyking.com/hobbyking/store/__25030__...

Weight is also a big deal, so you will want the most current with the least amount of weight. Good luck & let me know if anything else comes up.

EricN3 (author)2016-01-25

Have you added a body shifting table ?

https://www.youtube.com/watch?v=S8yEUYmBucc

alamo88 (author)2015-12-01

Hi there, i love what you have done here and am trying to make it. However i have afew questions i am hoping you can answer.

I would be doing this with a Uno instead of a mega, with the ssc-32 taking the tx/rx pins, i do not have any other tx/rx pins for the XBee.

Another question is how do you power your servos from the UBEC, i am guessing you had one common live and ground and connected the servos and arduino and ssc-32 parallel to it? I would be great if you have a wiring diagram.

Also in the future i would like to expand it into a hexapod which means 18 servos, a 15A UBEC may not be able to power all of them, did you use two of the UBECs for your hexapod?

Thank you and i love your pink tracking video!

davidhend (author)alamo882015-12-02

Thanks for the kind words; I appreciate it.

In regards to your serial connection question, you could try
using the software serial library that comes with the Arduino IDE to talk to
the XBee.This works by taking two pins
on the Arduino and using them as a serial communication.Typically the speeds are slower on software
serial and would only recommend using a lower baud rate, something like 9600-19200
baud would most likely work good.

With the UBEC, I connect a Li-Po batter to the UBEC which
will provide either 5v or 6v depending on the switch position.I connect the 5V and GND from the output of
the UBEC to the Arduino.Between the
Arduino and the SSC-32 I connect a Serial data line and a GND connection.Your exactly right about the wiring diagram,
maybe someday soon I will put something together.

With my hexapod, I use a second UBEC to power the Servo’s, mainly
because the servo’s generate “electrical noise” when they are moving, which can
cause problems with the XBee/PlayStation remote receiver.It is a good general rule to keep the power
to the servo’s and logic controller separate.

sdas52 (author)2015-11-09

sir as i am not using ssc 32 board and just running the quadruped with arduino mega so how will i modify the code for it .i have noticed that nuke.ino contains some code like make command() and execute commands() which will effect the code for use in my way please help..

davidhend (author)sdas522015-11-11

The SSC32 is very efficient at what it does, it also allows the Arduino mega to concentrate on the calculations vs. moving the joints. The make_command(), execute_command() send serial sentences to the SSC32 servo sequencer. These sentences contain all the servo moments and the amount of time for each movement. I have never tried to integrate both the calculations and servo movements onto one micro-controller. I am not sure if the micro-controller will be able to do both, it might make the movements erratic and less smooth; however, if you felt like trying maybe it will be do-able.

Ideally you would want a dedicated servo controller, either made or purchased. I really think that is the best way forward, although I understand cost and accessibility issues.

sdas52 (author)davidhend2015-11-12

So will I able to do if I arduino nano for primary calculation and mega for servo movement if so please give me just help for doing that

sdas52 (author)2015-10-27

hello david sir .......can u please help me to modify your code to control my quadruped using ir tv remote i am a first year engineering student and i did not know much about programming

davidhend (author)sdas522015-10-27

At a minimum I should be able to point you in the right direction. One quick question though, IR is very directional and could be a problem. With that in mind would you still want to go the IR route?

If you do happen to want to stick with IR, then I would start off by creating a small IR project. The purpose of the project is to create a working remote control then apply that to an actual robot.

This forum is a good starting point, this is how I learned to transmit serial data over IR between micro-controllers: http://forum.arduino.cc/index.php?topic=10555.0

If you are successful in transmitting IR data between chips, then you could start to add buttons/sliders/joysticks and try transmitting the data you get from those sensors to your remote mcu.

There are other ways to transmit data over IR, however this is the most straight forward approach that I found. Also you might want to experiment with multiple IR receivers, although you would most likely need to use something like an Arduino Mega (Atmega 2560) because it has multiple hardware serial lines.

sdas52 (author)davidhend2015-10-27

Sir thanks for ur kind help....also is an arduino mega is enough for a quadruped control or any other third-party hardware is compulsory....one more help please...how can I modify code to control the quaruped using ps3 controller via arduino usb host shield?

davidhend (author)sdas522015-10-29

No problem. The Arduino Mega will be sufficient to control a quadruped, no other hardware should be needed.

All the the remote control code would have to be re-wrote, unfortunately it would take me too much time to help you modify the code. Sorry about that.

With that in mind, I would suggest working in baby steps, get one part working then go to the next. Once you have all the steps completed individually you can begin to combine them to create your final code base.

Here is a tutorial that will allow you to take input from a wired PS2 controller with an Arduino.

http://www.billporter.info/2010/06/05/playstation-...

You could start there and then work on changing the robots code to work with the new controller.

Let me know if you have other questions I will do my best to answer them in a timely fashion.

sdas52 (author)davidhend2015-10-29

Sir thanks for that brilliant answer ....and which part of the code must be modified to set the correct servo offsets or endpoints for my towerpro mg996r servo as the servo may suffer stress and the gears may break

davidhend (author)sdas522015-10-30

If I understand your questions correctly, you shouldn't have to modify any of the code or offsets. On step two,
you will assemble a leg, to do so you will center all of 3 servo's and
then screw everything together. See that step for some clarification but that will make sure the leg comes down to the ground at the correct angle.

When going to attach everything to the body of the robot or powering it
on, raise the body of the robot off the ground with a box of some sort.
That way if anything is not 100% correct you will not be putting any
weight on the legs in order to prevent damage.

I tested all the robots functions in this manner to make sure everything was assembled correctly.

sdas52 (author)davidhend2015-10-30

Thank you sir for the nice guide....can I know what is the use of fastfunctions.ino

davidhend (author)sdas522015-10-30

The file fastunctions.ino speeds up the trigonometry math operations needed to position the body and legs.

By performing these calculations at a faster rate makes the robots motions more fluid.

sdas52 (author)davidhend2015-10-31

Sir at present I don't have any accelerometer so do I have to modify some part of the code for this reason...and which part of the code shows kalman filter algorithms

davidhend (author)sdas522015-10-31

If you don't have an accelerometer then you could just delete the following lines of code from QuadBot_r8.ino :

case 3:

acc_x = analogRead(0); // read analog input pin 0

acc_y = analogRead(1); // read analog input pin 1

acc_x = map(acc_x, 290, 390, -20, 20);

acc_y = map(acc_y, 300, 400, -20, 20);

bodyRotX = -acc_x;

bodyRotY = -acc_y;

doIK();

data = "";

break;

Also I didn't have to implement a kalman filter, I would have needed one if I was also using a gyroscope also. Kalman filters are used to mesh the sensor data together. If you are interested in how that filter is implemented I would google search, "arduino kalman filter".

sdas52 (author)2015-10-28

Sir which part of the code must be modified for the correct servo endpoints as it is necessary or else the gears may suffer stress and break

kasstor (author)2015-09-06

Hi David,

I saw your robot and I am very impress, I would like to do something similar but instead of using a remote I would like to use my phone over Wifi and make an APP.

I have few question, please bear with me I am a total beginner:

1. Why do you use a regulator(TURNIGY 8-15A UBEC for Lipoly)? is it necessary?

2. About battery, 1300mAh is the minimum requirement, more amp can be better?

3. Does HS-465MG better than HS-422? if I want to use HS465 do I need to modify the mechanical parts and software?

4. There is no mention of servo bracket, did they come with the actuators?

5. Since the project is a bit old, do you have any advises/recommendation to

improve this project?

Thanks for your help~~

davidhend (author)kasstor2015-09-12

Thanks & that sounds really cool & definitely sounds like a fun project!

Both of the LiPo batteries that I am using have voltages above the 6V the servo controller needs and the 5-6V the Arduino mega needs. Therefore I needed the regulators to reduce the voltages from the batteries, one of which is a 7.4V the other is 11.1V. The regulators are switching regulators and can handle to amperage requirements for all the servos, it can handle 8 amps and small bursts up to 15 amps.

You can attach a more powerful battery with more mAh if you would like but they typically weigh more. Everything about robots is about balance, you want a good amount of power, but want to also keep the weight low. You will be able to find your own balance.

The HS-465MG is a stronger built servo with metal gears instead of composite and they have quite a bit more torque than the 422's. No modifications are necessary as the 465's and 422's have the same dimensions. The same goes for software. The 422's are still very tough and I am still using twelve 422's and six 465's on the current robot, only because of cost, ultimately I want all the servos to be 465's.

I cant remember the specifics of this build, as you said it was a long time ago. So I don't remember about the brackets, sorry about that. I have since switched to a hexapod with 6 legs. I control the current robot with a PS2 controller and it also has a camera that allows the robot to track objects of a specific colour, currently I have it set to pink because it is less common.

Here are a couple video's of the current robot:

Unfortunately, I have not had time to do an instructable for the hexapod yet. I do plan on it and hopefully by the end of the year I can get that done.

When you use the remote you can control body rotation, the vertical height of the robot, you can tilt in any direction, and a couple other things like walking, strafing & rotating.

I didn’t write the current version of the software, I only modified it to do the camera tracking along with a couple other changes. The code is available on github:

https://github.com/davidhend/Hexapod

The website I got all the parts from also has a complete robot that you can buy, I didn’t do that and am running an Arduino mega which is less common than the other setups they have. Here's a link in case you are interested:

http://www.robotshop.com/en/lynxmotion-phoenix-3do...

Let me know if you have any other questions and sorry it took so long to get back with you. Have a good one.

Thanks,

David

kasstor (author)davidhend2015-09-27

Hi David,

Thanks so much for taking the time to reply me~~

Your set-up with the tracking look awesome, I am getting the part and will start the build, I am so excited.

all the best

Kasstor

AaronK8 (author)2015-08-27

Is it possible to make a bigger version, so the size of of a small tricycle or bike?

davidhend (author)AaronK82015-09-05

I'm sure that it's possible, however, at that size it might be cost prohibitive. Good luck & have fun.

AaronK8 (author)davidhend2015-09-05

Thanks for your reply.. I've been looking at your parts, and do you think it's possible to 3D print the parts my self?

ag10526 (author)2015-08-01

i keep getting this error

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

joystick.ino: In function 'void parse_and_convert_data()':

joystick:73: error: a function-definition is not allowed here before '{' token

In file included from joystick.ino:95:0:

gaits.h:14: error: a function-definition is not allowed here before '{' token

void DefaultGaitSetup(){

^

gaits.h:20: error: a function-definition is not allowed here before '{' token

ik_req_t DefaultGaitGen(int leg){

^

ssc32:36: error: expected '}' at end of input

a function-definition is not allowed here before '{' token

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

ag10526 (author)2015-07-31

which hole is x,y,z on the triple axis

davidhend (author)ag105262015-08-01

You will want to plug the x axis into A0 and y axis into A1 on your Arduino. I didn’t connect the Z axis on my accelerometer.

ag10526 (author)2015-07-25

I solved the code part Thank you! but what numbers to i pulg each servo into sorry im new at this.

davidhend (author)ag105262015-07-27

// right front leg
Coxa 15
Femur 14
Tibia 13

// right rear leg
Coxa 0
Femur 1
Tibia 2

// left front leg
Coxa 31
Femur 30
Tibia 29

// left rear leg
Coxa 16
Femur 17
Tibia 18

ag10526 (author)ag105262015-07-26

And should the code look like that when i go to upload on to mega

davidhend (author)ag105262015-07-27

That looks good!

ag10526 (author)2015-07-24

ps im using arduino mega

ag10526 (author)2015-07-18

Need help mergeing code plz help. thx!

davidhend (author)ag105262015-07-21

So you shouldn't have to merge anything manually. If you download the code and open the


QuadBot_r8.ino sketch in the Arduino IDE, the other files will load automatically. Afterwards you can compile and upload, the IDE takes care of everything for you. The other files just contain subroutines that are called from the loop. Hopefully that makes good sense.

ag10526 (author)davidhend2015-07-22

i try to compile but it is giving me an error sayign "serial1" not delcared in this scope

HeatBl (author)2015-03-31

Can i ask you how you assemble your controller, can you show me the circuit connection or other alternative like can i use bluetooth module hc-06 to connect to android apps controller thx

davidhend (author)HeatBl2015-04-20

Unfortunately I don't have a schematic for the remote and I have disassembled it quite some time ago. However the remote was dead simple, it had one parallax LCD, two parallax 2-axis joysticks and an Arduino mini 5v.

Parallax has a joystick tutorial with connection details and code for the arduino:

http://learn.parallax.com/KickStart/27800

(bottom of page)

If you follow their tutorial and then look at the code I provided for the remote, you should have enough to make it. Good luck & let me know if anything else comes up. I will try my best to get back with you.

Have Fun.

HeatBl (author)davidhend2015-04-22

thx for the reply, i will try it out with the parallax 2-axis joystickst here one thing i would like to ask you also , how do you merge the codes for each sketches for example the QuadBot_r8 codes and the QuadBot_Remote

davidhend (author)HeatBl2015-04-22

No problem; with this project you wont need to merge the sketches together. The QuadBot_r8 is uploaded to the robots Arduino 2560. The QuadBot_Remote code is uploaded to the remote control's Arduino mini. So in the end you will have two micro-controllers, one for the robot and one for the remote.

HeatBl (author)davidhend2015-04-23

Then what about the sub code in the QuadBot_r8 folder for example these:

QuadBot_r8.ino, fastFunctions.ino, gaits.h, joystick.ino, nuke.h, nuke.ino, and ssc32.ino

Is it that i am going to upload these codes one by one or i need to merge it all in the one sketch then upload. If i need to merge the codes then how do i do that. Sorry i am not that good at arduino programming yet, would you kindly explain to me thx :)