Show Posts
Pages: 1 ... 36 37 [38] 39 40 ... 72
556  Using Arduino / Project Guidance / Re: Desperate Ultrasonic library coding simplification needed on: August 06, 2013, 10:51:53 am
I see all sorts of delay() and delayMicroseconds()... these all need to be eliminated. See "Blink without delay:

http://arduino.cc/en/Tutorial/BlinkWithoutDelay
Also, read up on PWM, as a way to get rid of all those flickers.
557  Using Arduino / Project Guidance / Re: Switch Counts (debouncing?) on: August 05, 2013, 10:48:13 pm
Code below includes time display that I was working on at the time.



Code:
volatile unsigned long last_micros = 0;

void debounce() {
  if((long)(micros() - last_micros) >= debouncing_time) {
  //When it gets here the first time, last_micros will be zero
  //so the if statement will be true (unless micros() has just rolled over),
  //even if debouncing_time hasn't been reached. To solve it,
  //set last_micros = micros(); in setup().
    last_micros = micros();
    door = door + 1;
  }
558  Topics / Device Hacking / Re: thermal printer + Arduino on: August 04, 2013, 10:00:42 pm
I recently salvaged a thermal printer saying "EM205_101122" on it's circuit board. I also got success in accessing to all it's datasheets.
It seems that it has a RS232 as well as TTL ports, but both of the ports are given two  extra pins saying "RTS/DTS and DTR/DSR".
These are what are called 'handshaking' pins.
Quote
While I read about them, they are the flow control pins and are to be kept +12V or -12V.
Only on the RS232 input. The TTL inputs work on 0 - 5V only.
Quote
For communication with the Arduino (as given  in this tutorial: http://bildr.org/2011/08/thermal-printer-arduino/) does these pins are required to be used or we can just use the RX TX pins only?
Google 'handshaking'.
559  Using Arduino / General Electronics / Re: cell phone jammer using house Mains ground as antenna on: August 04, 2013, 09:40:06 pm
I don't know, if I call from the back of my house I get crappy cell coverage, walk 18-20' to the front door and it's a lot better - maybe some self-jamming going on smiley-cool
I had exactly the same problem up to a couple of months ago. Then the phone company readjusted their mast and the signal is now quite strong and much the same throughout the house.
560  Using Arduino / General Electronics / Re: Can I power a rated DC5V 3W Water Pump using three rated 1.5V batteries? on: August 04, 2013, 09:35:20 pm
Can I power a rated DC5V 3W Water Pump using three rated 1.5V batteries?
You CAN, but how long your batteries will last is a different matter.
561  Using Arduino / General Electronics / Re: I had to share this one with you... on: August 04, 2013, 09:29:30 pm
Maybe they used all their stock of black lacquer painting all the IDT QS3257Qs smiley
562  Using Arduino / Programming Questions / Re: Trying to compare data: error: invalid use of void expression on: August 04, 2013, 08:42:10 pm
Replace void setup(void) with void setup().
Replace void loop(void) with void loop().
563  Using Arduino / Project Guidance / Re: 3 wire fan reading RPM when speed controlled by PWM on: August 04, 2013, 08:25:23 pm
any suggestion?
I suggest you read the 'sticky' at the top of this forum and show us the code you're having difficulty with.
564  Using Arduino / General Electronics / Re: Desoldering components? on: August 03, 2013, 09:44:41 pm
Paint stripper pointed at the back of the board. Components drop right off.

EDIT:
That assumes you don't mind all the other components coming off as well.
A domestic oven at 180oC/gas mark 6, for 10 minutes does the same to an upturned board. Don't try this when the Sunday roast is cooking, if you want to stay married. smiley-eek
565  Using Arduino / Project Guidance / Re: Different results when connected via Raspberry Pi on: August 03, 2013, 09:03:58 pm
Got it. Didn't want to overload you guys too much.
This is my first Arduino project. I am making a weather station. I have a rain bucket attached to my Arduino Uno
Is that a 240V AC bucket or a 12V DC bucket? It runs off the 5v line from the Arduino
So it's a 5V bucket. Where can I buy one of those?
Quote
Quote
through the number 1 interrupt (Digital Pin 3).
Why are you using interupts? Are you trying to count each individual drop of rain? Yeah, that's how the rain bucket works. Every 5cm or so of rain, it tips and triggers a switch.
So it's NOT the bucket that's connected to your arduino, it's a switch.
Quote
I am keeping a count of the amount of tips every minute.[/color]
Are you expecting your bucket to tip every microsecond? If not, then why use interupts?
Quote
Quote
I have it connected to a pull-down resistor as well.
100Meg Ohms? It's a 10K resistor. I use the same resistance for every resistor.
Why did I have to drag that information out of you?
Quote
Quote
My problem is that when I have the Arduino connected via my Raspberry Pi,
How is it connected to your Pi? USB? Wireless? WiFi? BlueTooth? Magic? It's connected to the Pi's USb port.
Quote
the number increment on their own.
I am stumped as to what is causing this.
Without your sketch and some clues, so is everyone else.

Quote
Here is my current sketch

Code:
int interrupt = 1;
float value = 0.21896551; //Need to find my own calibration value.
volatile int count = 0;
long debouncing_time = 500;
volatile unsigned long last_millis = 0;


float convert(){
  return value * count;
}
  

void rainIncrement(){
  if((long)(micros() - last_millis) >= debouncing_time * 1000){
    count++;
    last_millis = micros();
  }
}

void setup(){
  attachInterrupt(interrupt,rainIncrement,FALLING);  
  Serial.begin(9600);
}

void loop(){
 Serial.print("Count: ");
 Serial.print(count);
 Serial.println();
 Serial.print("Millimeters: " );
 Serial.print(convert());
 Serial.println();
 delay(2000);  
}
 
Many thanks
Get rid of the interupt. Get rid of micros(), use millis() instead. Give last_micros a value of millis() instead of 0 in setup(). You haven't declared which pin your switch is on, or whether it's an input or an output. Watch the pin for a change of state. If bucket tips (within one minute), increment count, and after 1 minute do the maths and output result.
Your problems with the Pi are because, during an interupt, serial comms are effectively disabled.
566  Using Arduino / Programming Questions / Re: Loading a new code from within the code on: August 02, 2013, 10:10:10 pm
Now, what I want to know is, can we do the same on the Arduino? Can we, at some point, from within the Arduino programming tel the board to flush the current program and load new coding from outside?

Can you tell Windows to format all your hard drives and then reload itself from the Net?
That's what you appear to be trying to do.
If you flush the current program, how does it know that it should load a new program? The code that tells it to do that (and how to do that) has been flushed!
567  Using Arduino / Programming Questions / Re: 110V switch. on: August 02, 2013, 09:44:19 pm
What appears to be wrong is that the relay will only be actuated whilst the button is being pressed. Look up 'state machine' to overcome this problem.

I hope you've got a reverse bias diode across your relay coil, to kill any back EMF when the relay is switched off. Otherwise it could kill your arduino!
568  Using Arduino / Project Guidance / Re: Switch Counts (debouncing?) on: August 02, 2013, 09:29:58 pm
While door closed, do nothing.
delay (50); To take care of any bounce
Door must be open now, so increment count once and output to display.
While door open, do nothing  //wait for door to be closed
                                            //somebody might be holding it open.
delay (50); To take care of any bounce
Door must now be closed, loop.

No need for micros() or interupts.

I hope you're not expecting to count people with this method, only the number of times the door is opened. The door could be opened once and the whole of the population of China could walk through before the door is again closed. smiley
569  Using Arduino / Project Guidance / Re: Different results when connected via Raspberry Pi on: August 02, 2013, 08:48:01 pm
This is my first Arduino project. I am making a weather station. I have a rain bucket attached to my Arduino Uno
Is that a 240V AC bucket or a 12V DC bucket?
Quote
through the number 1 interrupt (Digital Pin 3).
Why are you using interupts? Are you trying to count each individual drop of rain?
Quote
I have it connected to a pull-down resistor as well.
100Meg Ohms?
Quote
My problem is that when I have the Arduino connected via my Raspberry Pi,
How is it connected to your Pi? USB? Wireless? WiFi? BlueTooth? Magic?
Quote
the number increment on their own.
I am stumped as to what is causing this.
Without your sketch and some clues, so is everyone else.
570  Using Arduino / LEDs and Multiplexing / Re: Using 72xx LedControl with an existing sketch. on: August 01, 2013, 11:02:10 pm
Thank you for that, its really broken through the fog.
You're welcome.
Quote
Any suggestions are always appreciated, especially ones that help conserve memory.
I don't know much about LCD displays, but you could try:
Code:
    lc.setDigit(1,0,(days/100),false);  //hundreds of days
    lc.setDigit(1,1,((days %100)/10),false);  //tens of days
    lc.setDigit(1,2,((days %100)%10),false);  //units of days
    //etc.,etc.
and get rid of all the variables you don't need.
Pages: 1 ... 36 37 [38] 39 40 ... 72