Show Posts
|
|
Pages: [1] 2 3
|
|
1
|
Using Arduino / Storage / Re: 24C32 EEPROM - Can't get it work right
|
on: April 30, 2013, 01:18:40 pm
|
Thanks for the information  However the NVSRAM is not well explained in Wikipedia. http://en.wikipedia.org/wiki/NvSRAMnvSRAM is one of the advanced NVRAM technologies that is fast replacing the BBSRAMs, especially for applications that need battery free solutions and long term retention at SRAM speeds. nvSRAMs are used in a wide range of situations—networking, aerospace, and medical, among many others[1] —where the preservation of data is critical and where batteries are impractical The DS1307 is a NV SRAM. http://datasheets.maximintegrated.com/en/ds/DS1307.pdfBut a little further in the datasheet they state that the 56 bytes are: Battery Backed, General Purpose RAM with Unlimited Writes Regards.
|
|
|
|
|
2
|
Using Arduino / Storage / Re: 24C32 EEPROM - Can't get it work right
|
on: April 29, 2013, 03:40:00 pm
|
Why are you using decToBcd() and bcdToDec()?
Sorry about this again. I am using the functions above to read and write on the available memory 56 byte NV free RAM. To be more precise, I use one byte to store a value of an exact hour, that can be changed by the user. As the RAM memory is NV, I believe I am good  But, am I doing anything wrong? So far its running OK. Thanks 
|
|
|
|
|
3
|
Using Arduino / Installation & Troubleshooting / Re: Fried voltage regulator - Arduino Nano V3
|
on: April 28, 2013, 02:24:24 pm
|
Back again with news. The problem was in fact the voltage regulator. After replacing the ATMEGA328 to an ATMEGA8A and the voltage regulator everything is running smoothly. However, the code I was working on is too big to fit into the new ATMEGA, so I tested with some LCD and RTC examples. So far so good  Thanks and good luck!  
|
|
|
|
|
4
|
Using Arduino / Installation & Troubleshooting / Re: Fried voltage regulator - Arduino Nano V3
|
on: April 28, 2013, 01:12:24 pm
|
I replaced the ATMEGA328 with an ATMEGA8A and now everything is running OK. Well... with less memory and without the voltage regulator, but... the LCD and the RTC are good. Yupi. I believe that the problem was only due to the faulty regulator. I was wondering if I had any short from Vin to +5V pins but no! I am going to solder another regulator and try again to see if I get smoke again. If so... oh boy!  ehehe Thanks
|
|
|
|
|
5
|
Using Arduino / Storage / Re: 24C32 EEPROM - Can't get it work right
|
on: April 28, 2013, 09:35:49 am
|
The EEPROM happens to be on the same board as the DS1307, but they are different chips.
The I2C EEPROM on the RTC board should also be used to read and write bytes. It has absolutely nothing to do with bcd code.
The Arduino has also EEPROM. You can read and write bytes to it.
Thanks  Now I know. However, I can not try again  I fried the arduino. I used an external 12V power supply. I applied it into the Vin pin. (Vin and 5V output were not shorted) and the voltage regulator fried and shorted letting the 12V pass through. Result: Atmega dead. Probably the RTC, EEPROM and LCD are also dead. I just ordered a couple more of each  Thanks!
|
|
|
|
|
6
|
Using Arduino / Installation & Troubleshooting / Fried voltage regulator - Arduino Nano V3
|
on: April 28, 2013, 09:20:03 am
|
Hey mates, I have been powering my Arduino Nano V3 via USB. So far so good  A few minutes ago, I remove the USB and I plugged an external 12V power supply into the Vin pin. Of course, Vin and the 5V output were not shorted. Imagine what: The 5V voltage regulator fried and shorted letting the 12V pass through damaging the ATMEGA328. I am not yet sure about the RTC (DS1307) EEPROM (24C32) Temperature Sensor (LM35) and the LCD :/ My question is: Why?  Regards
|
|
|
|
|
7
|
Using Arduino / Storage / Re: 24C32 EEPROM - Can't get it work right
|
on: April 28, 2013, 09:08:33 am
|
Run the i2c scanner, http://playground.arduino.cc/Main/I2cScannerIf that is okay, write a byte and read a byte. Why are you using decToBcd() and bcdToDec()? I think in the history of memory chips, there has never been a memory that used bcd code to store data. Not on earth, not elsewhere in the universe. Thanks for letting me know the existence of I2cScanner  About the decToBcd() and bcdToDec(), I use them to read and write the DS1307! I also use them to store data on its free NV RAM.
|
|
|
|
|
8
|
Using Arduino / Storage / 24C32 EEPROM - Can't get it work right
|
on: April 28, 2013, 07:49:10 am
|
Hey friends  How have you been? I have been searching and trying badly to get an external 24C32AN from Microchip to work... without success so far. This is the external EEPROM which cames with the RTC module -> DS1307 from Dallas. The clock is working OK... I can write, read, whatever... on it's 56bytes NV SRAM. Then I though: "Hey! Why not check how the the 24C32 works?" I added this line of code: #define E24C32_I2C_ADDRESS 0x50
and a little bit of this: //Write data on 5th row Wire.beginTransmission(E24C32_I2C_ADDRESS); Wire.write(0x05); //choose the 5th row Wire.write(decToBcd(10)); //write number 10 on memory Wire.endTransmission();
//Read the written data Wire.requestFrom(E24C32_I2C_ADDRESS), 1); //reads one byte starting on the latest position -> 0x05 newvar = bcdToDec(Wire.read()); lcd.setCursor(2,3); //Set the cursor in the position number 2 (3rd char) on line 3 of the LCD. lcd.print(newvar);
No idea why, but no matter which value I write, I get this decimal value of "165" ( 0b10100101 ) Do you guys have any idea what's going wrong? Thanks for you help Regards.
|
|
|
|
|
9
|
Using Arduino / Programming Questions / Re: What's wrong with this code?
|
on: March 23, 2013, 05:09:34 pm
|
You've got a line there that says brightnessFactor = a whole bunch of integer math. Integer math is only going to give inter gets, it will never give you 0.82 or any other decimal number.
Make those constants floats like 1.0 and 2.0 instead of just 1 and 2 and see what happens.
Thank you so much mate  Problem solved. This is why I hate coding! ^^! 
|
|
|
|
|
10
|
Using Arduino / Programming Questions / What's wrong with this code?
|
on: March 23, 2013, 03:46:01 pm
|
Hey mates, I don't have any clue why this code does not work right. If "minute" is 36, why "brightnessFactor" is "1"? By the way... no matter what the minute is, brightnessFactor is always "1"? brightnessFactor should be 0.82 when "minute" is 36. Pardon my french, but WTF?!  Thanks mates! 
|
|
|
|
|
11
|
Using Arduino / Sensors / Re: Temperature Sensor LM60
|
on: November 15, 2012, 05:44:24 am
|
Sometimes it helps just to think through it out loud. You don't say what type your variable "Vin" is but if it's an integer you might want to make it an unsigned int as it could, theoretically, get larger than a regular int.
Yah! You're right  About Vin, I declared it as a double  Temp is also a double! About variable "samples[50]"... each sample is an integer [0 - 1023]. However, adding 50 integers and then divide all by 50 the "samples" variable could NOT be an integer. That is, if all samples are 500 (ADC). Then the sum is 50*500 = 25000. Then, dividing all by 50, the average value is 500!!! OK, it's an integer! But if 49 samples are 500 (ADC). and the last one is 501. The average value is 500.02  If "samples[50]" is declared as a integer, it would be rounded down to 500. But the real value is 500.02. So, I also declared it as a double! Thank you so much for your help! Regards.
|
|
|
|
|
12
|
Using Arduino / Sensors / Re: Temperature Sensor LM60
|
on: November 14, 2012, 07:40:43 pm
|
You're right. I just simplified the equation a little more.
I get the correct answer for your hypothesis of 424 mV measured with both your equation and mine, 0. Your original question implied that you were getting an error. Did you edit your original equation or just solve it incorrectly? Anyway, the answer to your original question the way it stands now is both your code's opinion and your opinion are correct.
Thank you all mates! You helped me solving the problem. I was doing my math wrong. I was confusing ADC readings with miliVolts!!!  The code is this: void WriteTemperatureOnLCD(void) { k++; if (k == 50) { Vin=0; temp=0; for(j=0 ; j<=49 ; j++) { samples[j] = (analogRead(analogtemp)); //Here you get a value from 0 to 1023. If Vref is 1100mV, then 1023 represents a Vin = 1023*1100/1024 = 1098.93mV. Vin = Vin + samples[j]*1089/1024; //Here you convert from ADC to milivolt -> Voltage = ADC*Vref/1024 }
Vin=Vin/50; Serial.println(Vin); lcd.setCursor(9, 0); lcd.print(Vin, 1); lcd.print("mV"); } if (k == 100) { temp = (Vin / 6.250) + minimum;
if ( (temp >=0) & (temp <10) ) { lcd.setCursor(8, 0); lcd.print(" "); lcd.print(temp, 1); }
if ( (temp >=10) & (temp <100) ) { lcd.setCursor(8, 0); lcd.print(" "); lcd.print(temp, 1); } if (temp >=100) { lcd.setCursor(8, 0); lcd.print(" Hi"); } if ( (temp >-10) & (temp <0) ) { lcd.setCursor(8, 0); lcd.print(" "); lcd.print(temp, 1); } if (temp <=-10) { lcd.setCursor(8, 0); lcd.print(" Lo"); }
|
|
|
|
|
13
|
Using Arduino / Sensors / Re: Temperature Sensor LM60
|
on: November 14, 2012, 04:43:02 pm
|
temp = (Vin / 1024.00 * 1100.00 -424.0) / 6.250 ; It is always a good idea to use as little floating point math as possible. Absolutely! That way when you get the equation wrong, you'll hardly notice! :-P Hmm ^^! I think both formulas are right! temp = ( ((Vin/1024.00) * 1100.00) / 6.250) + minimum; //minimum = (-424.0/6.25) Let's say: " (Vin/1024.00) * 1100.00 " = Voltage Then: temp = Voltage/6.25 - (424/6.25) Or temp = (Voltage-424)/6.25 So, I don't think there's a problem in the formula ^^! Or it is?! lol
|
|
|
|
|
14
|
Using Arduino / Sensors / Re: Temperature Sensor LM60
|
on: November 14, 2012, 12:05:13 pm
|
That's simple: Vref (1100mv) gets translated to 1023 (10-bit adc).
424mv would be translated into 1023/1100*424=?
An adc reading of X would translate into 1100/1023*X=?
Thanks There are 1024 intervals in a 10 bit ADC, right? So: if V=1100mV -> ADC=1023 and if V= 0.000mV -> ADC=0 Thanks 
|
|
|
|
|
15
|
Using Arduino / Sensors / Re: Temperature Sensor LM60
|
on: November 14, 2012, 10:59:19 am
|
Not sure what points you are trying to make but Vo = (+6.25 mV/ºC x TºC) + 424 mV. That equation can be rewritten so the calculation is done automatically from adc readings, rather than voltage reading, making your life easier. I can help you if you want. Thanks  After reading a bit more... the first thing I should do is compensate the ADC. I am using the internal reference from the ATmega328 -> 1100mV (in theory) In practice, the measure reference is very stable and it's 1088mV. So my question now is: How can I compensate the ADC reading below? samples[j] = (analogRead(analogtemp)); The ADC is 10bit resolution and in theory Vref is 1100mV -> So each interval is 1100mV/1024 (or 1100mV/1023????) In practice the Vref is 1088mV. So again, my question is: How can I compensate the ADC reading? Thank you so much 
|
|
|
|
|