Pages: [1]   Go Down
Author Topic: Home Lighting Automation System (ALDI AUS Switches)  (Read 3227 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have designed an Automatic Light Control system for my home. Basically the system is capable of the following :-

- RF control of up to XX (Currently 20) remote sockets which turn ON/OFF lamps throughout my home.
- Timer function for (12) only of the zones above. (Allows me to walk into a room and lights come on automatically and turn of via timer)
- Wireless (433Mhz) PIR Triggering of 12 of the zones above.
- Wireless smoke detectors.
- Control via HTML GET (kind of JSON response) of all features.
- PUSH notification (PIR's kind of pseudo alarm system / Smoke Detectors) to PROWL on iPhone
- MACROS or Scenes (e.g Night Mode, Sleep Mode, Away Mode etc)
- Wireless doorbell integration ( With PUSH Notification and entry light with delay)
- Debug mode.
- Beginnings of Clock related functions (Very Basic) that need to be expanded including Holiday Mode etc

Everything above works perfectly and I have been using it for some time at home, but this is the first time Iv written and code and I know my code could be optimised. I would like to collaborate with a few people who know how to code better than me (almost anyone  smiley-yell) and work together to add more features. I'm not interested it giving it to hundreds of people. I prefer to give it to just a few and together have a master plan that we work on.

Is anyone interested? If so lets start a conversation here and get started. You'll laugh at my code but that's OK. It works and can only get better and to be honest Im learning as I go.

Libraries used are :-

<RCSwitch.h>
<Avviso.h>
<RTClib.h>
<RTC_DS3234.h>

Thanks

Kman
« Last Edit: September 24, 2013, 03:26:25 am by KmanOz » Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What sort of clock functionality are you looking for? I too am new at Arduino but have an extensive Delphi coding background. I have just built some date and time functionality for my home automation system - 1,000 lines of C (the whole application) and now upgrading to a mega processor with 256K of flash memory.
Logged

Australia Mate!
Offline Offline
Sr. Member
****
Karma: 2
Posts: 269
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm in and out, slowly adding to a complete home automation project.
Instead of using the common arduino c++ language, i have opted to write the entire (or most) of the project in C , so i am mainly learning slowly what all or most of the registers for a particular avr do & how to manipulate them.

The thing i still have trouble with & is the most notoriously challenging is bit-wise math.

I have a solar hot water project, that initially touched 5% on using registers directly, the final code came to 11kb.
The code i now have is only 829bytes, with serial debugging, it weighs in at 3kb.

I recommend commenting as much as possible, and commenting out the original code & comment the new code, so when you look back, you can see why or how you came to a conclusion.

I chose to go this route, because some projects where getting above 30k in size or where taking too much ram, and where so hard to debug what was going wrong, even thought the ide reported no errors.

I do my best to look deeply into libraries, and try to follow / understand what the function does. I would rather be able to write the direct code than to always be dependent on somebody elses work, or trying to remember how to implement a feature.

Whereas a plethora of snippets, that are well commented, can be reused over and over.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd like to know how you set up the RF lights/sockets
I can help with the software
Logged

Cape Town
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Impossible is only a level of difficulty
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Kman,
I'm in the process of building a 220v light control system with RF2401 transceiver.
While I'm fairly new to the world of arduino, I've been programming for the past 30 years.

I'll gladly cooperate with you.

Drop me a pm.

Molahs.
« Last Edit: September 18, 2013, 04:50:17 pm by molahs » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@molahs, what are you using for light control?
@kmanoz, are you from Australia?
« Last Edit: September 19, 2013, 05:28:36 am by chrisb123 » Logged

Cape Town
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Impossible is only a level of difficulty
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@molahs, what are you using for light control?

The final unit will be ATTiny84, RF2401 with 5V to 220V solid state relay (unless I can find a better way to switch the 220V) and battery.

I have one Arduino Uno with Ethernet shield that hooks into my house network and acts as the bridge between computers/mobile devices in the house to the various relays. My idea is to eventually replace ALL existing light switches in the house, with some sort of touch switch.
Alternatively, I will build a circuit between the mechanical existing switch and the final unit to detect the switch position and either turn the lights on or off. I presume this will be a problem with lights that have multiple switches.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The final unit will be ATTiny84, RF2401 with 5V to 220V solid state relay (unless I can find a better way to switch the 220V) and battery.
I personally wouldn't bother unless there  was a retrofitable device that would replace the existing light switch. It should have a switch that I can manually press to turn the lights on and off and also responds to an RF signal to turn the lights on and off
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@molahs

OK I will work on commenting in the code so its pretty self explanatory and create a .zip. nd put a link up.

@chrisb123

Yep in Melbourne smiley

Also some more info.

As I said earlier, Im very new to Arduino and hence my coding and the procedures that I use are going to be primitive. Im sure there are so many other ways to compact/speed up my code so that's why Im asking for help / ideas smiley

Anyway I have designed this for use with ALDI (Australia) remote switches. These units do not have a adjustable code via a dip switch but rather learn a code based on the button pressed on the transmitter. It seems that each unique channel (4 on 1 remote) has 4 unique codes for ON and four codes for OFF so in total 8 codes per channel. The codes a sent out sequentially by the remote and the remote switch once programmed will respond to any of those 8 codes. It seems the manufacturers have done this for reliability because sometimes for whatever reason, a code that worked today may not work tomorrow depending on atmospheric conditions etc. In my app, I send all 4 codes for ON and all 4 for OFF for each channel. It takes a little longer but Iv found it's far more reliable.

I haven't been able to crack their protocol, so what I have done is effectively learnt the codes from 5 different remotes giving me a total of 20 remote sockets that I can control. I realized very early on that RCSwitch wasn't going to work so I had to modify it. The way I learnt the codes from my remotes was to pull the remote apart and find the pin that was pulsing the 433Mhz transmitter module. I then hard wired this directly to an Arduino pin and use the RCSwitch ReceiveDemo_Advanced (because it gives raw data and I was getting unknown code) to work out pulse timings/widths etc. I then added a MODE_3 section in RCSwitch which is the mode to transmit for my ALDI switches. I know that the mods Iv made to RCSwitch probably aren't the correct way to go about it as RCSwitch will only SEND my codes and not receive them. For the limited knowledge I had that was OK because everything I use to trigger the system (PIR's, Smoke Detectors and Door Bell buttons) were being received by RCSwitch OK as MODE_1, it just couldn't receive or send ALDI codes.

Im don't know if the protocol for the ALDI switches is used anywhere else in the world so Im not sure if the work Iv done is any good outside of Australia. My code could easily be modified to use any remote switch that RCSwitch.h supports with very little work.

Rather than make this closed, I'll post my code up here. I know Ill get flamed for my coding but what the heck it's my first attempt at coding and more importantly IT WORKS smiley-grin

Ill be back soon with a link smiley

Kman
« Last Edit: September 24, 2013, 05:26:15 am by KmanOz » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Melbourne here too

You posted back in July 2012 on whirlpool about this

OK So only RC sockets.
Logged

Sydney, Australia
Offline Offline
Sr. Member
****
Karma: 6
Posts: 395
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Melbourne here too

You posted back in July 2012 on whirlpool about this

OK So only RC sockets.

Sydney here and been using Arduino for about 6 months - migrated across from Picaxe processors.

I would guess that once you have the wall sockets mastered the next one to tackle would be the light switches on the wall - i like the look of the levolo switches and some of the guys on here have made good progress hacking into these.

Craig
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Errrrrr

To say Im slack would be an understatement. I haven't had a chance to comment the hell out of the code Iv developed but I thought I would get it up here anyway. I warn people this is bad code smiley but as I said, it works and has worked flawlessly for quite some time. If your going to use this to run ALDI switches you're going to need a modified RCSwitch.h which I modified. I haven't included it here because again, even though it works to a degree (only transmits ALDI, not receives), it's probably not the way to modify it correctly and Im trying to respect the original authors by not sending butchered versions of their work around. I can send it to you though  smiley-grin

Anyway as I said, this is the only code Iv ever written but with limited knowledge Im proud. The way I control the system is by using an iPhone/iPad app called iControl Web. It's simple but again just works.

In the rfBlaster () section, you could eliminate all the code and just use standard RCSwitch commands. Notice I send 4 different codes for ON and OFF. It's just the way the ALDI switches work. I could send just 1 of the 4 for ON and OFF but for reliability I send 4.

If anyone needs help just ask questions, Id be happy to help. Anyway, this was cheap, it works, and I learnt a lot. Hopefully if anyone uses and modifies this, they can give me a copy so I learn more smiley

Peter   smiley-grin

* ALC_v1_0.zip (12.67 KB - downloaded 23 times.)
Logged

Pages: [1]   Go Up
Jump to: