Show Posts
|
|
Pages: 1 ... 3 4 [5] 6 7 ... 420
|
|
61
|
Using Arduino / Project Guidance / Re: Modifying servo speed w/ pot??
|
on: May 14, 2013, 04:50:05 pm
|
Is this possible?
Certainly. When you say "360 degree servo" I assume you mean a continuous rotation servo i.e. variable speed motor/gearbox assembly. (There are conventional positional servos that provide travel of 360 degrees or more - obviously, if this is what you have then the behaviour will be quite different.) With a continuous rotation servo you have direct control over the speed, and it would be easy to have this determined by a potentiometer input. If you need to be able to bring the servo to a complete stop, you might need to implement a 'dead band' so that you have to move the pot a small distance away from the nominal 'stop' position before the servo starts moving - otherwise, it might be very difficult to find the right position to stop it.
|
|
|
|
|
63
|
Using Arduino / Project Guidance / Re: Automotive Compression Tester
|
on: May 14, 2013, 09:10:57 am
|
|
In that case I suggest stepping back from the problem - apply a known constant voltage to the analog pin and see whether the analogRead returns the expected corresponding value. From what you've found so far, it probably doesn't.
The ADC conversion is done relative to an analog reference voltage. If your calculations are based on the assumption that an input of 1023 corresponds to exactly 5.000 Volts, and the analog reference voltage is something different, then your calculations would be inaccurate. For example, if the supply voltage on the Arduino was below 5V then the reference voltage would also be lower, which would cause the ADC to return higher values.
You need to ensure that the AREF voltage is stable, and not less than the highest voltage you need to measure. If the problem is that the 5V voltage is varying and causing the AREF voltage to vary, then you fundamentally have to address that. If the AREF is stable but not exactly 5V then you could either change the AREF voltage to the required value, or update your calculations based on what the reference voltage actually is.
|
|
|
|
|
65
|
Using Arduino / Programming Questions / Re: Very Complicated Debugging of a 12 Servo Biped
|
on: May 14, 2013, 08:50:10 am
|
Is there a cleaner way to add this, it is called every time Fractiondone is increased, once per loop
At the moment your code is all blocking. Given the complexity of the movements you're trying to create, I think a non-blocking structure would work better. Instead of: for (FractionDone = 0; FractionDone <= 1; FractionDone = FractionDone + FracStep) { // move servos ... delay(1000); }
use the approach demonstrated in the 'blink without delay sketch to determine whether it's time to move either leg, and then move it. This would make it far easier for you to control the speed and timing of each leg movement. You're asking specifically about how to incorporate a weight shift into the walking sequence. It's not clear from the code what mechanism you use to control weight shifting. Do you control it via hips or ankles, or just by controlling the length of each leg and letting the grounded foot roll sideways? If it's initiated explicitly by moving hips/ankles then you'd need to have a sequence of movements sycnronised with the leg movement. If it's done by having the whole biped rock sideways then I guess you need to recalculate the arc that each foot moves through while it's on the ground so that the effective length of the leg varies cyclically during the stride so that the leg effectively shortens when you want the biped to fall towards that side, and lengthens when you want to push it away. The resulting sideways movement would cause weight transfer.
|
|
|
|
|
66
|
Using Arduino / Programming Questions / Re: Thanks for proposals
|
on: May 14, 2013, 07:45:33 am
|
What is the "official" way to clear / reset such an array (= get rid of any previous content like I currently do with sPropertyBuffer = "") with let's say 8 characters ?
Just write a null (zero) to the first character in the array. If you are adding to the string one character at a time you might also be using a variable recording the current length of the string - in that case, you would need to zero the length variable as well.
|
|
|
|
|
68
|
Using Arduino / Project Guidance / Re: Audio sampling from music playing over iTunes?
|
on: May 14, 2013, 07:36:56 am
|
|
The USB connection provides a duplex serial connection, so the Arduino can send messages to an application on the PC and vice versa. I think the simplest way to achieve what you're looking for is to write a PC application which reads the audi stream being played on the PC, uses whatever algorithm you like to convert that to a stream of 0 .. 255 brightness values, and writes those values to the Arduino's serial port. On the Arduino side you would have a trivial sketch which reads bytes from the serial port as they arrive, and sends the corresponding PWM output to drive an LED at the specified brightness.
Chooise a suitably high speed for the serial port, and make sure your PC application sends brightness change messages slower than the maximum speed of the serial connection - this will ensure that the transmit buffers don't back up, which would introduce a lot of latency on the communication.
|
|
|
|
|
73
|
Using Arduino / Programming Questions / Re: Very Complicated Debugging of a 12 Servo Biped
|
on: May 13, 2013, 07:47:13 pm
|
What I need to know how to do is how to move servos while a for loop is running. It can't interrupt the movement, but it should have the ability to interrupt movement if I need it to.
You need to have some algorithm for determining the required position and speed of each servo. That might be a hard-coded timed sequence of actions if the biped is inherently stable when walking, or it might be via a feedback loop monitoring its state of balance. For timed movements, you have a piece of code that runs repeatedly for each servo which calculates the required position for that servo at that time, and if it is not the same as the current position it moves the servo to the required position. You simply call this repeatedly for all servos fast enough to produce movements as smooth as you require. I imagine that the code to calculate the required position and speed will also be controlled by some code that controls the gait i.e. decides when the left leg needs to swing forward, when it needs to stop, when it needs to straighten the leg to contact the ground, and so on. This gait management code would also run repeatedly and determine where the biped was in the walking cycle and whether it was necessary to advance to the next part of the walking cycle. (This is also where I'd expect to see weight transfer initiated.)
|
|
|
|
|
74
|
Using Arduino / Programming Questions / Re: Serial loop randomly stops
|
on: May 13, 2013, 07:38:30 pm
|
If I understand the code right, My Python script will send 64 bytes, and wait for the Arduino. The Arduino shouldn't send another NEXT until it is out of serial buffer data. The Python script shouldn't send 64 more bytes until the Arduino processes everything it sent before. The RX/TX lights on my ftdi breakout are alternating as I'd expect.
The flow control in this example still seems to assume the serial input arrives fast enough to prevent the sketch seeing an empty receive buffer, until all 64 bytes have been received. That doesn't seem like a safe assumption to me. Does this minimal sketch demonstrate the problem?
|
|
|
|
|