Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Networking, Protocols, and Devices / SMS webservice on: November 28, 2013, 07:09:53 am
Hi,

Can you please recommend a sms service that can be used directly by arduino + ethernet shield?

Thank you,
Adi
2  Topics / Home Automation and Networked Objects / Re: RF outlet library [solved] on: October 20, 2013, 12:05:14 pm
Thanks to all for suggestions.
I found a working sample on https://sites.google.com/site/arduinohomeautomation/home/unitec_eim826 and I tuned the code with my DSO to the following:
Code:
const int outPin = 8;
//------------------------------------------------------------------------
// 1200bps=833us/bit lng=70%=583, sht=30%=250 , cor=correction for pinset/pinclear
#define FRAMEREPEAT 15
#define cor 4
#define lng 623 - cor//583 - cor
#define sht 208 - cor//250 - cor
// Macros for PWM bit pulse
#define rfBIT_H  {digitalWrite(outPin, HIGH); delayMicroseconds(sht); digitalWrite(outPin, LOW ); delayMicroseconds(lng-5);}
#define rfBIT_L  {digitalWrite(outPin, HIGH); delayMicroseconds(lng); digitalWrite(outPin, LOW ); delayMicroseconds(sht-5);}
//------------------------------------------------------------------------
void setup()
{ pinMode(outPin, OUTPUT);
}//setup
//------------------------------------------------------------------------
void loop()
{
  byte rfFrame = B00001;//Button 1 ON
//  byte rfFrame = B00011;//Button 1 OFF
//  byte rfFrame = B10001;//Button 2 ON
//  byte rfFrame = B10011;//Button 2 OFF
//  byte rfFrame = B01001;//Button 3 ON
//  byte rfFrame = B01011;//Button 3 OFF
//  byte rfFrame = B00101;//All      ON
//  byte rfFrame = B00111;//All      OFF
  for ( byte j=0;j<FRAMEREPEAT;j++)         // 15 Frame repeats
  {
    for ( byte i=0;i<20;i++) {rfBIT_H}                 // 20 preamble bits
    if (rfFrame & B00010000) {rfBIT_H} else {rfBIT_L}  // ChannelBit2
    if (rfFrame & B00001000) {rfBIT_H} else {rfBIT_L}  // ChannelBit1
    if (rfFrame & B00000100) {rfBIT_H} else {rfBIT_L}  // ChannelBit0
    if (rfFrame & B00000010) {rfBIT_H} else {rfBIT_L}  // On Off Bit
    if (rfFrame & B00000001) {rfBIT_H} else {rfBIT_H}  // stopbit always 1
                            
    delayMicroseconds(5647);//4600); // interFrame delay
  }//for j
  delay(1000);
}//loop

/*
frame:
00000000000000000000 11110
0:
hi  0.208ms
low 0.623ms
1:
hi  .623ms
low .208ms

frame structure :
bit25   ...  bit5      bit4     bit3    bit2      bit1             bit0
preamble...  preamble  ch bit0  ch bit1 ch bit 2  ON/OFF
Always '1'  Always '1'                            ON ='0' OFF='1'  always '1'

Channel Bits :
Button 1,   Channel 0,  ch_bit0='0' , ch_bit1='0' , ch_bit2='0' ,
Button 2,   Channel 1,  ch_bit0='1' , ch_bit1='0' , ch_bit2='0' ,
Button 3,   Channel 2,  ch_bit0='0' , ch_bit1='1' , ch_bit2='0' ,
Button 4,   Channel 3,  ch_bit0='1' , ch_bit1='1' , ch_bit2='0' ,
Button All, Channel>=4, ch_bit0='0' , ch_bit1='0' , ch_bit2='1' ,
*/
Unfortunately the remote and the outlets don't have an address and additional sets will share the same RF commands.

Kind regards,
Adi
3  Topics / Home Automation and Networked Objects / RF outlet library [solved] on: October 07, 2013, 12:47:19 pm
Hi,

Can you please look at the attached pictures and recommend a RF Outlet Library that might work?
One thing I see is that there is no address switch or a label with the address and the libraries I know will not work.

Also I'm a bit concerned that, with no address, additional sets of outlets cannot be controlled independently.

If anyone is wondering, those are sold by Hornbach in Romania for around 10€.

Many thanks,
Adi

https://www.dropbox.com/s/0sx2596eu0p224c/2013-10-07%2020.23.05.jpg
https://www.dropbox.com/s/dnnlwk7hdzoftom/2013-10-07%2020.23.14.jpg
https://www.dropbox.com/s/of6i12be3pyl293/2013-10-07%2020.23.32.jpg
https://www.dropbox.com/s/dj9d9of10urh0ow/2013-10-07%2020.24.00.jpg
https://www.dropbox.com/s/vzru0ka89xv9v44/2013-10-07%2020.25.17.jpg
4  Topics / Home Automation and Networked Objects / Re: Solved: LG air conditioning codes on: June 05, 2013, 07:26:38 am
Hi All

I am just wondering which model LG remotes this is for.

Thanks

Darryl

The code works with LG S09AW
Regards,
Adi
5  Topics / Home Automation and Networked Objects / Re: 433 MHz RF - Temperature and humidity sensor on: January 22, 2013, 01:23:10 pm
Hi,
I've done this job a year ago and I used arduino for decoding

First you have to prepare the hardware:
 - open your sensor
 - find the modulator input
 - feed it into arduino with proper level change (I assume 0-3v => 0-5v)

The code I used was something like:
Code:
#define samples 700 //max 700
byte ms[samples];
boolean values[samples];
void setup() {               
  pinMode(13, OUTPUT);     
  pinMode(2, INPUT);
  Serial.begin(2400); 
}
long lastChange, maxTime = 0;
bool previousValue;
void loop() {
  for (int i = 0; i < samples; i++)
  {
    values[i] = false;
    ms[i] = 0;
  }
  long start = micros();
  for (int i = 0; i <= samples; i++)
  {
    if (i == samples) i = 0;
    digitalWrite(13, (values[i] = digitalRead(2)));
    ms[i] = (byte)((micros() - start)/10);
    start = micros();
    while (values[i] == digitalRead(2))
    {}
    if((micros()-start) > 50000)
    {
      for (int k = i + 1; k < samples; k++)
      {
        Serial.print(k);
        Serial.print(":");
        Serial.print((int)ms[k]);
        Serial.print(":");
        Serial.println((values[k]?"true":"false"));
      }
      for (int k = 0; k <= i; k++)
      {
        Serial.print(k);
        Serial.print(":");
        Serial.print((int)ms[k]);
        Serial.print(":");
        Serial.println((values[k]?"true":"false"));
      }
      break;
    }
  }
  digitalWrite(13, LOW);
  delay(1000);
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(10000);
}

After you manage to isolate one packet, take 2 consecutive readings with just one unit (in the least significant digit) difference in temperature or humidity. If your streams have one difference you don't have CRC, if you have 2 or mode differences you might have something like 011+1=100 or CRC or both. Here you need some luck.

After some hours of reverse engineering I come with the following code:
Code:
#define nobits 36
#define initialstring "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#define syncmin 6400
#define syncmax 9600
#define separatormin 256
#define separatormax 384
#define lowmin 768
#define lowmax 1152
#define highmin 1536
#define highmax 2304
#define baudspeed 115200
#define receiverpin 2
#define ledpin 13
#define sensorid "10001000"
#define rflisteninterval 50
float temperature = 0;
int humidity = 0;
unsigned long lastReadMills = 0;
boolean lowBatt = false;
boolean requestedTransmission = false;
boolean invalidTransmission = false;
String lastReceivedCode = "";

void setup() {               
  pinMode(ledpin, OUTPUT);     
  pinMode(receiverpin, INPUT);
  digitalWrite(receiverpin, HIGH);
  Serial.begin(baudspeed);
}

void loop()
{
  if(RFListened())
  {
    //other processing
  }
}
boolean RFListened()
{
  if(((millis()-lastReadMills)/1000>rflisteninterval)||(millis()<lastReadMills))
  {
    GetWeatherData();
    if((millis()==lastReadMills)&&(lastReadMills!=0))
    {
        if (lowBatt) Serial.print("Battery low; ");
        if (requestedTransmission) Serial.print("Requested transmission; ");
        if (invalidTransmission)
        {
          Serial.println("Non temperature/humidity data; ");
          return false;
        }
        else
        {
          Serial.print(lastReadMills/1000);
          Serial.print("s; ");
          Serial.print(temperature);
          Serial.print("C; ");
          Serial.print(humidity);
          Serial.println("%");
          return true;
        }
    }
    return false;
  }
  else
  {
    return true;
  }
}

void GetWeatherData()
{
  String receivedCode = ReceiveCode();
  if (receivedCode!="")
  {
    if (receivedCode==lastReceivedCode)
    {
      lowBatt = (receivedCode.charAt(8)=='1');
      requestedTransmission = (receivedCode.charAt(11)=='1');
      invalidTransmission = !((receivedCode.charAt(9)=='0')||(receivedCode.charAt(10)=='0'));
      if (!invalidTransmission)
      {
        temperature = (receivedCode.charAt(24)=='1'?1:0)*2048 +
          (receivedCode.charAt(25)=='1'?1:0)*1024 +
          (receivedCode.charAt(26)=='1'?1:0)*512 +
          (receivedCode.charAt(27)=='1'?1:0)*256 +
          (receivedCode.charAt(28)=='1'?1:0)*128 +
          (receivedCode.charAt(29)=='1'?1:0)*64 +
          (receivedCode.charAt(30)=='1'?1:0)*32 +
          (receivedCode.charAt(31)=='1'?1:0)*16 +
          (receivedCode.charAt(32)=='1'?1:0)*8 +
          (receivedCode.charAt(33)=='1'?1:0)*4 +
          (receivedCode.charAt(34)=='1'?1:0)*2 +
          (receivedCode.charAt(35)=='1'?1:0);
         temperature = temperature /10;
         humidity = (receivedCode.charAt(16)=='1'?1:0)*128 +
           (receivedCode.charAt(17)=='1'?1:0)*64 +
           (receivedCode.charAt(18)=='1'?1:0)*32 +
           (receivedCode.charAt(19)=='1'?1:0)*16 +
           (receivedCode.charAt(20)=='1'?1:0)*8 +
           (receivedCode.charAt(21)=='1'?1:0)*4 +
           (receivedCode.charAt(22)=='1'?1:0)*2 +
           (receivedCode.charAt(23)=='1'?1:0);
         lastReadMills = millis();
      }
    }
    else
      lastReceivedCode = receivedCode;
  }
}

String ReceiveCode()
{
  String receivedCode = initialstring;
  long startMicros = micros(), endMicros;
  if (digitalRead(receiverpin)) return "";
  while(!digitalRead(receiverpin))
  {
    if ((micros()-startMicros)>syncmax)
      return "";
  }
  if ((micros()-startMicros)<syncmin)
    return "";
  startMicros = micros();
  while(digitalRead(receiverpin))
  {
    if ((micros()-startMicros)>separatormax)
      return "";
  }
  if ((micros()-startMicros)<separatormin)
    return "";
  for(int i = 0; i < nobits; i++)
  {
    startMicros = micros();   
    while(!digitalRead(receiverpin))
    {
      if ((micros()-startMicros)>highmax)
        return receivedCode;
    }
    endMicros = micros();
    if(((endMicros-startMicros)>lowmin)&&((endMicros-startMicros)<lowmax))
      receivedCode.setCharAt(i,'0');
    else
      if(((endMicros-startMicros)>highmin)&&((endMicros-startMicros)<highmax))
        receivedCode.setCharAt(i,'1');
      else
        return "";
    startMicros = micros();
    while(digitalRead(receiverpin))
    {
      if ((micros()-startMicros)>separatormax)
        return "";
    }
    if ((micros()-startMicros)<separatormin)
      return "";
  }
  //Serial.println(receivedCode);
  if (receivedCode.substring(0,8)==sensorid)
    return receivedCode;
  else
    return "";
}
This will not fit your sensor since, as I see in the image it has a configurable channel. Mine has a random signature generated at power on.
6  Topics / Home Automation and Networked Objects / Re: Looking for ideas on Heat Pump Controller - Power/WIFI on: December 13, 2012, 07:58:06 am
You can stick the IR emitter right in front of the receiver window of your internal unit. This unit must have some power wires and you can attach you arduino to them.

For in-house wireless communication I vote for rfm12b, a transceiver that can send back acknowledgments. It's available in several frequencies.

Regards,
Adi
7  Topics / Home Automation and Networked Objects / Re: Solved: LG air conditioning codes on: September 27, 2012, 11:51:50 am
Hi,

Below is the test program and a library I wrote in january.
I did my best to make it as clear as possible.

Regards,
Adi

Code:
#include <LG.h>
#include <IRremote.h>

// the LG code generator object

// the IR emitter object
IRsend irsend;

void setup()
{
Serial.begin(9600);
Serial.println("Start");


// wait 5 seconds
//delay(5000);
//LG LG(mode_heating,fan_4,30,state_on);
//LG LG(mode_heating,fan_4,30,state_off);
LG LG(mode_cooling,fan_1,18 ,state_on);


LG.debug();
// change the state
//LG.setState(STATE_off);
// send the code

irsend.sendRaw(LG.codes,LG_buffer_size,38);
//
Serial.println("End");



// wait 10 seconds
//delay(10000);

// change the state
//LG.setState(STATE_on);
// send the code
//irsend.sendRaw(LG.codes,LG_buffer_size,38);
}

void loop() {}

LG.h
Code:
#ifndef LG_h
#define LG_h
#include <WProgram.h>

#define first_byte 136 //b10001000

#define state_on 0
#define state_off 24 //b11000
#define state_change_mode 1

#define mode_heating 4 //b100
#define mode_auto 3 //b011
#define mode_dehuidification 1 //b001
#define mode_cooling 0
#define mode_none 0

#define temperature_offset 15

#define fan_1 1
#define fan_2 0
#define fan_3 2
#define fan_4 4 //b100
#define fan_none 5 //b101

#define first_high 8271
#define first_low 4298
#define zero_and_one_high 439
#define zero_low 647
#define one_low 1709

#define LG_buffer_size 59

class LG
{
public:
// fields
unsigned int codes[LG_buffer_size];
// methods
// setter
LG(int _mode,
int _fan,
int _temperature,
int _state);
// getter
// debugging
void debug();
private:
// fields
byte crc;
// methods
void FillBuffer(byte _pos, byte _bit, byte _value);
};

#endif;
LG.cpp
Code:
#include "LG.h"
LG::LG(int _mode,
int _fan,
int _temperature,
int _state)
{
// set sync
codes[0] = first_high;
codes[1] = first_low;
crc = 0;
FillBuffer(0,8,first_byte);
FillBuffer(8,5,_state);
if(_state==state_off)
FillBuffer(13,3,mode_none);
else
FillBuffer(13,3,_mode);
if(_state==state_off)
FillBuffer(16,4,0);
else
FillBuffer(16,4,(byte)_temperature-temperature_offset);
FillBuffer(20,1,0); //jet
if(_state==state_off)
FillBuffer(21,3,fan_none);
else
FillBuffer(21,3,_fan);
FillBuffer(24,4,crc);
codes[LG_buffer_size-1] = zero_and_one_high;
}

void LG::FillBuffer(byte _pos, byte _bits, byte _value){
for (int i=_bits;i>0;i--){
codes[2+2*(_pos+_bits-i)] = zero_and_one_high;
codes[2+2*(_pos+_bits-i)+1] = (bitRead(_value,i-1)==1?one_low:zero_low);
if(bitRead(_value,i-1)==1){
byte bitset = 0;
bitSet(bitset,(128+i-_pos-_bits-1)%4);
crc = crc + bitset;
}
}
}
void LG::debug()
{
for(byte i=0;i<LG_buffer_size;i++){
Serial.print(codes[i],DEC);
Serial.print(",");
}
}
8  Topics / Home Automation and Networked Objects / Re: Timer help by not using delay() in a function on: August 16, 2012, 06:16:28 am
You can use timealarm library (there is a post on the old forum http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1263305457):

Alarm.timerOnce(10, OnceOnly);       // called once after 10 seconds


Make sure you call

Alarm.delay(x)

in each loop() execution
9  Using Arduino / Networking, Protocols, and Devices / Re: S-Remote Control on: March 20, 2012, 03:19:25 am
Cool application. I see some usability in home automation.
What are the hardware and software requirements on arduino site?
10  Using Arduino / Project Guidance / Re: Multi-room Wireless Temperature Sensors on: January 25, 2012, 01:17:24 pm
I have a wireless sensors network made of weather station sensors and the cost is 2.5€ per sensor. It's not cheap considering the effort I spend to decode them
11  Using Arduino / General Electronics / Re: Thermostat Relay Feedback Problem on: January 24, 2012, 05:54:49 am
IAnother new development: When I was looking at the new capacitors I had the arduino thermostat on but not plugged into the heater. The old thermostat kicked the heater on, and when the igniters fired the lcd went garbled. So, its happening with the arduino not even plugged into the heater. Could there be enough emi from the igniters to interfere with the arduino across the room? If so, what should I be looking at for sheilding?
Make sure your heater is properly shielded (the coil and the igniter).
You may try to connect the heater ground to AC ground.
12  Using Arduino / General Electronics / Re: Yet Another Relay Question on: January 22, 2012, 04:09:29 am
Better safe than sorry: use a transistor. Your relay will not feel the difference.
The standard schematic is : http://arduino.cc/playground/uploads/Main/relays.pdf
Make sure you have the protection diode.
13  Topics / Education and Teaching / Re: Which Arduino is best to start with? on: January 22, 2012, 04:05:05 am
I think Uno is the best choice for you.

If you have electronics skills you can try to build your own severino (http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided30); just make sure:
- you can produce the PCB,
- you can buy the programmed atmega (with the bootloader) and
- you can program it over serial (your computer has serials or you have a usb to serial converter)

As for tutorials you can check:
http://www.ladyada.net/learn/arduino/index.html
14  Using Arduino / General Electronics / Re: Long distance IR transmitter on: January 21, 2012, 12:15:34 pm
The lowest value I used for this resistor is 100 ohm. If the result are not satisfactory add a transistor and several ir leds in parallel.
Another approach is to look for IR leds with more focus.
15  Using Arduino / General Electronics / Re: Analog or Digital Temperature measurement on: January 21, 2012, 04:17:22 am
I would choose DS18B20 due to the hardware simplicity that will payback.
Pages: [1] 2 3 4