Go Down

Topic: Using Arduino UNO + PCA8695 (8 servos)? (Quadruped robot) (Read 1 time) previous topic - next topic

neilpare

Introduction

[EDIT - PREVIOUS TITLE:] Using MR-C3024 (ATMega 128L) with the Arduino IDE (8 servos)? (Quadruped robot)

Hi,

I'm completely new to the Arduino world and to robotics/hardware stuff in general.
I found a 10 year old project i built as a kid but never really programmed.

Now i would like to revive the quadruped robot and program it in C++, not in roboBASIC or similar due to the limitations and... Just not XD

The robot has 8 servos (HITECH HSR-8498HB), a 6V battery (1000mah) all attached to the board in question (MR-C3024 (ATMega 128L), 7.4MHz).



What i tried

I searched online for a while until i found out that Arduino IDE (obviously) supports Arduino-like boards but it is possible to install support for non-Arduino boards.
So i searched for my board online and i found this, that sincerely i don't even know if that's the right stuff to add but i tried anyway.

Now that i think about it, maybe this supports only the ATMega 128L and does not consider all the board.

Anyway once installed following the instructions on GitHub i found myself stuck at this part: "Select what kind of programmer you're using under the Programmers menu." and then "Hit Burn Bootloader.".

In the first step, I don't really know what a Programmer is, how to choose it and why should i use one. Also reading around it seems useless if i use a USB to run the program on the board but also useful to bootload, that bring us to the next point, the second step.
With a bit of research I think the right Programmer should be "USBasp (MegaCore)", don't really know why anyway, trying to burn the bootloader the board gives this error: "avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'"

Trying to Upload without burning it tried for 10 times repeatedly saying it is a Programmer problem.

I stopped here to not make things worse...

Situation

I used a 10 year old obsolete and half-working program on my old Windows PC to test battery and servos, they all work properly (hurray!).

Here is the mobo in all its glory:



General info: the robot has 8 servos (HITECH HSR-8498HB), a 6V battery (1000mah) all attached to the board in question (MR-C3024 (ATMega 128L), 7.4MHz).

I installed MegaCore to add support to the ATMega 128L via GitHub following this guide, I blindly did this since i don't really know if that's the right thing to do or not.

To connect the board to my Mac (hope it's not a problem) i use a Serial to USB adapter. Arduino IDE sees the port when i connect it (photo) (even if it is not connected to any board):



Don't know if this can help but if I try to Tools > Get Board Info a message in the lower bar shows up saying "Native serial port, can't obtain info".



My questions and objectives :)


-In case I use the actual board

I worked with C++ in the past and with C and Swift it is the language i know best. I would like to use the Servo library to program this thing.

Related questions:

1a) How can I get this thing to work?

2a) I read that maybe a couple changes to the servo library will be necessary, is this true? (that is beyond my skillset at the moment obv)

3a) Once and if everything works, how can i assign a serial to a servo (using the servo library) if numbers on my board are completely different than Arduino ones, the Arduino IDE with the MegaCore installed is enough for it to understand what I'm talking about? (I don't even know what I'm talking about XD)

-In case I switch to Arduino Uno + Servo Shield (maybe PCA9685)

I especially care to program in C++ and keep things simple, I'm a begginner after all, what I see online is that if people use a shield often if not always uses an adafruit-related code, that i find a bit frightening to begin with :/

Related questions:

1b) If that's the only way of course i don't think it will be impossible but using the servo library is preferred, can I use it anyway?

2b) I have my servos, i would have to break the cable to attach them to the shield or i can keep them as they are? (pins are matching or not or maybe?)

3b) Which shield should i use? Are there different ones?

4b) Can I add other sensor to the shield? (proximity, light, camera?)

5b) Can I automate the robot or something more powerful will be necessary?

6b) What about the battery? Can i use the same one?


Thanks to everyone read this and will try to help a newbie  :D

westfw

I found this, which is somewhat helpful: http://davidbuckley.net/DB/RoboNova/RoboNova_files/MR-C3024%20Spec%20English_Version%201.pdf
Also:  http://www.davidbuckley.net/DB/RoboNova/RoboNova_files/C3024.jpg

Yes, "Megacore" is the appropriate "board" package for the ATmega128L.
Yes, it supports only the chip itself (although it looks like the board doesn't have more than the chip itself, anyway.)

It looks like the serial port of the board is expecting "rs232" rather than "logic level uart", and it's using UART1 of the chip, rather than UART0.



Quote
-In case I use the actual board
1a) How can I get this thing to work?
Replace the pre-programmed (?) RoboBasic code with the Arduino bootloader.   This will involve some sort of ISP programmer, and finding the appropriate signals on your board.  There's no ISP connector, so you'll have to figure our which signals to connect where.  It looks like they all go to connectors, except for RESET which has a "test point" somewhere...  There is a 7.3xxx MHz USART1 bootloader in Megacore, so that's good.  But there's no auto-reset circuitry and no reset switch, which is a bit of a problem.   You'll need a USB/Serial cable that matches the circuitry on board (or you can connect to USART0, which is on a connector, using the adapter that you have.)

Sounds like a lot of effort.

Quote
I would like to use the Servo library to program this thing

2a) I read that maybe a couple changes to the servo library will be necessary, is this true?
Um.   Which servo library, exactly?  I don't know offhand whether which (if any) of the servo libraries supports the m128.


Quote
3a) how can i assign a serial to a servo (using the servo library) if numbers on my board are completely different than Arduino ones
Usually, you figure out which pins go where, and then use normal C++ constructs.

Code: [Select]
#define Servo1 12
#define Knee2 10
#define BUZZER PIN_PD5

(megacore defines all the PIN_Pxy values, which should help.)





Quote
-In case I switch to Arduino Uno + Servo Shield (maybe PCA9685)
I especially care to program in C++ and keep things simple, I'm a begginner after all, what I see online is that if people use a shield often if not always uses an adafruit-related code, that i find a bit frightening to begin with :/
"Arduino" is essentially C++.  Adafruit also does a lot with "CircuitPython", which is entirely different (and doesn't run on AVR controllers, anyway.


Quote
1b) If that's the only way of course i don't think it will be impossible but using the servo library is preferred, can I use it anyway?
I don't understand the question.  But I think we're back to "which servo library."  You can't use the python servo library in C++ or Arduino, for instance.

Quote
2b) I have my servos, i would have to break the cable to attach them to the shield or i can keep them as they are? (pins are matching or not or maybe?)
I don't know.  There are at least two mutually incompatible "standards" for the 3pin Servo connectors.


Quote
3b) Which shield should i use? Are there different ones?
Use one with lots of documentation.   In theory, you can drive servos directly from an Uno without any shield (but you won't have nice connectors.)

Quote
4b) Can I add other sensor to the shield? (proximity, light, camera?)
Maybe.  A camera is probably out of the question; arduinos are essentially too slow to do anything with pictures.

Quote
5b) Can I automate the robot or something more powerful will be necessary?
Servos can usually be driven easily without much "power" on the processor side.  If you're careful with the actual power connections (servos should connect directly to the batteries, rather than "through" the Arduino.)

Quote
6b) What about the battery? Can i use the same one?
That's questionable.  I think the original board you have runs at 3.3V, so it works fine with a 6V battery.  An Uno needs either >7V at the Vin/Barrel connector, or <5.5V directly into the +5V connection.   a 6V battery is thus "inconvenient."  (if it's a rechargeable battery 10+ years old, it's probably dead and unusable anyway.)

neilpare

For first thank you a lot for all the answers!

Quote
Replace the pre ... ... there's no auto-reset circuitry and no reset switch, which is a bit of a problem.   You'll need a USB/Serial cable that matches the circuitry on board (or you can connect to USART0, which is on a connector, using the adapter that you have.)

Sounds like a lot of effort.
Yes, it sounds like too much effort actually and well beyond what I'm capable of. This will be something I can do in the future when I'll learn more stuff, for now I would be happy just to achieve entry level stuff (starting with this robot it's not the best i imagine but also adds the right amount of challenge :) )


Quote
Um.   Which servo library, exactly?  I don't know offhand whether which (if any) of the servo libraries supports the m128.
I don't really know how to describe it. #include "Servo.h", i saw it is pretty intuitive and that's really it, don't know if it has limitations. In these days i searched a bit more and saw that some people use it also in combo with other libraries but the most used one is still this one: "Adafruit PWN Servo Driver Library" with the PCA8695.

About the servos in general and the compatibility with the board pins (PCA8695), I have these: (if this is somehow useful)




Quote
3b) Which shield should i use? Are there different ones?
The PCA8695 seems to be the one, although I'm confused by the code people show, there are a lot of ways of doing this i think but i hope the "Adafruit PWN Servo Driver Library" and "Wire.h" are enough (?)


Quote
That's questionable.  I think the original board you have runs at 3.3V, so it works fine with a 6V battery.  An Uno needs either >7V at the Vin/Barrel connector, or <5.5V directly into the +5V connection.   a 6V battery is thus "inconvenient."  (if it's a rechargeable battery 10+ years old, it's probably dead and unusable anyway.)
For what i saw on the Adafruit PCA8695 page a 6V battery should work fine (link: "4.8 or 6v Rechargeable RC battery packs from a hobby store.").

The link explains it better than me, i would like to test everything while connected to the Mac for now, so i would power the Arduino via USB and the PCA8695 + servos via the 6V battery (for as long as possible).

To make the thing run free a 5V battery for the Arduino and same battery for the servos as before (?)



Thanks again! Definetely will make the switch and forget about the old board at this point :D

Go Up