Show Posts
Pages: [1] 2 3 ... 10
1  Using Arduino / General Electronics / Re: Help to switch power to analog sensors on: April 03, 2014, 01:05:47 am
Tanks a lot for you help! It seems I have to change my mind a bit. Now I use moisture sensors, which creates electrolisys and those are not reliable...However I will try to start with a relay module to switch power to them...
Is there any topic about a reliable moisture sensor without using DC?
2  Using Arduino / General Electronics / Re: Help to switch power to analog sensors on: April 02, 2014, 08:46:07 am
Oh sorry, I have made a mistake. Each sensor need 40mA max, not 4mA.
3  Using Arduino / General Electronics / Help to switch power to analog sensors on: April 02, 2014, 06:15:59 am
Hi,
I need some help to resolve power switching to analog moisture sensors. I would like to use digital pins to control the switch what will forward 5v power from the Mega board to five moisture sensor.
One of the opportunity to use relay,but I would like to switch in every 5 or 10 minutes. Every sensor use 4mA, so sum 200mA will be used. As digital pins can provide 40mA max, the current of the control should be 20-30mA.
Maybe transistor switch would be more 'long lasting' than relay. Can anybody help to provide what circuit should be build?
Sorry for my english...
4  Using Arduino / Networking, Protocols, and Devices / Re: W5100 power up issue (just start after pressing reset) on: March 28, 2014, 01:57:45 am
Thanks, but this is the RC low pass filter. Already tried that, but no change...
5  Using Arduino / Networking, Protocols, and Devices / Re: W5100 power up issue (just start after pressing reset) on: March 27, 2014, 12:00:51 pm
I have attached a picture about the board and the shield. I have tried to put a larger delay at the beginning of the setup(). No change.
It is only working fine, in case of pressing the reset, or in case of using the serial monitor...
 smiley-confuse
Thanks!
6  Using Arduino / Networking, Protocols, and Devices / Re: W5100 power up issue (just start after pressing reset) on: March 26, 2014, 07:02:23 pm
ok, sorry. So the setups:

1. mega2560 arduino board, wiznet5100 local made sitting on it. Using six  pieces of 1wire ds18b20 and connecting to a router.  this wiznet shield does not have isp on the bottom.
2. funduino 2560 board with hanrun wiznet5100 shield. Using 5 ds18b20 on 1wire and dht11 on digital pins. Shield using ISP to connect to the board.
For both of them exactly the sami problem I have. I do not have to reset only in case of connecting to my laptop with USB.
It is no matter what kind of skecth does it have, just right after power up, the shield are not starting...

What kind of schematics should I give? (sorry for the question, but i do not understand.) I do not have any documentations about the shields unfortunately.
7  Using Arduino / Networking, Protocols, and Devices / W5100 power up issue (just start after pressing reset) on: March 26, 2014, 02:33:37 am
Hi,
I have exactly the same problem on both device. Mega2560 boards, w5100 ethernet shields ( local made, and the other is hanrun ).  Using an external power supply (stable adapter using 9V DC...) after power up, the wiznet shield 'hanging' and nothing happens, just blinking a yellow led on it. After pressing the RESET button on the shield, it is starting, and working fine!
I have tried the followings:
- changed to another type of adapter with 7V, 9V, 12V also   -> nothing changed
- tried to use the RC low pass filter what can be found on the internet to fix this issue ( 10K resistor between Reset and 3.3v and 10nF capacitor between reset and GND, also with 20nF, and isolating the Reset also ) -> nothing changed
- tried to find any topic here about the fix, but haven't...

I was thinking about how to fix it???
- should use the USB input with the current power adapter ( because the problem happen only on power input plug ) with creating a cable between the USB input and the DC adapter?
- should somehow reset the w5100 at the first start ( setup ) , but how? ( like this:  http://www.instructables.com/id/two-ways-to-reset-arduino-in-software/#step1 but this will reset over and over...)
- watchdog timer? But I need to modify the bootloader?

Please help to find the solution!
Thanks!
8  Using Arduino / Programming Questions / Re: [solved]NTP date and time updating but serial sais update is failed on: March 24, 2014, 04:50:45 pm
hi,

decalaration at the begining:
Code:
//Timeserver
IPAddress timeServer(xx, xx, xx, xx); (here u should put your local timeserver, google it out )
const long timeZoneOffset = 3600L;  
unsigned int localPort = 8888;
const int NTP_PACKET_SIZE= 48;      
byte packetBuffer[NTP_PACKET_SIZE];  
EthernetUDP Udp;                    
unsigned long ntpLastUpdate = 0;    
time_t prevDisplay = 0;  
in the setup after getting the ip address...:
Code:
//Try to get the date and time
   int trys=0;
   while((!getTimeAndDate()) && trys<10) {
     Serial.println("get time failed");
     trys++;
   }
at the end of the setup:
Code:
int getTimeAndDate() {
   int flag=0;
   Udp.begin(localPort);
   sendNTPpacket(timeServer);
   delay(1000);
   if (Udp.parsePacket()){
     Udp.read(packetBuffer,NTP_PACKET_SIZE);  // read the packet into the buffer
     unsigned long highWord, lowWord, epoch;
     highWord = word(packetBuffer[40], packetBuffer[41]);
     lowWord = word(packetBuffer[42], packetBuffer[43]);  
     epoch = highWord << 16 | lowWord;
     epoch = epoch - 2208988800 + timeZoneOffset;
     flag=1;
     setTime(epoch);
     ntpLastUpdate = now();
   }
   return flag;
}
 
unsigned long sendNTPpacket(IPAddress& address)
{
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  packetBuffer[0] = 0b11100011;
  packetBuffer[1] = 0;
  packetBuffer[2] = 6;
  packetBuffer[3] = 0xEC;
  packetBuffer[12]  = 49;
  packetBuffer[13]  = 0x4E;
  packetBuffer[14]  = 49;
  packetBuffer[15]  = 52;                  
  Udp.beginPacket(address, 123);
  Udp.write(packetBuffer,NTP_PACKET_SIZE);
  Udp.endPacket();
}
 
// Clock display of the time and date (Basic)
void clockDisplay(){
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year());
  Serial.println();
}
 
// Utility function for clock display: prints preceding colon and leading 0
void printDigits(int digits){
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

Hope this helps! For me this is working fine since many many days... And thanks again for those who helped me!
9  Using Arduino / Programming Questions / Re: Help to use strcpy to copy date and time values please on: March 11, 2014, 01:37:01 pm
UKHeliBob and PeterH,

Format is now ok and I am just looking for the snprintf() specifications! Before this topic I haven't found the %02d value, but now already checked again for the leading 0 issues.
Many thanks for the help!
10  Using Arduino / Programming Questions / Re: NTP date and time updating but serial sais update is failed on: March 11, 2014, 01:28:13 pm
Hi,

again many thanks for the help! Update is Success now!
11  Using Arduino / Programming Questions / Re: NTP date and time updating but serial sais update is failed on: March 11, 2014, 08:53:16 am
SurferTim,

thanks for warning! I have moved out Udp.begin(localPort); from getTimeAndDate to just right after getting the IP address.
Sorry for not posting the whole code, only reason is I did not want to post such sensor readings.
I will back with the results.

Caltoa,

of course! Timeserver is 84.2.46.19

12  Using Arduino / Programming Questions / Re: Help to use strcpy to copy date and time values please on: March 11, 2014, 05:24:50 am
I will give a try and back to you soon!
13  Using Arduino / Programming Questions / Re: NTP date and time updating but serial sais update is failed on: March 11, 2014, 05:23:37 am
That is the same in my code...no duplicate ethernet.begin and udp.begin...
14  Using Arduino / Programming Questions / [solved]NTP date and time updating but serial sais update is failed on: March 11, 2014, 04:41:17 am
Hi,

I have a problem with ntp update. However the date and time values are saved to the sd card, when sketch is running serial sais: ntp server update failed.
I am not using any rtc.
Thanks for any help.

Code:
//Timeserver declaration
IPAddress timeServer(xx, x, xx, xx);
const long timeZoneOffset = 3600L;  
unsigned int localPort = 8888;
const int NTP_PACKET_SIZE= 48;      
byte packetBuffer[NTP_PACKET_SIZE];  
EthernetUDP Udp;                    
unsigned long ntpLastUpdate = 0;    
time_t prevDisplay = 0;    
...
...
//**in the setup() after getting IP address

//Try to get the date and time
   int trys=0;
   while(!getTimeAndDate() && trys<10) {
     trys++;
   }
...

//**at the end of the setup()

int getTimeAndDate() {
   int flag=0;
   Udp.begin(localPort);
   sendNTPpacket(timeServer);
   delay(1000);
   if (Udp.parsePacket()){
     Udp.read(packetBuffer,NTP_PACKET_SIZE);  // read the packet into the buffer
     unsigned long highWord, lowWord, epoch;
     highWord = word(packetBuffer[40], packetBuffer[41]);
     lowWord = word(packetBuffer[42], packetBuffer[43]);  
     epoch = highWord << 16 | lowWord;
     epoch = epoch - 2208988800 + timeZoneOffset;
     flag=1;
     setTime(epoch);
     ntpLastUpdate = now();
   }
   return flag;
}
 
unsigned long sendNTPpacket(IPAddress& address)
{
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  packetBuffer[0] = 0b11100011;
  packetBuffer[1] = 0;
  packetBuffer[2] = 6;
  packetBuffer[3] = 0xEC;
  packetBuffer[12]  = 49;
  packetBuffer[13]  = 0x4E;
  packetBuffer[14]  = 49;
  packetBuffer[15]  = 52;                  
  Udp.beginPacket(address, 123);
  Udp.write(packetBuffer,NTP_PACKET_SIZE);
  Udp.endPacket();
}
 
// Clock display of the time and date
void clockDisplay(){
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year());
  Serial.println();
}
 
// Utility function for clock display: prints preceding colon and leading 0
void printDigits(int digits){
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

//**in the loop()

//NTP update
{
      int trys=0;
      while(!getTimeAndDate() && trys<10){
        trys++;
      }
      if(trys<10){
        Serial.println("ntp server update success");
      }
      else{
        Serial.println("ntp server update failed");
      }
    }
    // Display the time if it has changed by more than a second.
    if( now() != prevDisplay)
   {
    prevDisplay = now();
    clockDisplay();  
    }
....
//** and after sending the values to SDcard

15  Using Arduino / Programming Questions / Re: Help tu use strcpy to copy date and time values please on: March 11, 2014, 04:19:03 am
Hi,

using here sprintf() is working, but the format is not the best.
Code:
sprintf(stime, "%d:%d:%d", hour(), minute(), second());
...
sprintf(sdate, "%d-%d-%d", year(), month(), day());
sdate and stime are char (char sdate[11] and char stime[9] ).
Now the values are:
date is 2014-3-11  (should be 2014-03-11) and time is  10:9:3 (should be 10:09:03).
Pages: [1] 2 3 ... 10