Show Posts
Pages: 1 [2] 3
16  Using Arduino / Sensors / Re: Soil Moisture sensor on: January 05, 2013, 01:08:07 pm
ok ... i juste try the modification on the sketch but same problem ....

This is what i receive in the Serial monitor when all the sensor is in water.... It's not a sensor problem because if i switch it i have the same result:

Code:
Valeur sensor #1: 646

Valeur sensor #2: 15

Valeur sensor #3: 12

Valeur sensor #4: 15
-----------------------
Valeur moyenne de tout les sensors: 172
17  Using Arduino / Sensors / Re: Soil Moisture sensor on: January 05, 2013, 01:01:01 pm
tanks .... i didn't notice that one. tanks for the cue, i will try to optimize the code like you said and post it! Tanks!
18  Using Arduino / Sensors / Soil Moisture sensor on: January 05, 2013, 11:57:44 am
Hi, I have to build a small soil moisture monitor for 4 type of soil at the same time (the test was made on the same soil/same moisture). I build sensor and code a sketch (based on GardenBot) to read 4 of them from Arduino Uno. I've got some weird read value. In my test, i can see that the DigitalPin 5 and 10 cannot provide enough power for the sensor?? Someone know why? I also try to use AnalogPin 5 to 2 and only pin 2 and 3 give good reading.... I change the ATMEGA328p because i have spare and nothing change. I post the last sketch revision i made. In this sketch i can have good reading from sensor #2, #3 and #4 but the sensor #1 give me random number ranging from 400 to 800. I also post a picture to show how the sensor is made. For the 57-100K resistor i put 100K on all sensor. Help please!!

Code:
#define voltageFlipPin11 2
#define voltageFlipPin12 3
#define voltageFlipPin21 4
#define voltageFlipPin22 6
#define voltageFlipPin31 7
#define voltageFlipPin32 8
#define voltageFlipPin41 9
#define voltageFlipPin42 11
#define sensorPin1 5
#define sensorPin2 3
#define sensorPin3 1
#define sensorPin4 0

int flipTimer = 1000;
int currentsensor=1;
int val11;
int val12;
int avg1;
int val21;
int val22;
int avg2;
int val31;
int val32;
int avg3;
int val41;
int val42;
int avg4;

void setup(){
  Serial.begin(9600);
  pinMode(voltageFlipPin11, OUTPUT);
  pinMode(voltageFlipPin12, OUTPUT);
  pinMode(voltageFlipPin21, OUTPUT);
  pinMode(voltageFlipPin22, OUTPUT);
  pinMode(voltageFlipPin31, OUTPUT);
  pinMode(voltageFlipPin32, OUTPUT);
  pinMode(voltageFlipPin41, OUTPUT);
  pinMode(voltageFlipPin42, OUTPUT);
  digitalWrite(voltageFlipPin11, LOW);
  digitalWrite(voltageFlipPin12, LOW);
  digitalWrite(voltageFlipPin21, LOW);
  digitalWrite(voltageFlipPin22, LOW);
  digitalWrite(voltageFlipPin31, LOW);
  digitalWrite(voltageFlipPin32, LOW);
  digitalWrite(voltageFlipPin41, LOW);
  digitalWrite(voltageFlipPin42, LOW);
  pinMode(sensorPin1, INPUT);
  pinMode(sensorPin2, INPUT);
  pinMode(sensorPin3, INPUT);
  pinMode(sensorPin4, INPUT);
}

void loop(){
  switch (currentsensor){

  case 1:
    digitalWrite(voltageFlipPin11, HIGH);
    digitalWrite(voltageFlipPin12, LOW);
    delay(flipTimer);
    val11 = analogRead(sensorPin1);
    delay(flipTimer);
    digitalWrite(voltageFlipPin11, LOW);
    digitalWrite(voltageFlipPin12, HIGH);
    delay(flipTimer);
    val12 = 1023 - analogRead(sensorPin1);
    avg1 = (val11 + val12) / 2;
    digitalWrite(voltageFlipPin11, LOW);
    digitalWrite(voltageFlipPin12, LOW);
    ++currentsensor;
    break;

  case 2:
    digitalWrite(voltageFlipPin21, HIGH);
    digitalWrite(voltageFlipPin22, LOW);
    delay(flipTimer);
    val21 = analogRead(sensorPin2);
    delay(flipTimer);
    digitalWrite(voltageFlipPin21, LOW);
    digitalWrite(voltageFlipPin22, HIGH);
    delay(flipTimer);
    val22 = 1023 - analogRead(sensorPin2);
    avg2 = (val21 + val22) / 2;
    digitalWrite(voltageFlipPin21, LOW);
    digitalWrite(voltageFlipPin22, LOW);
    ++currentsensor;
    break;

  case 3:
    digitalWrite(voltageFlipPin31, HIGH);
    digitalWrite(voltageFlipPin32, LOW);
    delay(flipTimer);
    val31 = analogRead(sensorPin3);
    delay(flipTimer);
    digitalWrite(voltageFlipPin31, LOW);
    digitalWrite(voltageFlipPin32, HIGH);
    delay(flipTimer);
    val32 = 1023 - analogRead(sensorPin3);
    avg3 = (val31 + val32) / 2;
    digitalWrite(voltageFlipPin31, LOW);
    digitalWrite(voltageFlipPin32, LOW);
    ++currentsensor;
    break;

  case 4:
    digitalWrite(voltageFlipPin41, HIGH);
    digitalWrite(voltageFlipPin42, LOW);
    delay(flipTimer);
    val41 = analogRead(sensorPin4);
    delay(flipTimer);
    digitalWrite(voltageFlipPin41, LOW);
    digitalWrite(voltageFlipPin42, HIGH);
    delay(flipTimer);
    val42 = 1023 - analogRead(sensorPin4);
    avg4 = (val41 + val42) / 2;
    digitalWrite(voltageFlipPin11, LOW);
    digitalWrite(voltageFlipPin12, LOW);
    ++currentsensor;
    break;

  case 5:
    Serial.print("Valeur sensor #1: ");
    Serial.println(avg1);
    Serial.println();
    Serial.print("Valeur sensor #2: ");
    Serial.println(avg2);
    Serial.println();
    Serial.print("Valeur sensor #3: ");
    Serial.println(avg3);
    Serial.println();
    Serial.print("Valeur sensor #4: ");
    Serial.println(avg4);
    Serial.println("-----------------------");
     Serial.print("Valeur moyenne de tout les sensors: ");
    Serial.println((avg1+avg2+avg3+avg4)/4);
    Serial.println();
    Serial.println();
    currentsensor=1;
    break;

  }

}



And the sensors. I coated the upper of the sensor with paraffin because water have tendency to accumulate on the little piece of board and cause bad reading.

19  Using Arduino / Networking, Protocols, and Devices / Re: Mega 2560+ethernet shield and sensor on: December 14, 2012, 10:45:36 pm
Tanks for the info, but i need something like KSduino but offline(nĂ´ internet connections) tanks
20  Using Arduino / Networking, Protocols, and Devices / Mega 2560+ethernet shield and sensor on: December 08, 2012, 11:04:41 pm
Hi .. I found some Time ago a project that make a webserver from a mega and ethernet shield to control and logging sensor over a webpage ... i think it's not just a sketch but a complete bootloader. I ccannot remember the name of this project. Someone know this project? This bootloader is ONLY for the Mega 2560 and support various sensor like dht22 photoresistor etc .... tanks
21  Using Arduino / Project Guidance / Re: Timer on: March 21, 2012, 10:24:20 pm
What about using the ATmega328 timer. You can have an interruption each 10 seconds or 1 minute, just to check the Relay state, and make the math. It is important to use timers because they are precise. Functions like millis() are not ok for this application.

millis() is implemented with a timer. I don't see the difference. millis() and anything else done with the timers will be as accurate as the system clock.

If it were me, I'd try the following. An RTC could also be used, but most don't have millisecond resolution; whether that is an issue for this particular application I have no idea.


Thanks for the help .... what the relayState change in calculation of total time?
What the "?" mean ? could you please explain
Thanks a lot!
22  Using Arduino / Project Guidance / Re: Timer on: March 21, 2012, 07:33:38 pm
Lentrave,

What about using the ATmega328 timer. You can have an interruption each 10 seconds or 1 minute, just to check the Relay state, and make the math. It is important to use timers because they are precise. Functions like millis() are not ok for this application.

Here you may find a good tutorial bout timers: http://www.engblaze.com/microcontroller-tutorial-avr-and-arduino-timer-interrupts/

Another good source of information, I a place to meet people and exchange ideas and projets is GarageLab.com

Good luck!

tanks ... i read this but it seem over my knowledge in arduino smiley-razz
23  Using Arduino / Project Guidance / Timer on: March 21, 2012, 05:49:26 pm
Hi, i want to do something but i don't know how, maybe same one can help me. I have a relay controlled by an arduino. I want to display the on time of this relay. How many hours and minutes this relay is on since the arduino start.

Tanks
24  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 16, 2012, 12:31:22 am
Well I don't know for sure what to try next. I got it working so in principle it should work. In your shoes I would be starting to swap things around. Do you have a Uno or similar you can hook the wires up to, to see if it works there? Or another programmer like a USBtinyISP? Or another chip?

I have other atmega328 ... i tray swap it but no success
i swap crystal and cap
i swap the breadboard
i only have an arduino mega 2560 ... i have plan to make an arduino on breadboard and upload sketch with FTDI Basic from sparkfun but without the bootloader i can do nothing... maybe i will buy another atmega238 with the bootloader preloaded to upload bootloader to my other atmega328 (ArduinoISP)... or just a UNO
25  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 15, 2012, 10:23:18 pm
All voltages seem right ....
26  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 15, 2012, 08:35:24 pm
I can't see anything wrong. You are clearly communicating with the Mega2560 because of all the stuff that is coming back from avrdude.

However a device signature of 0x000000 seems to suggest that the Atmega328 is not responding. You could try measuring voltages (eg. on 5V) to confirm it is powered up. Other than that, it's hard to know what to suggest next.

Oh, wait. Have you connected the Gnd and +5V from one side of the breadboard to the other? I can't see it in the photo, but maybe you did outside it.

Yes its under the arduino board ... I will try to Check voltage
Tanks
27  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 15, 2012, 07:17:42 pm
Post a photo please.



Uploaded with ImageShack.us

you don't see the 2 crystal cap because is under the crystal.
28  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 15, 2012, 06:52:05 pm
The atmega328 in on a breadboard with 16 mhz crystal and 2x 22pF capacitor on pin 9 and 10.

I don't know for sure. You should probably connect pin 20 (AVCC) to +5V. You should have a 0.1 uF capacitor between VCC and GND, and AVCC and Gnd. You should probably have a 10K resistor between RESET (pin 1) and +5V.

Same problem with AVCC, 0.1 uF cap and 10K resistor
29  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 15, 2012, 06:08:54 pm
After uploading ArduinoISP2 on my mega 2560 ...

I was getting that when using the ArduinoISP that came with the IDE. Where exactly did you get yours from?

the one you post before

Code:
https://raw.github.com/adafruit/ArduinoISP/master/ArduinoISP2.pde
30  Using Arduino / Microcontrollers / Re: Use Arduino Mega 2560 as ISP (Bootloading ATMEGA328P-PU) on: March 15, 2012, 05:58:35 pm
Quote
-cstk500v1

I was using -c avrisp.

The bootloader file will be in your "bootloaders" folder, eg. optiboot_atmega328.hex

Try locating that file, and then using the avrdude command with it.

Looks like your device is: -P/dev/tty.usbmodemfd111

Ok i wrote this in Therminal (Mac OS X):

Code:
/Applications/Arduino1,0.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino1,0.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -c avrisp -p m328p -P /dev/cu.usbmodemfd111 -U flash:w:optiboot_atmega328.hex -b 19200 -v -v -v -v

and i receive the same error

Code:
avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino1,0.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/lentrave/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodemfd111
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel AVR ISP
avrdude: Send: A [41] . [80]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
avrdude: Send: A [41] . [84]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Reading | #################                                  | 33% 0.08savrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Reading | ################################################## | 100% 0.12s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

avrdude: Send: Q [51]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

avrdude done.  Thank you.

Any idea? i have always the " avrdude: Device signature = 0x000000 " error.
Pages: 1 [2] 3