Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Project Guidance / Controlling AC line with SSR relay
|
on: January 09, 2013, 01:56:07 am
|
|
Hi, Could I know how can I control the AC line(230V-13A)( I mean cut off and on) with the help of SSR relay and which rating relay should I use?I want to control it. I mean when I sentt signal to on, line will on, when sent off, the line will be cut off
|
|
|
|
|
4
|
Using Arduino / Programming Questions / Re: Looping 15 times
|
on: December 03, 2012, 10:37:21 pm
|
ah....sry brother...I cannot understand...let's say if this is my program...How can i Stop at 15th loop(making datastore 0)?I mean I want to continue the loop but I want to reset the datastore to 0. float KWH; KWH=(float) pow/1000/60; Serial.print("Total energy usage for 1 min="); Serial.println(KWH,2); datastore= datastore + KWH; //float finaldata=datastore+KWH; Serial.print("DATA="); Serial.println(datastore,2);
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Looping 15 times
|
on: December 03, 2012, 10:31:40 pm
|
|
Hi everybody, Newbie here. How can I make to do something when the program loops 15 times.My program is I am calculating the data, when the data is 15 times runned, i want to reset to 0.
|
|
|
|
|
7
|
Using Arduino / Microcontrollers / Re: SPI read write for 32bits data
|
on: November 22, 2012, 07:06:52 am
|
I also got it from vendor  .All I do is read the data sheet and managing for the code based on the data sheet.But I'm also still on the way so we can help each other out. @Tom BTW What's this line also...Thanks a lot data.value = 1; //This is the default value from datasheet, just using it as an example.
|
|
|
|
|
8
|
Using Arduino / Microcontrollers / Re: SPI read write for 32bits data
|
on: November 22, 2012, 06:40:59 am
|
@Paradigm yes,I'm on the same boat as you.  and I used Energy IC diagram as in the data sheet page 42 to join the Arduino Uno....working out on the program.. @Tom Thanks for the correction.. How can I print the voltage?I mean when I print out,the voltage value remains at 0.Should this line be in the loop? unsigned long voltage = SPI_read(4);//Instantaneous Voltage Channel 1
|
|
|
|
|
11
|
Using Arduino / Microcontrollers / SPI 32-bits Fetching data for IC
|
on: November 21, 2012, 10:41:38 pm
|
Hi everybody, Currently i'm now trying to get a data from my energy ic chip CS5464....but I dun know why my program is not working.Help me please..thanks a lot http://www.cirrus.com/en/pubs/proDatasheet/CS5464_F3.pdf#include <SPI.h>
int CS = 10;
union FourByte{ struct { unsigned long value:24; //24bit register values go in here byte command:8; //8bit command goes in here. }; byte bit8[4]; //this is just used for efficient conversion of the above into 4 bytes. };
void setup(){ SPI.begin(); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); Serial.begin(9600); pinMode(CS, OUTPUT); digitalWrite(CS, HIGH); //Page //example of reading data // unsigned long voltage = SPI_read(0x04);//Instantaneous Voltage Channel 1 //example of writing data union FourByte INI; INI.command = 0b11111111; //Write to config register INI.value = 0xFFFFFE; //This is the default value from datasheet, just using it as an example. SPI_write(INI); union FourByte data; data.command = 0b11101000; //Write to config register data.value = 0xFFFFFE; //This is the default value from datasheet, just using it as an example. SPI_write(data); }
void loop(){ unsigned long voltage = SPI_read(0x04); Serial.print("Voltage="); Serial.println(voltage); delay(1000); }
void SPI_write(union FourByte data) { digitalWrite(CS,LOW); //Using CS pin, so sync1/sync0 bytes not needed for(char i = 3; i >= 0; i--){ SPI.transfer(data.bit8); //transfer all 4 bytes of data - command first, then Big Endian transfer of the 24bit value. } digitalWrite(CS,HIGH); }
unsigned long SPI_read(byte command){ digitalWrite(CS,LOW); //SS goes low to mark start of transmission union FourByte data = {0xFEFEFE,command}; //generate the data to be sent, i.e. your command plus the Sync bytes. for(char i = 3; i >= 0; i--){ data.bit8 = SPI.transfer(data.bit8); //send the data whilst reading in the result } digitalWrite(CS,HIGH); //SS goes high to mark end of transmission return data.value; //return the 24bit value recieved. }
|
|
|
|
|
12
|
Using Arduino / Microcontrollers / Re: SPI read write for 32bits data
|
on: November 21, 2012, 09:05:11 pm
|
I changed to this...but still not working... #include <SPI.h>
int CS = 10;
union FourByte{ struct { unsigned long value:24; //24bit register values go in here byte command:8; //8bit command goes in here. }; byte bit8[4]; //this is just used for efficient conversion of the above into 4 bytes. };
void setup(){ SPI.begin(); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); Serial.begin(9600); pinMode(CS, OUTPUT); digitalWrite(CS, HIGH); //Page //example of reading data // unsigned long voltage = SPI_read(0x04);//Instantaneous Voltage Channel 1 //example of writing data union FourByte INI; INI.command = 0b11111111; //Write to config register INI.value = 0xFFFFFE; //This is the default value from datasheet, just using it as an example. SPI_write(INI); union FourByte data; data.command = 0b11101000; //Write to config register data.value = 0xFFFFFE; //This is the default value from datasheet, just using it as an example. SPI_write(data); }
void loop(){ unsigned long voltage = SPI_read(0x04); Serial.print("Voltage="); Serial.println(voltage); delay(1000); }
void SPI_write(union FourByte data) { digitalWrite(CS,LOW); //Using CS pin, so sync1/sync0 bytes not needed for(char i = 3; i >= 0; i--){ SPI.transfer(data.bit8[i]); //transfer all 4 bytes of data - command first, then Big Endian transfer of the 24bit value. } digitalWrite(CS,HIGH); }
unsigned long SPI_read(byte command){ digitalWrite(CS,LOW); //SS goes low to mark start of transmission union FourByte data = {0xFEFEFE,command}; //generate the data to be sent, i.e. your command plus the Sync bytes. for(char i = 3; i >= 0; i--){ data.bit8[i] = SPI.transfer(data.bit8[i]); //send the data whilst reading in the result } digitalWrite(CS,HIGH); //SS goes high to mark end of transmission return data.value; //return the 24bit value recieved. }
|
|
|
|
|