Show Posts
Pages: 1 [2]
16  Using Arduino / Project Guidance / Re: analog input alters voltage... doesn't read properly on: April 28, 2013, 01:26:34 pm
You haven't said how you are generating the gear change voltages.

How are you measuring the voltages without the Arduino? Perhaps you are using a digital multimeter which has a very high impedance - several megaOhms. The Arduino's ADC input pins have an impedance of about 10k ohms. This may affect things.

...R


You sir deserve a gold star smiley

I think this is what is going wrong... i was just triple checking my voltage readings- with my multimeter when it occurred to me- maybe the readings on the meter are different from what the arudino sees.

This said- what should i do about it? Perhaps I need to add a resistor or 3 ? Or am I misunderstanding this again...

I might try and set this up on my laptop- all next to the bike, then I could get the readings FROM the arduino- via serial... and know for sure what it is getting.


17  Using Arduino / Project Guidance / Re: analog input alters voltage... doesn't read properly on: April 28, 2013, 12:35:59 pm
Altered it a bit this morning- grounding directly to the GPS sensor now- its like  .1 volt difference vs grounding to the frame or the neg. battery terminal.

Regardless- all my readings w/o the Arduino A0 pin attached- look right-... as soon as i plug the arduino in though the numbers go all over the place... doesn't make ssense.
18  Using Arduino / Project Guidance / Re: analog input alters voltage... doesn't read properly on: April 28, 2013, 10:37:45 am
Ha- fits well on a 27" 1440p monitor... sorry my bad. -- updated OP image.

So perhaps I need to use the ground line from the GPS... I thought it would be the same thing as the ground on the rest of the bike, I mean it IS running to the common ground on the rest of the bike AFAIK.
19  Using Arduino / Project Guidance / analog input alters voltage... doesn't read properly on: April 27, 2013, 07:28:21 pm
So hopefully this schematic will explain what i'm doing well enough.

The problem i am having is that my A0 (and all other input pins) are somehow breaking my reading- w/o the arduino hooked up I read specific ranges for each gear (check the schematic) - but as soon as I connect the A0 pin to the wire it should *read* voltage from- it locks up on 3.98 volts- and doesn't budge.

Why would this happen?

Schematic:




All of my so-so code:

Code:
 const int bottomLeft = 3;
  const int bottom = 6;
  const int bottomRight = 2;
  
  const int topRight = 7;  
  const int top = 1;  
  const int topLeft = 4;

  const int middle = 5;


void setup() {
  
  pinMode(bottomLeft, OUTPUT);
  pinMode(bottom, OUTPUT);
  pinMode(bottomRight, OUTPUT);
  
  pinMode(topRight, OUTPUT);
  pinMode(top, OUTPUT);  
  pinMode(topLeft, OUTPUT);

  pinMode(middle, OUTPUT);

  pinMode(A0, INPUT);
  
  //debug
  //Serial.begin(9600);
}


int incomingByte = 0;
int prevByte = 2;
int currentByte = 0;
int testing = 0;

void loop() {
  if (testing == 1){
    test();
    //digitalWrite(6,HIGH); // test individual segments    
  }else{
  int raw = 0;
  float val = 0;
  float avgVal = 0;
  
  for (int i=0; i <= 99; i++){
      raw = analogRead(A0); //  read 0-5 volts from the GPS
      val = fmap(raw, 0, 1023, 0.0, 5.0); // volts are 10 bit (0-1023) so map it back to a proper volt number
      avgVal = avgVal+val;
  }
 
  //Serial.println(avgVal/100); //voltage
  
  //1st: 1.36V
  //2nd: 1.77V
  //3rd: 2.49V
  //4th: 3.23V
  //5th: 4.1V
  //6th: 4.55V
  //N: 5V
  
if (avgVal <= 4.24){
  reset();
  first();
}

if (avgVal >= 4.25 && avgVal <= 4.31){
  second();
}

if (avgVal >= 4.32 && avgVal <= 4.40){
  third();
}

if (avgVal >= 4.41 && avgVal <= 4.56){
  fourth();
}

if (avgVal >= 4.57 && avgVal <= 4.72){
  fifth();
}

if (avgVal >= 4.73 && avgVal <= 4.89){
  sixth();
}

if (avgVal >= 4.90){
  neutral();
}
    
    

  
  delay(1);
    }
}

void reset(){  
  digitalWrite(bottomRight,HIGH);  
  digitalWrite(bottom,HIGH);
  digitalWrite(bottomLeft,HIGH);
  
  digitalWrite(topRight,HIGH);
  digitalWrite(top,HIGH);  
  digitalWrite(topLeft,HIGH);

  digitalWrite(middle,HIGH);
}


void first(){
  reset();
  digitalWrite(topRight,LOW);
  digitalWrite(bottomRight,LOW);
}

void second(){
  reset();
  digitalWrite(top,LOW);
  digitalWrite(topRight,LOW);
  digitalWrite(middle,LOW);
  digitalWrite(bottomLeft,LOW);
  digitalWrite(bottom,LOW);
}
void third(){
  reset();
  digitalWrite(top,LOW);
  digitalWrite(topRight,LOW);
  digitalWrite(middle,LOW);
  digitalWrite(bottomRight,LOW);
  digitalWrite(bottom,LOW);
}
void fourth(){
  reset();
  digitalWrite(topLeft,LOW);
  digitalWrite(middle,LOW);
  digitalWrite(topRight ,LOW);
  digitalWrite(bottomRight,LOW);
}
void fifth(){
  reset();
  digitalWrite(top,LOW);
  digitalWrite(topLeft,LOW);  
  digitalWrite(middle,LOW);
  digitalWrite(bottomRight,LOW);
  digitalWrite(bottom,LOW);
}
void sixth(){
  reset();
  digitalWrite(top,LOW);
  digitalWrite(topLeft,LOW);
  digitalWrite(bottomLeft,LOW);
  digitalWrite(bottom,LOW);
  digitalWrite(bottomRight,LOW);
  digitalWrite(middle,LOW);
}
//animated neutral "spins"
void neutral(){  
  digitalWrite(bottomLeft,LOW);
  delay(100);
  reset();
  digitalWrite(bottom,LOW);
  delay(100);
  reset();
  digitalWrite(bottomRight,LOW);
  delay(100);
  reset();
  digitalWrite(topRight,LOW);
  delay(100);
  reset();
  digitalWrite(top,LOW);
  delay(100);
  reset();
  digitalWrite(topLeft,LOW);
  delay(100);
  reset();  
}

void test(){
  
  
  first();
  delay(1000);
  
  second();
  delay(1000);
  
  third();
  delay(1000);
  
  fourth();
  delay(1000);
  
  fifth();
  delay(1000);
  
  sixth();
  delay(1000);
}

//Mapping function, used to convert 0-1023 to 0-5 volts
float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
20  Using Arduino / Project Guidance / Re: 12-14v from motorcycle... @ Vin on: April 20, 2013, 10:30:20 am
As I said- its really simple, just a straight soldered pair of wire (ground, power) to the Vin and Gnd on my board (I have the duino mounted on some female mobo headers so i can pull it off if i want)

The rest of the wiring is just basic LOW or HIGH digital pins, and a 3.3 v line to drive the common anode 7 segment.

It's so brutally simple I cant imagine how it went wrong- i mean it worked perfectly on the bike.

Bike 12v -> Duino Vin
Bike Gnd -> Duino Gnd

Duino 3.3v - > Common Anode 7-Seg
Duino Digital Pins 2-8 -> 7-Seg

Nothing more :/ - worked great before from my PC too. just guessing the 12v from the bike fried it somehow... Does this happen?
21  Using Arduino / Project Guidance / 12-14v from motorcycle... @ Vin on: April 20, 2013, 09:43:31 am
So I hooked up my project for a quick test of the display to my bikes power- worked great for a 20 second test (just running through the numbers on my 7-seg display) .

Was happy with the results so I unplugged it all and went inside. Go to plug my arduino into the computer- nothing. power led is on, green usb led is, and yellow tx led is on- all just solid... but nothing happens... computer doesn't see it at all.

I pick it up to see if the plug is not seated well- and HOLY crap the 32u4 is scorching hot...

What happened? Is this toast?


EDIT- im only posting this because the spec says the limit is 20 volts-

http://arduino.cc/en/Main/ArduinoBoardMicro

I am 99% positive that i didn't even exceed 12.5volts- i never had the bike even turned on (When i know it throws 14.1 or so) - and if i did exceed 12 volts- it wasn't for more than half a minute...

I suppose I just need to invest in some of these https://www.sparkfun.com/products/107 or similar (maybe this http://www.radioshack.com/product/index.jsp?productId=12669026&filterName=Category&numProdsPerPage=60)

I apologize I am total newb at this- feel like I got into this stuff on the wrong angle... i can program but Im really just learning the electrical stuff...
22  Using Arduino / Project Guidance / Re: Power final project via USB (not computer) on: April 19, 2013, 02:07:03 pm
So am i better off just running 12v via the Vin input on the board straight from the bike?

I don't mind doing that I guess- just felt it would be more consolidated plugging in ONLY the usb wire.



23  Using Arduino / Project Guidance / Power final project via USB (not computer) on: April 19, 2013, 12:23:10 pm
Im hooking up a project on my motorcycle- using a Arduino micro which doesn't have a barrel jack and I'd prefer to not use the Vin/Grnd because I already have a usb hub hooked up on my bike (for charging other devices)

My concern though is- does the USB input have any voltage protection? I tested the voltage on my usb hub and i see it hover between 5 and 6 volts... is that okay or could this damage my Arduino?

Thanks!
24  Using Arduino / Installation & Troubleshooting / Re: Is the DFRuino compatible with a mega328 chip? on: April 09, 2013, 10:29:27 pm
heck yeah at that price! feel like a dope for grabbing the UNO now... granted, its nice to support arduino smiley

It's really taking a bit to sink in that these boards are really just for programming/protyping- that this can all move to a pcb by itself :>

thanks!
25  Using Arduino / Installation & Troubleshooting / Is the DFRuino compatible with a mega328 chip? on: April 09, 2013, 08:28:15 pm
I have a DFRduino that i think i fried tonight... was testing with a 12v psu when i realized the chip was REALLY hot- touched it and actually burnt my finger a bit.

quickly unplugged- and (like i should have done before) tested this power brick... it was throwing 17.5 volts.

everything seemed okay for a bit... but then it stated functioning strangely- loosing connection to the pc- and eventually not responding at all. I bought a new UNO r3 for the mean time- but is it possible that i could buy one of these a atmega328 from amazon and plug that into this board?

The current chips is one of these: http://www.amazon.com/Unknown-ATMEGA168-20PU/dp/B00BVZH8IK/ref=sr_1_5?ie=UTF8&qid=1365556875&sr=8-5&keywords=ATMega168-20

Thanks!

Pages: 1 [2]