| Arduino Forum ::  Members :: sbright33
 Show Posts Pages: 1 ... 25 26 [27] 28 29 ... 92
 391 Using Arduino / Project Guidance / Re: Battery Pack, individual cell voltage measurement on: December 01, 2012, 11:13:59 am If your goal is to maintain the battery's health, I think 0.04 is enough precision.  Accuracy requires calibration.  You will be lucky to get 0.04 anyway even with 0.01 precision.  Do you understand my solution?  No switching is needed within each bank.
 392 Using Arduino / Project Guidance / Re: Battery Pack, individual cell voltage measurement on: November 30, 2012, 10:48:11 pm Let's say you need to measure within 0.08v.  Then make 2 banks of 20.  Put Gnd at one end and measure the total voltage of each point along the way using a simple voltage divider.  20*4v/1024 is about 0.08v.  In this case you need 1k and 15k resistors x45, cheap.  With a Mega there are nearly 20 analog inputs, but darn only 16.  Let's say you need to measure within 0.04v.  Then make 4 banks of 12.  Put Gnd at one end and measure the total voltage of each point along the way using a simple voltage divider.  12*4v/1024 is about 0.05v.  In this case you need 1k and 9k resistors x45, cheap.  With a Mega there are >12 analog inputs, so no switching is needed!
 393 Using Arduino / Project Guidance / Re: What to do with weird IC on: November 30, 2012, 10:29:23 pm First you obtain an IC, then you try to think of a use for it?  I like the way you think!
 394 Using Arduino / Project Guidance / Re: Arduino two way communication (walkie talkie) on: November 30, 2012, 10:28:22 pm Reading from a Mic and writing back to a speaker is the easy part.  All you have to do is figure out how to move the data from one Uno to another greater than 10Kb/sec if you want it to sound good.  This can be done using the serial port if the cable is not too long.  A small buffer should do if there are no transmission errors.  I have done it using XBee or Wifly.
 395 Community / Exhibition / Gallery / Re: 28BYJ-48 Stepper motor code on: November 30, 2012, 07:13:04 pm You do not have to read the torque pin yourself unless you want to.  My function ccwss() measures torque and halts program if spike to prevent damage.  Look in that function for example code to see how you could read it to print a warning instead of halting.  But you do have to wire it up.  Just hook any motor winding to analog pin 0.  If you're worried about damage use a resistor like 1k.  Pin 0 does not give you any absolute data, only relative.  After it has been running the code stores the normal value at the normal load.  Anything abnormal will cause the program to halt.  It detects increased torque as well as zero torque if a linkage were to break.  The current the motor consumes is a constant amperage with a given voltage supply.  You can measure this with an ammeter and store it as a constant as it will not change much, even when not moving.  Use the function off() to save power and keep the motor cool when not moving.
 396 Community / Exhibition / Gallery / Re: 28BYJ-48 Stepper motor code on: November 30, 2012, 07:05:33 pm Non-blocking.  No delay().  More than one motor.  Run other tasks at the same time in Loop()The library is setup to run other code in loop while spinning the motor non-blocking without using interrupts.  First initialize the move you want to make 1x.  This could be done in setup or an if statement in loop for example:void degrpm_nowait (boolean bcw, long deg100, int rpm100)Then call this function often:int calloften_micro (boolean bcw)At faster speeds you have to call it more often or it will get behind and run slower.  You can look at d in loop to see how much time you have in micros.  There are lines to uncomment if you want it to be more smooth consistent and partly blocking, some of the time.  The calloften functions use little integer math so they are fast.There is another pair of functions for going slower and cooler using 12v:void degrpmslowCool4_nowait (boolean bcw, long deg100, int rph100)int calloften()With these functions you have much more free time to process in loop, d milliseconds.  If you miss a step it's no big deal, the motor will catch up to keep the speed mostly constant.  It will move the correct distance no matter what you do wrong with timing.All you have to do is choose the RPM and *100.
 397 Community / Exhibition / Gallery / 28BYJ-48 Stepper motor code on: November 30, 2012, 06:52:49 pm Will update it here when I get feedback or feature requests:https://gist.github.com/4178431Here's some help to get you started:http://arduino.cc/forum/index.php/topic,89159.0Here is a brief summary of the code.It can spin a full size DSLR on it's shaft without bearings at 30RPM! Ramping up and slowing down to prevent bouncing.It can measure torque to detect an abnormal load or error.It works without blocking or waiting or interrupts.Enhanced performance using 12v without warming up the motor.And much more!Sounds like an advert, but it's all for Free.Hardware is \$4.Variables:bcw 1 is clockwise 0 is ccwdeg100 9000 is 90 degrpm100 1000 is 10 rpm, 100 is sec handrph100 hour 100 is like minute hand on clockpercslow 10 is 10% slow at end of movesteppos 90.0*STEPERDEG is 90 degsteps samexinrev 0,2,3,4,8x in 360 degrevo # revolutionsconst float STEPERDEG=float(64)*64/360;These are ordered just like in the code:void unramp (boolean bcw, long deg100, int rpm100, int percslow)void unramp1 fastervoid moveto (int steppos)void movetodir (boolean bcw, int steppos)void midspeedcool_12v (boolean bcw, long steps)void ramp (boolean bcw, int rpm100)void revRestart (boolean bcw, long revo, int rpm100, int xinrev)void rev (boolean bcw, long revo)void degrpmslowCool4 (boolean bcw, long deg100, int rph100)void degrpmslowCool4_nowaitint calloften()void degrpm_nowait (boolean bcw, long deg100, int rpm100)int calloften_micro (boolean bcw)void degrpmslowCool (boolean bcw, long deg100, int rph100)void degrpmslowHotvoid degrpmslow2void degrpmEZ (boolean bcw, long deg100, int rpm100)void degrpmvoid degrpm8void move (boolean bcw)1 line description for each function above:unramp stops bounce at end of moveunramp1 fasterabsolute position in degrees shortest directionabsolute choose direction12v only 1/2 speedspeed up over 90 degrestarts x in 360 revobsolete?most efficient mAhslow no waitfast no waitlook at d in loopcool 4 stephot 4 stepmid 4 step8 step 5 lines simple fast ramp, measure torque8 step 5 lines +err 2.00deg move delay(10)microstep speed limit 17RPMrelative move 1 stepccwss() measures torque and halts program if spike to prevent damagejust hook motor winding to analog pin 0
 398 Using Arduino / Motors, Mechanics, and Power / Re: New 28BYJ-48 library on: November 30, 2012, 06:23:01 pm I posted my new library on Gist.  Here is the related posting:http://arduino.cc/forum/index.php/topic,85335.0.html
 399 Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: November 30, 2012, 06:20:28 pm Last summer I got a new Stepper motor!  It's big and does 1 degree / step.  It's faster 300RPM because there are no gears like the 28BYJ.  I wrote more code to do PWM to make it smoother at slow speeds.  It has no gears so you can't just turn off the power when you stop.  When stepping slowly you need to keep the coils on, at least at a lower voltage.  If you use 12v it will overheat within minutes.  It's all here, view at your own risk?  The 2nd file is smaller and much easier to understand first.https://gist.github.com/4179366
 400 Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: November 30, 2012, 04:16:16 pm Here's a demonstration of related code I've been working on.  It allows the same script format to control both a stepper and servo simultaneously and independently.  The script allows you to do motion easing and mechanical animation with Arduino and cheap servos/steppers.  It's a work in progress.  https://gist.github.com/4178630
 401 Using Arduino / Motors, Mechanics, and Power / Re: 28BYJ-48 5-Volt Stepper on: November 30, 2012, 03:46:00 pm Here it is at last!  With new features.  Will update Gist from now on.https://gist.github.com/4178431Please...Questions?  Comments?  Requests for new features?  Improvements?Thanks for looking at my code!SteveAs a learning exercise or tutorial feel free to check out the older version, which is now obsolete.https://gist.github.com/4149982
 402 Using Arduino / Project Guidance / Re: Quadcopter stabilization algorithm on: November 30, 2012, 12:48:18 pm Here's how simple it can be using all 3 P,I,D:loop  error = setpoint - measured_value  integral = integral + error*dt  derivative = (error - previous_error)/dt  output = Kp*error + Ki*integral + Kd*derivative  delay(dt)While experimenting you can assign dt,gain to the value of R/C channel 5,6.Let's start by controlling altitude only using the throttle channel, P term only:void loop()ft=get_altitude();set_throttle((wasft-ft)*gain+wasthrottle);  //gain is Kpwasft=ft;delay(dt);A few more lines gives us I term:const int NZEROSLOW=3;const int NZEROSTOP=15;ft=get_altitude();chg=wasft-ft;if last is in correct direction toward setpoint and j-lastj > NZEROSLOW then chg=0;set_throttle(chg*gain+wasthrottle);if chg then   last=chg;   lastj=j';j++;delay(dt);It's not perfect, oversimplified a bit to make it easier to understand.Another improvement in case it's moving too slow, not near the setpoint:if ft-setpoint > 10ft and j-lastj > NZEROSTOP then chg= toward setpoint;You can use the same method for pitch, roll, yaw using magnetic compass and GPS to correct towards setpoint.Simple?  Questions?  Improvement?  It works!PS- Oh great library BTW!  It's not needed for my solution here.
 403 Using Arduino / Project Guidance / Re: Quadcopter stabilization algorithm on: November 29, 2012, 05:30:21 pm I see where I have misled you.  I am already using the KK board to control pitch and roll.  It is only \$12.  KK v2.0 includes accelerometers to keep it level.  I agree with your statement.  I assert that P and I are all that is needed.  Each is only a few lines of code combined with my existing assembly code in the KK board.  The job of the KK board is to keep it stable in pitch, roll, and yaw.  It does nothing for altitude.  My code will keep the yaw from drifting using a magnetic compass.  It will keep the altitude constant when you enable it.  It will keep it in one position using GPS on top of the KK v2.0 leveling which does not take into account wind.  In the end I may decide to modify the assembly code on KK, but for now I'm going to intercept the PWM between the receiver and KK, and modify it with a few short lines of C.  One step at a time.  Let's start with the altitude.  Standby.  I'm going to rip out the important part from my testing code.  It's a work in progress.
 404 Using Arduino / Project Guidance / Re: Quadcopter stabilization algorithm on: November 29, 2012, 10:34:23 am I have a real simple solution I'm working on.  Will post some uncompiled pseudocode here later today if you'd like.  PID algorithms in the manufacturing process can be quite complex.  I believe this problem is simpler to solve.
 405 Using Arduino / Project Guidance / Re: Getting 640x480 images from camera modules at 1FPS on: November 29, 2012, 10:31:23 am You're assuming he can place the PC near the camera.  I don't see where he said that.  Instead maybe he can buy one of those cameras that stores the picture on SD card every 1 seconds, like the hunter camera I have.
 Pages: 1 ... 25 26 [27] 28 29 ... 92