Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Project Guidance / Re: Arduino Solar MPPT battery charger on: March 07, 2013, 04:49:00 pm
Hi.

Please, keep talking about this topic.

You might already know that some other people are working on that kind of project but I still give the following link in case :
http://www.freechargecontroller.org/index.php?title=Main_Page

http://thesolarpowerexpert.com/introducing-the-v4-charge-controller/

http://www.atmel.com/images/doc1659.pdf

Unfortunately, I'm a very beginner with ARDUINO and  I can't understand all the information given. But I'm very interested and I'm studying this project.

Please keep talking, sharing and giving your advice about it.

About what I know about the ARDUINO community, It would be much more active to share about the topic's link I've just given above on the ARDUINO forum.

I'm personally  looking forward a high voltage input (200V-250V) to 12V/24V output MPPT regulator. Not for the MPPT function but mostly to use high voltage and lower the line losses on solar panel and batteries' line and save cost on big and long copper wire. In that case; MPPT would just be a nice side effect !

Something like this would be nice !
http://www.dcsolutionsaustralia.com.au/renewables/solar-controllers-mppt/midnite-classic-200v-mppt-solar-controller.html


The one I'm talking about is not 20$. And the link doesn't even work in France !
32  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 15, 2013, 11:33:30 am
Hello Pete.

I've changed the (1) with the () ind the write, but it doesn't make any change. Still wrong data in the EEPROM.
The sketch in now as below :
Code:
#include <Wire.h>     // for I2C
#define i2caddr 0x50    // device address
byte d=0; // data to store in or read from the EEPROM

void setup()
{
  Serial.begin(9600); // Initialize the serial line
  Wire.begin();         // wake up the I2C
 
  Serial.println("Writing data...");
  for (int i=0; i<257; i++)
  {
    writeData(i,i);
  }
  Serial.println("DONE");
  Serial.println("Reading data...");
  for (int i=0; i<257; i++)
  {
    Serial.print(i);
    Serial.print(" : ");
    d=readData(i);
    Serial.println(d, DEC);
  }
  Serial.println("DONE");

}

// writes a byte of data in memory location addr
void writeData(unsigned int addr, byte data)
{
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  //Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.write(data);
  Wire.endTransmission();
  delay(10);
}

// reads a byte of data from memory location addr
byte readData(unsigned int addr)
{
  byte result;
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  //Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.endTransmission(1);
  Wire.requestFrom(i2caddr,1); // get the byte of data
  result = Wire.read();
  return result;
}

void loop()
{
}


By the way. I'm having so hard time with this I2C EEPROM, would you have any good link with some sketches very well explained. I haven't been able to find something that could help me properly yet !

At the end, my project is to reprogram a Laser printer chip.
So, read an EEPROM (brand new and already programmed), then, write the data to the old one, so I've got a spare one.

I'll need some advice to do this. I've already read the data of the new 24C04.
I'll now need to inject these data in the old one.

33  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 15, 2013, 03:25:55 am
Hi Pete (El Supremo).

As I said, I'm at the very beginning with I2C EEPROM devices, so I've just copied the code from the web without really understanding what is happening.

You're right about the comment, but I have only 1 EEPROM connected.
So I think it doesn't really matter for my present issue.
34  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 14, 2013, 06:07:52 am
Yes Nick, you might be right.

But as I wanted to try to write and read, I have a new issue.

The sketch I'm using :
Code:
#include <Wire.h>     // for I2C
#define i2caddr 0x50    // device address for left-hand chip on our breadboard
byte d=0; // data to store in or read from the EEPROM

void setup()
{
  Serial.begin(9600); // Initialize the serial line
  Wire.begin();         // wake up the I2C
 
  Serial.println("Writing data...");
  for (int i=0; i<255; i++)
  {
    writeData(i,i);
  }
  Serial.println("DONE");
  Serial.println("Reading data...");
  for (int i=0; i<255; i++)
  {
    Serial.print(i);
    Serial.print(" : ");
    d=readData(i);
    Serial.println(d, DEC);
  }
  Serial.println("DONE");

}

// writes a byte of data in memory location addr
void writeData(unsigned int addr, byte data)
{
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  //Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.write(data);
  Wire.endTransmission(1);
  delay(10);
}

// reads a byte of data from memory location addr
byte readData(unsigned int addr)
{
  byte result;
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  //Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.endTransmission(1);
  Wire.requestFrom(i2caddr,1); // get the byte of data
  result = Wire.read();
  return result;
}

void loop()
{
}

The result I got in the Serial monitor that I put in a spread sheet.
You can notice, all the Bytes seems not to be written as they should be.

I modified the 10ms delay in the "writeData" subroutine but nothing change even with 20ms delay instead !

Any Idea ?
35  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 12, 2013, 07:08:18 pm


Well seen Miran Ligowyr !
Sorry, I'm guilty, I haven't properly done the modification.
I haven't neutralised the "Wire.write((int)(addr >> smiley-cool);" piece of code and then I've done it for the readData subroutine but not for the "writeData" subroutine.

Here is the code and now it works great !

Code:
#include <Wire.h>     // for I2C
#define i2caddr 0x50    // device address for left-hand chip on our breadboard
byte d=0; // data to store in or read from the EEPROM

void setup()
{
  Serial.begin(9600); // Initialize the serial line
  Wire.begin();         // wake up the I2C
 
  Serial.println("Writing data...");
  for (int i=0; i<20; i++)
  {
    writeData(i,i);
  }
  Serial.println("DONE");
  Serial.println("Reading data...");
  for (int i=0; i<20; i++)
  {
    Serial.print(i);
    Serial.print(" : ");
    d=readData(i);
    Serial.println(d, DEC);
  }
  Serial.println("DONE");

}

// writes a byte of data in memory location addr
void writeData(unsigned int addr, byte data)
{
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  //Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.write(data);
  Wire.endTransmission(1);
  delay(10);
}

// reads a byte of data from memory location addr
byte readData(unsigned int addr)
{
  byte result;
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  //Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.endTransmission(1);
  Wire.requestFrom(i2caddr,1); // get the byte of data
  result = Wire.read();
  return result;
}

void loop()
{
}

To see what happen,for the 24C02, I replaced "for (int i=0; i<20; i++)" with
"for (int i=0; i<260; i++)
  and I got
Quote
Writing data...
DONE
Reading data...
0 : 0
1 : 1
2 : 2
3 : 3
4 : 4
.
.
.
252 : 252
253 : 253
254 : 254
255 : 255
256 : 0
257 : 1
258 : 2
259 : 3
DONE

At #256 step, it seems to be rewriting on the #0 Byte ?

I'm playing with this ans I'll call you back later if needed.

Thanks so much for your help !
36  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 12, 2013, 04:59:14 pm
Well, thanks for your answers but I'm at the very beginning with this I2C EEPROM and you get me a little bet lost.

PaulS;
I'm just using a Sketch found somewhere on the web.
As it is my very first go with I2C EEPROM, I'm not really understanding the code actually.
And I'm not a programmer, so till now I've been mostly copying different pieces of code and modifying some part, then look what was happening.


Nick Gammon ;
The WP pin is to GND, so writing should be allowed.

You are talking about 2 Bytes of address that should be replaced by a only 1Byte address because the 24C02 has only 256 memory blocks. (if I understand well)
I've seen something talking about LSB and MSB concerning the address.
So I think, you might be talking about something that has to do with this. Is that right ?

But can you notice, on a previous message when I'm using Nick I2C Scanner on 2 different EEPROM, I got :
For the 24C02 :
I2C scanner. Scanning ...
Found address: 80 (0x50)
Done.
Found 1 device(s).


I've tested another one in SOIC package (Reference unreadable) and I get :
I2C scanner. Scanning ...
Found address: 80 (0x50)
Found address: 81 (0x51)
Done.
Found 2 device(s).

So, I deduce that the 2nd EEPROM was more than 256Bytes and needs an address on 2 byte (LSB and MSB)

Fortunately, we can see what happen on 2 examples. (2kB or more)
Unfortunately, the Write/Read sketch don't work for both !

I hope I'm clear enough as I'm a beginner and English is not my first language.

Many thanks for your help.


37  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 12, 2013, 10:44:09 am
Unfortunately, no change El Supreremo!


still 255 all the time !
38  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 12, 2013, 07:45:43 am
Hello Nick

It gives :

I2C scanner. Scanning ...
Found address: 80 (0x50)
Done.
Found 1 device(s).


I've test another one in SOIC package and I get :
I2C scanner. Scanning ...
Found address: 80 (0x50)
Found address: 81 (0x51)
Done.
Found 2 device(s).


But when I try to write and read, there is only 255 in each Byte.





39  Using Arduino / Storage / Re: Problem for reading and writting I2C Eeprom 24c02 6 on: February 12, 2013, 03:15:40 am
Thanks for the advice.

I modified it. Yes it looks much better.

Best regards.
40  Using Arduino / Storage / Problem for reading and writting I2C Eeprom 24c02 6 on: February 11, 2013, 08:26:10 am
Hello.

I'm doing my first step working with I2C Eeprom and I can't get it working.

For my test, I'm using a 24C02 6 and I'm using this Sketch
Code:

#include <Wire.h>     // for I2C
#define i2caddr 0x50    // device address for left-hand chip on our breadboard
byte d=0; // data to store in or read from the EEPROM

void setup()
{
  Serial.begin(9600); // Initialize the serial line
  Wire.begin();         // wake up the I2C
 
  Serial.println("Writing data...");
  for (int i=0; i<20; i++)
  {
    writeData(i,i);
  }
  Serial.println("DONE");
  Serial.println("Reading data...");
  for (int i=0; i<20; i++)
  {
    Serial.print(i);
    Serial.print(" : ");
    d=readData(i);
    Serial.println(d, DEC);
  }
  Serial.println("DONE");

}

// writes a byte of data in memory location addr
void writeData(unsigned int addr, byte data)
{
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.write(data);
  Wire.endTransmission();
  delay(10);
}

// reads a byte of data from memory location addr
byte readData(unsigned int addr)
{
  byte result;
  Wire.beginTransmission(i2caddr);
  // set the pointer position
  Wire.write((int)(addr >> 8));
  Wire.write((int)(addr & 0xFF));
  Wire.endTransmission();
  Wire.requestFrom(i2caddr,1); // get the byte of data
  result = Wire.read();
  return result;
}

void loop()
{
}

My circuit is as on the picture attached :

It gives me only 255 value faor all Bytes !!!
I've tried with another Eeprom (from the printer chip I'm trying to reprogram) and it would give me the same value 255 on each Byte.

Is there anything I'm doing wrong ?

41  Using Arduino / Project Guidance / Using H-bridge module and PWM on: May 26, 2012, 07:07:18 am
Hi.

I'm thinking using one of this module to drive a DC motor :
http://www.evola.fr/product_info.php/controleur-moteur-l298-double-pont-p-131

It's a quite standard module we can find on Ebay.

My questions are  :

My DC motor can take a little more than 2A (2.5 or 3A) for some 10 seconds under 12V on high torque demand.
On top of that, it's a little bit too fast for my purpose, so I was thinking using the  PWM resource of ARDUINO to lower the 12V voltage transformer and slow the motor down.

Will it still take the same current under lower voltage ?

In case not, would I be able to use  the 2 channel of the H-Bridge module to get 2 x 2A ?

It seems  I need 2 pin to drive the module. It  means, for 7 motor, I will need 14 PWM pin from the ARDUINO.
Or could I use 1 pin for the direction of rotation, and 7 PWM pin for the command of each motor. (I don't need different direction of rotation at the same time).
42  Using Arduino / Installation & Troubleshooting / Question on general use of the forum on: May 26, 2012, 06:42:57 am
Hi.

I'm a great satisfied man since I discovered ARDUINO and its team and forum.

But I wonder how I can be notified by Email when I get a new answer about the topic I'm interested in.

The same for the topic I've started.

Or how can I easily find back the topic I've started.

Many thanks.
43  Using Arduino / Motors, Mechanics, and Power / PWM frequency on: May 22, 2012, 12:49:16 pm
Hi.

I think, I've read that the ARDUINO's PWM  frequency was about 490-500Hz.

Somebody told me this was a quite low frequency for DC motor and should be like 20kHz instead.

What do you think ?
44  Using Arduino / Programming Questions / Re: How to read the state of an output pin ? on: April 23, 2012, 04:19:17 pm
Thank you.

At least, that's a way to make it working !
45  Using Arduino / Programming Questions / How to read the state of an output pin ? on: April 23, 2012, 03:45:20 pm
Hi.

I'm trying to read the output state of an output pin but it seams not working.

I've got something like tihs :

Code:
digitalWrite(10, HIGH);
statepin10 = digitalRead(10);
if (statepin10 == HIGH)
{
dutyCycle = map (Ubat100, 1340, 1445, 100, 220);    
dutyCycle = constrain(dutyCycle, 100, 220);      
analogWrite(8, dutyCycle);  
}

But it doesn't analogWrite anything on my pin N°8 (only 0).

If I' m not doing right, how can I do to know the state of an output pin ?
Pages: 1 2 [3] 4