Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Quadruped controlled by quadruped

  1. #1
    Junior Member
    Join Date
    Sep 2019
    Posts
    7

    Quadruped controlled by quadruped

    I'm designing my first Teensy project of any complexity, and I would love to get feedback before I make any foreseeable mistakes. It's a quadruped robot controlled by a small imitation of itself: Robot has four legs with a hip and a knee attached to servos; controller has four legs with a hip and a knee attached to resistive position sensors. At the end of each leg will be a weapon motor, controlled by a corresponding switch. The goal is to build an antweight combat robot.

    Here's the controller schematic:

    Click image for larger version. 

Name:	quadruped-controller.png 
Views:	13 
Size:	41.4 KB 
ID:	17716

    The wires from the controller to the pots and switches will be about 10cm-30cm (4"-12") long.

    Here's the robot schematic:

    Click image for larger version. 

Name:	quadruped-actuator.png 
Views:	15 
Size:	47.5 KB 
ID:	17717

    The wires from the battery/controller to the servos and DC motors will be about 50cm-150cm (20"-60") long.

    I expect the DC weapon motors to be electrically noisy. They draw a fair amount of current for a tiny motor (18A at stall) and the brushes throw off lots of sparks. They're one of the models of 130-size motors used for Nerf gun modifications.

    Have I made any obvious mistakes in the schematic?

    Are there any subtle problems I might run into with these circuits?

    I'm a bit worried that the position sensors and the wires to them will pick up noise, causing jitter in the signal and corresponding jitter in the servo positioning. Should I be worried about that? If so, is there anything I can do about it?

    The voltage regulator on the robot is a switching regulator. If I need to add an external regulator to the controller, am I correct to assume that I should use a linear regulator instead of a switching regulator in order to get more consistent signals from the position sensors than a switching regulator would provide?

    Is the number of sensors and motors involved too much for a single Teensy? Should I divide the workload among a couple of MCUs?

    All thoughts and suggestions welcome, including advice on making the schematic more presentable. It's the first one I've made for public consumption, so I'm sure there are things that could be improved on in it from both an electronic and an aesthetic point of view.

    Thanks!

  2. #2
    Hi There,

    this is quite a general post, so I'll throw some general pointers.

    When you use a voltage/pot combo like this, any noise present on the power supply will make it's way through to the analog input. If this poses a problem, throw some decoupling capacitance on the inputs. 100nf is a go-to value, not that I've done any maths, but it's a good place to start. You also want capacitance, bascially everywhere. Every motor should have a decent one, and every chip. You can have too much capacitance, but this max value should be on the data sheet for whatever regualtors you use.

    PWM is pretty resistant to noise, so I wouldn't be concerned about the servos. Having enough noise to cause enough jitter to meaningfully present on the servo would be pretty crazy.

    Yes a switching regulator will add more noise to the system, but with some beefy brushed motors in the corner, switching noise is unlikely to be significant. I assume this is a battery powered robot, so you'll probably want the effiency of a switched regulator. One mistake in the schematic, you can't enable a regulator by a micro controller it's supplying. You probably want to either wire this to a switch or tie it permenantly on. Sending the power good signal to the micro is also a bit redundant, becuase if the micro is reading it, then the power must be good. Wire it to an LED would be my suggestion.

    A13 I dont think has digital capability.

    The teensy will be fine with this load, though that's more code-dependant than hardware.

    If you'd like to make the schemtic prettier, consider using labels instead of wires. The button is the black 'A' above a green line, or hotkey L. This makes the schematic easier to read, and makes following specific connections easier. You could either use sequential names Servo0, Servo1 ..., but I'd suggest "FrontRightKneeServo" "FrontRightAnkleServo". Add these names to the silkcreen if you print it.

    Ed

  3. #3
    Junior Member
    Join Date
    Sep 2019
    Posts
    7
    Quote Originally Posted by Edward View Post
    PWM is pretty resistant to noise, so I wouldn't be concerned about the servos. Having enough noise to cause enough jitter to meaningfully present on the servo would be pretty crazy.
    Thanks for all the suggestions! Hopefully in the next couple of weeks I'll be able to put together a new schematic incorporating them all.

    About my jitter concern: I'm mostly thinking about the controller side picking up noise in the pots, which then sends "go forth and jitter!" commands to the servos. However, I don't want to filter out small, fast changes in signal, because I want the controls to be as sensitive as I can get them. I.e. I don't want tiny signal changes resulting from noise to lead to servo movement, but I do want tiny signal changes resulting from tiny position sensor movements to lead to servo movement.

    This leads to a followup question: What are the tradeoffs in pot values for my position sensors?

    From what I've read so far, I'm guessing:
    - Higher resistance: More susceptible to noise, slower to charge up the ADC leading to slower sampling.
    - Lower resistance: Higher power consumption.

    Are there any other disadvantages of using lower resistance for my position sensors? Is there any other reason for me to go with a 10K or 100K position sensor instead of the 2.5K sensor?

    Thanks again.

  4. #4
    Oh, I see on the controller side, I'd understand being worried a bit about noise from the battery, but not elsewhere. I don't think I've ever seen enough noise on a teensy's ADC inputs to actually present a change in reading normally. I've got 20 pots lined up on a midi controller and I dont recall seeing anything. It's really unlikely to be a problem, and considering you can use bandwidth as low as 300Hz, go right ahead and filter if you're worried.

    Thinking about it, you'd need a bananas amount of noise to cause a problem. Enough to actually be picked up by the relatively low-resolution DAC is one thing, but enough to cause a change in the servo position would be huge. If I recall the servo library takes 0-180, and I've never used a servo that gave me 1-degree steps (or I've never used one properly!).

    You don't have a tradeoff so much as a pretty much anything will do situation. 2k5 is fine, if you want to go lower you can calculate the resulting resistance and figure out if it's sensible or not, or you can go higher. Pick the pot based on the 3D form that suits, or heck what you've got lying around!

    That's not quite how it (ADC sampling with a capacitor) works, read a smidge more or ask again on monday :P

  5. #5
    Junior Member
    Join Date
    Sep 2019
    Posts
    7
    Quote Originally Posted by Edward View Post
    Oh, I see on the controller side, I'd understand being worried a bit about noise from the battery, but not elsewhere. I don't think I've ever seen enough noise on a teensy's ADC inputs to actually present a change in reading normally. I've got 20 pots lined up on a midi controller and I dont recall seeing anything. It's really unlikely to be a problem, and considering you can use bandwidth as low as 300Hz, go right ahead and filter if you're worried.
    Good to know. The advice in your first reply about using capacitors to filter motor noise got me Googling and led me to this:

    http://hydraraptor.blogspot.com/2007...-daylight.html

    ...in which a single motor similar to the ones I'm planning to use put out enough noise to mess with I2C signals and his wife's digital TV downstairs. The noise he was dealing with was in the MHz range, though, and like you say I'll be sampling in the hundreds of Hz range. I'm now thinking that if anything I should be worried about the effect of motor noise on the remote control signal and maybe follow some advice like this:

    http://www.stefanv.com/rcstuff/qf200005.html

    Quote Originally Posted by Edward View Post
    Thinking about it, you'd need a bananas amount of noise to cause a problem. Enough to actually be picked up by the relatively low-resolution DAC is one thing, but enough to cause a change in the servo position would be huge. If I recall the servo library takes 0-180, and I've never used a servo that gave me 1-degree steps (or I've never used one properly!).

    You don't have a tradeoff so much as a pretty much anything will do situation. 2k5 is fine, if you want to go lower you can calculate the resulting resistance and figure out if it's sensible or not, or you can go higher. Pick the pot based on the 3D form that suits, or heck what you've got lying around!

    That's not quite how it (ADC sampling with a capacitor) works, read a smidge more or ask again on monday :P
    Aye, I definitely need to do more reading. Sometimes hard to fit in between full-time work, full-time fatherhood, and full-time laziness. My understanding so far is based on half-understanding comments like this one about charging time for an ADC's sampling capacitor:

    https://forum.arduino.cc/index.php?t...098#msg1259098

    Reading that comment again, I see that he's talking about delays of microseconds, which, like you say, is well below the threshold of anything I'll need to worry about.

    The controls I'm planning will require some awkward hand movements, so I'm mostly basing my pot choices on low torque. That has led me to the Bourns 3382 series and the Alps RDC50 series.

  6. #6
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,398
    Vin only accepts 3.6 to 5.5 V (there is NO additional LDO as with previous Teensies (3.2 - 3.6)
    So connecting 2S LIPO (on controller) is calling for problems (distruction?). Add external dc/dc convertor to generate acceptable Vin (as with actuator circuit).
    On dv24v22f3 you should check with chip id 3.3V on EN will enable the DC/DC converter.
    On other products it is typically said to connect EN or /SD to input voltage (could not find a schematic for this one)

  7. #7
    Junior Member
    Join Date
    Sep 2019
    Posts
    7
    Quote Originally Posted by WMXZ View Post
    Vin only accepts 3.6 to 5.5 V (there is NO additional LDO as with previous Teensies (3.2 - 3.6)
    So connecting 2S LIPO (on controller) is calling for problems (distruction?). Add external dc/dc convertor to generate acceptable Vin (as with actuator circuit).
    On dv24v22f3 you should check with chip id 3.3V on EN will enable the DC/DC converter.
    On other products it is typically said to connect EN or /SD to input voltage (could not find a schematic for this one)
    I did pick the Teensy 3.2 for specifically that reason, after asking this question about input voltages the other day. Might be a good idea to have an external regulator anyway, as you're suggesting.

    You're totally right about the EN pin, and I need to make that change.

  8. #8
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,398
    Quote Originally Posted by clawsoon View Post
    I did pick the Teensy 3.2
    UPS, I thought it is a T4.0. For a T3.2 6-7 V are OK. Only T4.0 is limited.

  9. #9
    Quote Originally Posted by clawsoon View Post
    Good to know. The advice in your first reply about using capacitors to filter motor noise got me Googling and led me to this:

    http://hydraraptor.blogspot.com/2007...-daylight.html

    ...in which a single motor similar to the ones I'm planning to use put out enough noise to mess with I2C signals and his wife's digital TV downstairs. The noise he was dealing with was in the MHz range, though, and like you say I'll be sampling in the hundreds of Hz range. I'm now thinking that if anything I should be worried about the effect of motor noise on the remote control signal and maybe follow some advice like this:

    http://www.stefanv.com/rcstuff/qf200005.html
    Those both seem like good resources. I'd start with the 3- capacitor method in the second link, becuase it wont hurt. Inductors can also help, but if you get the tuning wrong you can make some problems worse. If you've got an oscilliscope you can just go through the same steps as those articles have


    My understanding so far is based on half-understanding comments like this one about charging time for an ADC's sampling capacitor:

    https://forum.arduino.cc/index.php?t...098#msg1259098

    Reading that comment again, I see that he's talking about delays of microseconds, which, like you say, is well below the threshold of anything I'll need to worry about.
    A lot of ADCs use a capacitor to "sample" the voltage that is being read, there are other methods (I think). This stops problems that can be caused by a signal that changes by a singificant amount while being read. You can imagine a capacitor is connected to the circuit, then disconnected. When disconnected the capacitor retains the voltage, which can then be used for the conversion. If a very high impedance source is used, in the Megaohms range, this can cause the capacitor to not have charged up fully and hence the error of the reading can be increased. I wouldn't be certain that adding a delay in would help, as the length of time the capacitor is connected to the signal (I assume) is controlled by the ADC hardware and isn't varible/ easily varible by code. Particularly becuase there are multiple Analog pins that are multiplxed onto the ADC, you might be delaying while connected to the wrong pin. One could try just reading the same pin twice, the idea being the second time will be more accurate having had twice the time to charge; but I wouldn't be suprised if as part of the process the capacitor is discharged. While interesting, this is somewhat moot because your resistances are down in the KOhm range! If you do find you've got noise on the Analog inputs there's plenty of ways to fix this in code later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •