Show Posts
Pages: [1] 2
1  Using Arduino / Storage / Re: Date as file name on: March 24, 2013, 12:06:37 pm
Thanks, I'll check the tutorial, right now I'm using a chronodot, maybe there's something useful in the link.
2  Using Arduino / Storage / Date as file name on: March 23, 2013, 12:42:32 pm
Hello everyone!

I'm working on a datalogging project with Arduino Uno R3, and I wanted to know if there's a way to save files with the date and time, so it would create different files, anyone could give me any pointers on this?
Thank you for reading!
3  Using Arduino / Installation & Troubleshooting / Re: Can't receive serial data from Arduino on: March 22, 2013, 05:40:25 pm
Fixed it! It seems like the RTC wasn't connected as it should be. =D
4  Using Arduino / Installation & Troubleshooting / Can't receive serial data from Arduino on: March 22, 2013, 03:45:34 pm
Hi everyone, I've been working on data logging a project with Arduino, and so far it was working ok, except for some variations on the ADC readings.. Anyways, I was able to receive data measured by the arduino on the serial monitor without trouble, but now when I connect it it won't send any data.

1. The Tx light doesn't blink.

2. I thought it could be the RTC I'm using, so I made the arduino show me the time (this was the solution I used before and it was just a time reset), but it doesn't show a thing!
 
3. I've measured 5.1 V from my USB port, and the Arduino 5V output gives around 4.6V

4. I've tried with two different Arduino UNO R3 boards, and both behave the same.

I really would appreciate any thoughts on this, thank you all!
5  Using Arduino / Storage / Re: Arduino UNO + Arduino Ethernet Shield - can't read SD card on: December 03, 2012, 10:31:40 pm
Ok I'll try those two things, thank you very much!
6  Using Arduino / Storage / Re: Arduino UNO + Arduino Ethernet Shield - can't read SD card on: December 03, 2012, 10:16:18 pm
Thank you for your quick response, I've wired it like the schematics shown on this topic http://arduino.cc/forum/index.php/topic,8863.0.html , I ripped the card holder from a multiple card-to-USB reader, and maybe it doesn't have enough power because the arduino 3.3V is also connected to an RTC (chronodot that uses few mA, 200µA according to specifications), could this be the problem?
7  Using Arduino / Storage / Re: Arduino UNO + Arduino Ethernet Shield - can't read SD card on: December 03, 2012, 09:59:30 pm
I'm actually using an 2 GB Sandisk microSD card, with a Kingston SD card adapter, both work fine on the computer. You're right, I'm not using the ethernet shield, so I just soldered some pins to a card holder.

8  Using Arduino / Storage / Re: Arduino UNO + Arduino Ethernet Shield - can't read SD card on: December 03, 2012, 04:05:31 pm
Hi everyone,

I'm having trouble with my SD card and I've tried what SurferTim said, but I keep getting the "Card failed or not present" message, I wanted to ask you where exactly do I have to connect the pins of the SD card on the Arduino (I'm using an Arduino UNO Rev3), I've already tried connecting the CS pin of the card on digital pins 4 and 10 but didn't work either way.

Thank you in advance for your help!
9  Using Arduino / Sensors / Re: Parasite readings from analogRead on: October 24, 2012, 07:25:58 pm
Thank you PiJoy! Yes, my source is a photovoltaic array, and I'll change my 3.9k resistor for a 4.3k because voltage can get to 21.9V in the most favorable conditions of sun.
I was able to get the readings, without the capacitor, my error was to have the negative feed from the PV floating around, without gnd.

My capacitor is 2200µF so the arduino will have enough time to read the voltage changes, I chose this value based on the Isc and Voc of the photovoltaic array, by:

C = Ts * Isc/Voc

Where Ts is the time the capacitor takes to get to Voc, which is the highest voltage value for the measures taken at a given time of the day (my Isc = 1.93 A)

I'll try with a ceramic cap instead, to se waht happens..
10  Using Arduino / Sensors / Re: Parasite readings from analogRead on: October 23, 2012, 08:10:14 am
I'm using 3.9k and 1.2k ohms for my voltage divider.. Is this to high? I changed them for 39 and 12 ohms but it was too low and the PV short-circuited!
11  Using Arduino / Sensors / Re: Parasite readings from analogRead on: October 22, 2012, 04:09:56 pm
Quote
Not sure what you mean by "with a capacitive load".  How is everything wired?  Is the input voltage AC or DC?

The capacitive load uses a capacitor connected to the voltage source, making it fluctuate from 0 to 5V "automatically", I'm using a voltage divider to get these 0 to 5V, because my original source (a PV) delivers 21V DC.

Quote
About 5 orders of magnitude difference in how quickly they respond to changing voltage.
Where can I get more information about this?

Here's my code, thank you for checking it out!

Code:
#include <Wire.h>
#include <avr/io.h>
#include <SD.h>
#include <avr/power.h>
#include <stdio.h>
#include <stdlib.h>
#include "RTClib.h"

 
RTC_DS1307 RTC;

#define porcentaje 0.7

#define FASTADC 1

// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

int rly1Pin = 2;
int rly2Pin = 3;
int rly3Pin = 4;
int voltPin = A2;
int corrPin = A3;
int valor = 0;
const float incremento = (5.0/1024.0);
float voltVec[100]={0};
float corrVec[100]={0};
//Para la tarjeta SD de memoria
int CS_pin = 10;
int pow_pin = 8;



void setup () {
    Serial.begin(9600);
    Wire.begin();
    RTC.begin();
 
  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");}
    
//RTC.adjust(DateTime(__DATE__, __TIME__));
  pinMode(CS_pin, OUTPUT);
  pinMode(pow_pin, OUTPUT);
  pinMode(rly1Pin, OUTPUT);
  pinMode(rly2Pin, OUTPUT);
  pinMode(rly3Pin, OUTPUT);
  Desactivar_Relay();
  SwitchOff_Carga();
  digitalWrite(rly3Pin, LOW);
  digitalWrite(pow_pin, HIGH);
  
  if (!SD.begin(CS_pin))
  {
    Serial.println("Card Failure");
    return;
  }
#if FASTADC
  // set prescale to 16
  sbi(ADCSRA,ADPS2) ;
  cbi(ADCSRA,ADPS1) ;
  cbi(ADCSRA,ADPS0) ;
#endif

}


void loop(){  
  
  DateTime now = RTC.now();
  int hora = now.hour();
  int minuto = now.minute();


  if (hora<7)
{
Dormir();
}

  if (hora>22)
{
Dormir();
}
  
    
  else
{
   if (minuto==0)
     {
     Despierta();
     Activar_Relay();
     int voc = 0;
    
     voc = analogRead(voltPin);

     int maximo = voc*porcentaje;
     int delta1 = maximo/5;
     int delta2 = (voc-maximo)/95;
     Serial.print("VOC = ");
     Serial.println(voc,DEC);
     SwitchOn_Carga();
     Medicion_Datos_IV(delta1,1,6);
     Medicion_Datos_IV(delta2,6,101);
     Imprimir_Serial();
     Desactivar_Relay();
     SwitchOff_Carga();
     Switch_Descarga();
     Nada();
 }
  
  
  else
  {
     Desactivar_Relay();
   }
}
  
}    



void Activar_Relay (){
     digitalWrite(rly1Pin, HIGH);
}

void Desactivar_Relay(){
    digitalWrite(rly1Pin, LOW);
}

void Medicion_Datos_IV (int delta, int lim_inf, int lim_sup){
  
  int compara = 0;
  int i = 0;
  
  while(i<lim_sup)
  {
  //compara = compara+delta;
  int volt = analogRead(voltPin);    
  int corr = analogRead(corrPin);
  //if (volt>=compara)
  //{
  voltVec[i] = (volt*incremento);
  corrVec[i] = (corr*incremento);
  i=i+1;
  //}
  }
  
  
}

void Imprimir_Serial(){
  for(int i=1; i<=101;i++)
  {
  Serial.println(voltVec[i], DEC);
  }
  Serial.println("/");
  for(int i=1; i<=101;i++)
  {
  Serial.println(corrVec[i], DEC);
  }
}

void Nada (){
  Serial.println("Fin de toma de datos");
}

void Despierta(){
//power_spi_enable();
power_usart0_enable();
//power_usart1_enable();
power_timer0_enable();
power_timer1_enable();
power_timer2_enable();
//power_twi_enable();
}
void Dormir(){

Serial.println("No molestar, estoy durmiendo");
//power_spi_disable();
power_usart0_disable();
//power_usart1_disable();
power_timer0_disable();
power_timer1_disable();
power_timer2_disable();
//power_twi_disable();

}  

void SwitchOn_Carga(){
  digitalWrite(rly2Pin, HIGH);
  Serial.println("Conectando carga");
}

void SwitchOff_Carga(){
  digitalWrite(rly2Pin, LOW);
  Serial.println("Desconectando carga");
}

void Switch_Descarga(){    
  int medida = analogRead(voltPin);
  while (medida >= 1){
  digitalWrite(rly3Pin, HIGH);
  medida = analogRead(voltPin);
  delay(5);
  }
  digitalWrite(rly3Pin, LOW);
}  
12  Using Arduino / Sensors / Parasite readings from analogRead on: October 20, 2012, 02:01:50 pm
Hi everyone, I'm measuring a range of voltage values (0-5V) from a voltage divider with a capacitive load for a project, I take 100 samples in an interval of about 10 to 20ms, but I keep getting wrong values, my multimeter reads 3.8 and the value that the analogRead returns is 5V or 0 (1023 or 0) for most of the samples.

Can you guys please help me with this?
13  Using Arduino / Programming Questions / Re: analogRead not working.. on: October 20, 2012, 10:30:11 am
I'm still having trouble with the analogRead in my program, I'm no longer using the FASTADC routine, because I've changed my load so the voltage increase will become slower.This way the 100µs per sample are enough, since I have 20ms from 0 to the top voltage, this allows me to have 200 samples and I only require 100.

BUT, the analogRead gives me random values! I keep getting 5V (1023) when I actually have 3.7V maximum.. What can be wrong? I'll appreciate any thoughts on this! Thanks!
14  Using Arduino / Programming Questions / Re: analogRead not working.. on: October 18, 2012, 07:49:36 am
Thanks a lot, that explains it! Now it gives the value I want smiley

The problem I had wasn't with the SD card code, it was an RTC issue, it reseted itself, so it was 1am for my circuit, and the program entered into the "dormir" routine, putting low the USART0.. Could it be that the FASTADC caused this to the RTC?
15  Using Arduino / Programming Questions / Re: analogRead not working.. on: October 17, 2012, 06:02:32 pm
I'll try that.

 I think I've solved it! Without using the FASTADC though, it seems to be a problem with the SD card setup, without it, it runs and takes the data (random values, different from those on the voltmeter) so I'll see if there's another way to get the correct data.

Thanks!
Pages: [1] 2