Show Posts
Pages: 1 2 3 [4] 5 6 ... 44
46  Using Arduino / General Electronics / Re: First attempt at home skillet reflow on: December 19, 2013, 11:01:28 am
Ok, thanks.  do you think a toaster oven is easier?  I figured the hot plate would be, so I could watch it real close with a magnifying glass to tell when the solder has melted.
47  Using Arduino / General Electronics / Re: First attempt at home skillet reflow on: December 18, 2013, 06:18:44 pm
Sorry about that.
48  Using Arduino / General Electronics / First attempt at home skillet reflow on: December 18, 2013, 11:34:11 am
I made this PCB with all SMD components. After hand soldering one, I'm tempted to try a frying pan skillet to reflow one. I've seen numerous articles and YouTube videos and it looks fairly simple. One question of concern is the big   VNH2SP30  chip. It has pads on the bottom, I normally soldered them by hand through holes in the PCB. If I use a skillet reflow technique should I still plan on soldering them by hand?  Or will they solder by themselves without doing anything from the under side. I guess my question is: to have enough heat to solder their bottom pads, will that be more heat than other components on the board can take? Like the atmega328 or the 0603 cap & resistors?
Thanks.
It'll include a photo of my board, and also the IC I'm wondering about.
49  Using Arduino / Motors, Mechanics, and Power / 5 to 8 amp DC brushed motor chip (H-bridge?) on: December 17, 2013, 03:29:23 pm
I'm looking for a PTH motor driver chip that's PTH.  It's for one 12 volt motor that need PWM, reversible.  I've been using the VNH2SP30 IC, but it's a bit of over kill, and I'd like to switch to a PTH version, but after an hour of searching have come up blank.  Anyone have any recommendations that they've used?
It's controlled by an Atmega328, so it need 5V logic. No feedback/sensing is needed.
thanks.
50  Using Arduino / Programming Questions / Re: how to check a live time span for change on: October 31, 2013, 11:30:56 pm
I've gotten something to work!
Code:
boolean CheckPosNeg(int Val) {
//return false;
  const int ControlState = -2;
  if (Val == ControlState) return false; //when it's 0, it can be ignored
  int timeRange = 2000; //within this time range
  const int changeCount = 3; //number of changes to trigger flag
  static int lastVal; //the last value passed
  static int countArray(changeCount); //I need to keep track of this many changes
  static unsigned long timeArray[changeCount + 1];//this will hold a time stamp for each change {1,2,3}
        //Serial.println(Val);

  if (Val > ControlState) {
    if(lastVal < ControlState) { //a change
      for (int i=changeCount; i > 0; i--){
        timeArray[i] = timeArray[i-1]; //move all the value up the line
      }
      timeArray[0] = millis(); //put the current one at the beginning
      lastVal = Val; //update the lastVal
      //now see if it's been longer than [timeRange] for the least recent timestamp
      //Serial.println(timeArray[changeCount]);
      if (millis() - timeArray[changeCount] < timeRange) {
        Serial.println("Oscilate!");
        return true; //send up red sparks!
      }
      else return false; //all is well
    }
  }
  lastVal = Val;
 return false;
}
51  Using Arduino / Programming Questions / Re: how to check a live time span for change on: October 31, 2013, 09:07:24 pm
Thanks.  I think I got a loop set up.  But I don't think it's working, but I must be close.

Code:
boolean CheckPosNeg(int Val) {

  if (Val == 0) return false; //when it's 0, it can be ignored
  int timeRange = 1000; //within this time range
  const int changeCount = 3; //number of changes to trigger flag
  static unsigned long lastVal; //the last value passed
  static int countArray(changeCount); //I need to keep track of this many changes
  static unsigned long timeArray[changeCount + 1];//this will hold a time stamp for each change {1,2,3}
  if (Val > 0 && lastVal < 0) { //a change
    for (int i=changeCount; i > 0; i--){
      timeArray[i] = timeArray[i-1]; //move all the value up the line
    }
    timeArray[0] = millis();
    lastVal = Val;
    //now see if it's been longer than [timeRange] for the least recent timestamp
    if (millis() - timeArray[changeCount] > timeRange) {
      return true; //send up red sparks!
    }
    else return false; //all is well
  }
}
52  Using Arduino / Programming Questions / Re: how to check a live time span for change on: October 31, 2013, 05:48:38 pm
This is what I've got so far.  Is it a good way to start?
Code:
boolean CheckPosNeg(int Val) {
 
  if (Val == 0) return false; //when it's 0, it can be ignored
  int timeRange = 1000; //within this time range
  int changeCount = 3; //number of changes to trigger flag
  static int lastVal; //the last value passed
  static int countArray(changeCount); //I need to keep track of this many changes
  static unsigned long timeArray(changeCount);//this will hold a time stamp for each change
  if (Val > 0 && lastVal < 0) { //a change
      …UGH!
  }
}
53  Using Arduino / Programming Questions / Re: how to check a live time span for change on: October 31, 2013, 05:05:21 pm
Define an array that contains time stamp values.  Every time the signal changes (NEG to POS) save the current time in the array, and check whether there have been the required number of changes in the given time span.
This sounds like what I am envisioning, but I'm afraid it's over my head.  I worked on it an hour, and was more confused than when I started.  I'll give it another go another day.

Also, the input value it a constrained reading of an IMU.  -30 to +30 are it's limits
54  Using Arduino / Programming Questions / how to check a live time span for change on: October 31, 2013, 03:51:19 pm
I hardly know how to describe what I'm needing, and maybe there's some examples already, but I haven't found any.
This code kinda shows what I need to do.  I don't know how else to word it.  The commented out part tells what I need, but I'm at a loss.
 
Code:
boolean CheckPosNeg(int Val) {
  timeRange = 1000; //within this time range
  changeCount = 3; //number of changes to trigger flag
  //if Val has changed from NEG to POS more than {changeCount}
  //times in the past {timeRange} return TRUE
}
thanks!
55  Using Arduino / Motors, Mechanics, and Power / Re: Putting my Segbot into standby mode on: October 29, 2013, 02:22:04 pm
For motorVal, I meant motor_speed.

Yes, I've figured out that the two lines mentioned will be the result of which state the machine is in.
If in standby mode:
Code:
  motor_speed = map(pitch, -maxPitch, maxPitch, -standbySpeed, standbySpeed); //standby mode
And if it's in riding mode:
Code:
  motor_speed = map(pitch, -maxPitch, maxPitch, -maxSpeed, maxSpeed); // map the angle to the sabertooth controller range 1-64 

But the logic of keeping up with when the last time motor_speed went negative, if it does it more often than once per second.  This is what I need help with.
56  Using Arduino / Motors, Mechanics, and Power / Putting my Segbot into standby mode on: October 29, 2013, 11:47:40 am
project: Segbot; using a MPU-6050 IMU, Atmega328P-AU, and a SAbertooth 2x25 controller
It's working great!  However, when no one is on it, it will self balance okay in a perfect environment, but just a little bump will start it oscillating.  The motor speed maxes out at 100% at about 30 degrees tilt, which is just about perfect for riding.  With no load (person), and I set the motor speed to be 50% at 30 degrees, it sets by itself very nicely, and can not be made to oscillate.
So I need to detect when it is not being ridden, and change the motor mapping to standbyMapping, rather than RidingMapping.
What sounds like a workable solution is this: If the motorVal goes Negative (reverse) more than once a second, put it in StandbyMode.  Longer than 1 second since the last Negative value, go back to ridingMode.  It sounds easy, but I'm struggling with it.  It's more than just reading a negative value, but reading a "change to negative from positive".   Any help would be greatly appreciated.
See lines 11 & 12 of my motor code here.  I need to do one or the other, depending on standby mode or riding mode:
Code:
void update_motor(){  // Update the motors
  static unsigned long prevTime;
  int motor1, motor2;
  if (millis() - prevTime < 30) return; //only do this every 30 ms
  prevTime = millis(); //update the time stamp
  maxPitch = 1500; //value from the MPU-6050, this makes 30 degrees the max tilt for 100% speed
  maxSpeed = 64;
  standbySpeed = 32;
  if (pitch < -3000) crash(); //we probably crashed
  if (pitch > 3000) crash(); //we probably crashed
  motor_speed = map(pitch, -maxPitch, maxPitch, -standbySpeed, standbySpeed); //standby mode
  motor_speed = map(pitch, -maxPitch, maxPitch, -maxSpeed, maxSpeed); // map the angle to the sabertooth controller range 1-64 
  if (motor_speed > 64) motor_speed = 64; //that's the maximum speed

  if (motor_speed > 0)  motor_speed = fscale( 1, 64, 1, 64, motor_speed, -1.4); //scale it to change slightly at low numbers
  if (motor_speed < 0)  motor_speed = fscale( -64,-1, -64,-1,motor_speed, 2); //scale it to change slightly at low numbers
  motor1 = motor_speed + get_Steering();  //add steering bias to motor 1
  motor2 = motor_speed - get_Steering();  //add steering bias to motor 2
  // assign final motor output values
  motor1 = 65 + motor1;                //64 is neutral for motor 1
  motor2 = 192 + motor2;               //192 is neutral for motor 2
  motor1 = constrain(motor1, 1, 127);  //constrain the value to it's min/max
  motor2 = constrain(motor2, 128, 255);//constrain the value to it's min/max
  if (!debugMode) Segway.write(motor1); //Send motor 1 speed over serial
  delay(1);  //sabertooth can only receive commands at 2000/second
  if (!debugMode) Segway.write(motor2);  //Send motor 2 speed over serial
   if (!debugMode) {
      Serial.print("Pitch: ");
      Serial.print(pitch);
      Serial.print("\tMotorSpeed1: ");
      Serial.print(motor1);
      Serial.print("\tMotorSpeed2: ");
      Serial.println(motor2);
    }
}
57  Using Arduino / Programming Questions / Re: syntax for fscale code on: September 19, 2013, 07:54:37 pm
I think I got it: 
Code:
  if (motor_speed < 0)  motor_speed = fscale( -1, -64, -1, -64, motor_speed, -1.5);
This doesn't fit the rules:
originalMin - the minimum value of the original range - this MUST be less than origninalMax
 originalMax - the maximum value of the original range - this MUST be greater than orginalMin
 
-1 isn't lower than -64
58  Using Arduino / Programming Questions / Re: syntax for fscale code on: September 19, 2013, 07:17:08 pm
-1 to -64 is the reverse speed...
59  Using Arduino / Programming Questions / syntax for fscale code on: September 19, 2013, 05:51:57 pm
In reference to this code that changes the curve or scale of numbers:
http://playground.arduino.cc/main/fscale

I have this code that give my the desired curve on a reading that is from 1 to 64, but I can't figure out how to get the same result for the values -1 to -64
Code:
  if (motor_speed > 0)  motor_speed = fscale( 1, 64, 1, 64, motor_speed, -1.5);

I thought this would do it, but all it gives me is zeros:
Code:
  if (motor_speed < 0)  motor_speed = fscale( -1, -64, -1, -64, motor_speed, -1.5);
60  Using Arduino / Motors, Mechanics, and Power / Changing to an OLED on: July 08, 2013, 09:53:28 pm
Well, DC42, after getting my first version board back from the fab house, I discovered a few design mistakes, so I'm going to redo it.  I couldn't get the LCD to work, but I'm pretty sure it was something more to do with the LCD, rather than the schematic.  The LCD was this tiny one like the one pictured with a FCP connector, and I'd never used one like it before.  I've recently learned about these little OLED displays like adafruit sells, and want to switch to them on my next attempt at a board. (see link).  The OLED display uses very little current, so I'm guessing I can control it's power directly from a digital pin?
Quote
The power requirements depend a little on how much of the display is lit but on average the display uses about 20mA from the 3.3V supply
  Seems I read somewhere else that with all the pixels lit one used 50ma.  I'll just be using it for text, not graphics, so I won't have anywhere near all the pixels used.
It may be a little while before I resume this project, I'll be gone a few weeks, but here a picture of the schematic I'm guessing will work for powering up/down the OLED from the Atmega328's D4 pin.  Would the I2C pull-ups get connected to D4 as well?
http://learn.adafruit.com/monochrome-oled-breakouts/overview

Thanks for taking a look at this.
Pages: 1 2 3 [4] 5 6 ... 44