Best posts made by RJ_Make

This is another very simple "Wash Cycle Completed" sensor. It's design uses the same Optocoupler sensing design I used in the Kiddie Smoke Detector project. The only difference is that I'm using 1 AC to DC transformer, and a boost module to boost the washer speaker power to fire the Optocoupler.

Highlights:
Use the Washers .5vdc Signal Piezo to interface with the Pro-Mini. The voltage to the Piezo is to low to drive the Optocoupler so I had to use a boost module to boost the voltage to the Optocoupler. I'm not sure what the long term effect will be on washers control board Piezo drive circuit, so I will follow up if I encounter a problem.

Again Uses the same sketch as the Kiddie Smoke Project, with the only change being to CYCLE_INTERVAL (For my dryer 3 works well)

Sketch:

// Based on Author: Patrick 'Anticimex' Fallberg Interrupt driven binary switch example with dual interrupts
#include <MySensor.h>
#include <SPI.h>
#define SKETCH_NAME "Washer End Cycle"
#define SKETCH_MAJOR_VER "1"
#define SKETCH_MINOR_VER "1"
#define CHILD_ID 3
#define SIREN_SENSE_PIN 3 // Arduino Digital I/O pin for optocoupler for siren
unsigned int SLEEP_TIME = 32400; // Sleep time between reads (in seconds) 32400 = 9hrs?
long CYCLE_COUNTER = 3; // This is the number of times we want the Audio Counter to reach before triggering a signal to controller.
unsigned long CYCLE_INTERVAL = 3; // How long do we want to watch once first detected (in seconds)
//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
unsigned long CYCLE_RATE = 90; // How fast do we want to move checking the Pin state in the Status Check (in Millis) Adjust for your smoke detector
//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
unsigned long CYCLE_TIME_OKSTATUS = 8; // How long do we want to watch for "all clear" once we have confirmed an Alarm (in seconds)
unsigned long CYCLE_RATE_OKSTATUS = 500; // How fast do we want to move checking the Pin state when checking for an OK status (in Millis)
int oldValue=1;
int value=0;
MySensor sensor_node;
MyMessage msg(CHILD_ID, V_TRIPPED);
void setup()
{
sensor_node.begin();
// Setup the Siren Pin HIGH
pinMode(SIREN_SENSE_PIN, INPUT_PULLUP);
// Send the sketch version information to the gateway and Controller
sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
sensor_node.present(CHILD_ID, S_SMOKE);
//Send the state -- Always send Alarm state on power up.
sensor_node.send(msg.setSensor(CHILD_ID).set("1"), true);
}
// Loop will iterate on changes on the BUTTON_PINs
void loop()
{
// Check to see if we have a alarm. I always want to check even if we are coming out of sleep for heartbeat.
AlarmStatus();
// Sleep until we get a audio power hit on the optocoupler or 9hrs
sensor_node.sleep(SIREN_SENSE_PIN-2,FALLING, SLEEP_TIME * 1000UL);
}
void AlarmStatus()
{
// We will check the status now, this could be called by an interrupt or heartbeat
int siren_audio_count =0;
long cycle_time =0;
unsigned long startedAt = millis();
Serial.println("Status Check");
//Read the Pin
value = digitalRead(SIREN_SENSE_PIN);
// If Pin return a 0 (LOW), then we have a Alarm Condition
if (value != 1) {
//We are only going to check for status for CYCLE_INTERVAL time I think this should help stabilize Siren Sensing
while(millis() - startedAt < CYCLE_INTERVAL * 1000)
{
//We are going to check CYCLE_RATE fast
if(millis() - cycle_time > CYCLE_RATE ) {
// save the last time you Checked
cycle_time = millis();
//We will count each time SIREN_SENSE_PIN is 0 (Alarm - LOW) for the above time and at the above rate.
value = digitalRead(SIREN_SENSE_PIN);
if (value != 1)
{
siren_audio_count++;
Serial.print("Audio Count: ");
Serial.println(siren_audio_count);
}
}
}
// Eval siren audio hit count against our limit. If we are => then CYCLE_COUNTER then lets start a loop for "All Clear" reset
// If we continue to return an audio power hit, then we will continue to send to the controller.
if (siren_audio_count>=CYCLE_COUNTER)
{
Serial.println("Alarm Detected");
do
{
//update gateway with bad news.
//sensor_node.send(msg.set("1"));
sensor_node.send(msg.setSensor(CHILD_ID).set("1"), true);
Serial.println("Alarm Detected Sent to gateway");
} while (IsAlarmAllClear()!=1);
}
}
//Pin returned a 1 (High) so there is no alarm.
else
{
IsAlarmAllClear();
}
}
int IsAlarmAllClear()
// We are looking for an gap in time that we no longer see an audio power hit to the optocoupler.
{
int alarmOn =0;
long cycle_time =0;
unsigned long startedAt = millis();
//We are only going to check for status for CYCLE_TIME_OKSTATUS time
while(millis() - startedAt < CYCLE_TIME_OKSTATUS * 1000)
{
//We are going to check CYCLE_RATE_OKSTATUS fast
if(millis() - cycle_time > CYCLE_RATE_OKSTATUS) {
// save the last time you Checked
cycle_time = millis();
int value = digitalRead(SIREN_SENSE_PIN);
if (value != 1) //We are still in an alarm state
{
alarmOn++;
}
}
}
if (alarmOn < 1)
{
// We don't have any sign that we are still in an alarm status
//Send all clear msg to controller
//sensor_node.send(msg.set("0"));
sensor_node.send(msg.setSensor(CHILD_ID).set("0"), true);
// Used to update the node - NOT used for battery check.
sensor_node.sendBatteryLevel(random(1, 100) );
Serial.println("All Clear");
return 1;
}
else
{
// We are still in an alarm status
//The calling function will handle sending NOT CLEAR to controller
Serial.println("NOT CLEAR");
return 0;
}

Hardware wise this project is VERY easy to complete. The hardest part was arranging the hardware to fit in the case. The sketch on the other hand was a pain in my butt and I'm sure it's VERY inefficient, but does seem to work without ANY false alarms.

Detect when the siren is powered up and transmit that "trip" to Vera (for various processes)

Use interrupt to start Arduino with a 9 hour "heart beat".

Utilize the detectors battery power.

Because this detector has on-board battery level checks and warnings, I don't have to mess around with building a battery circuit.

BOM:

Pro Mini

I'm using Optocoupler for the speaker power isolation (you could probably just sense the 3.3v speaker voltage directly).

Kidde Detector Used (any can be used providing you have the space inside)

Here is the sketch:

// Based on Author: Patrick 'Anticimex' Fallberg Interrupt driven binary switch example with dual interrupts
#include <MySensor.h>
#include <SPI.h>
#define SKETCH_NAME "Smoke Alarm Sensor"
#define SKETCH_MAJOR_VER "1"
#define SKETCH_MINOR_VER "0"
#define CHILD_ID 3
#define SIREN_SENSE_PIN 3 // Arduino Digital I/O pin for optocoupler for siren
unsigned int SLEEP_TIME = 32400; // Sleep time between reads (in seconds) 32400 = 9hrs?
long CYCLE_COUNTER = 3; // This is the number of times we want the Audio Counter to reach before triggering a signal to controller.
unsigned long CYCLE_INTERVAL = 9; // How long do we want to watch once first detected (in seconds)
//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
unsigned long CYCLE_RATE = 90; // How fast do we want to move checking the Pin state in the Status Check (in Millis) Adjust for your smoke detector
//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
unsigned long CYCLE_TIME_OKSTATUS = 8; // How long do we want to watch for "all clear" once we have confirmed an Alarm (in seconds)
unsigned long CYCLE_RATE_OKSTATUS = 500; // How fast do we want to move checking the Pin state when checking for an OK status (in Millis)
int oldValue=1;
int value=0;
MySensor sensor_node;
MyMessage msg(CHILD_ID, V_TRIPPED);
void setup()
{
sensor_node.begin();
// Setup the Siren Pin HIGH
pinMode(SIREN_SENSE_PIN, INPUT_PULLUP);
// Send the sketch version information to the gateway and Controller
sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
sensor_node.present(CHILD_ID, S_SMOKE);
}
// Loop will iterate on changes on the BUTTON_PINs
void loop()
{
// Check to see if we have a alarm. I always want to check even if we are coming out of sleep for heartbeat.
AlarmStatus();
// Sleep until we get a audio power hit on the optocoupler or 9hrs
sensor_node.sleep(SIREN_SENSE_PIN-2,FALLING, SLEEP_TIME * 1000UL);
}
void AlarmStatus()
{
// We will check the status now, this could be called by an interrupt or heartbeat
int siren_audio_count =0;
long cycle_time =0;
unsigned long startedAt = millis();
Serial.println("Status Check");
//Read the Pin
value = digitalRead(SIREN_SENSE_PIN);
// If Pin return a 0 (LOW), then we have a Alarm Condition
if (value != 1) {
//We are only going to check for status for CYCLE_INTERVAL time I think this should help stabilize Siren Sensing
while(millis() - startedAt < CYCLE_INTERVAL * 1000)
{
//We are going to check CYCLE_RATE fast
if(millis() - cycle_time > CYCLE_RATE ) {
// save the last time you Checked
cycle_time = millis();
//We will count each time SIREN_SENSE_PIN is 0 (Alarm - LOW) for the above time and at the above rate.
value = digitalRead(SIREN_SENSE_PIN);
if (value != 1)
{
siren_audio_count++;
Serial.print("Audio Count: ");
Serial.println(siren_audio_count);
}
}
}
// Eval siren audio hit count against our limit. If we are => then CYCLE_COUNTER then lets start a loop for "All Clear" reset
// If we continue to return an audio power hit, then we will continue to send to the controller.
if (siren_audio_count>=CYCLE_COUNTER)
{
Serial.println("Alarm Detected");
do
{
//update gateway with bad news.
sensor_node.send(msg.set("1"));
Serial.println("Alarm Detected Sent to gateway");
} while (IsAlarmAllClear()!=1);
}
}
//Pin returned a 1 (High) so there is no alarm.
else
{
IsAlarmAllClear();
}
}
int IsAlarmAllClear()
// We are looking for an gap in time that we no longer see an audio power hit to the optocoupler.
{
int alarmOn =0;
long cycle_time =0;
unsigned long startedAt = millis();
//We are only going to check for status for CYCLE_TIME_OKSTATUS time
while(millis() - startedAt < CYCLE_TIME_OKSTATUS * 1000)
{
//We are going to check CYCLE_RATE_OKSTATUS fast
if(millis() - cycle_time > CYCLE_RATE_OKSTATUS) {
// save the last time you Checked
cycle_time = millis();
int value = digitalRead(SIREN_SENSE_PIN);
if (value != 1) //We are still in an alarm state
{
alarmOn++;
}
}
}
if (alarmOn < 1)
{
// We don't have any sign that we are still in an alarm status
//Send all clear msg to controller
sensor_node.send(msg.set("0"));
Serial.println("All Clear");
return 1;
}
else
{
// We are still in an alarm status
//The calling function will handle sending NOT CLEAR to controller
Serial.println("NOT CLEAR");
return 0;
}
}

Ok;.... so I received my oven kit from Peter Monday, and built it up yesterday.. I still have to work out the coding for the auto door opening and 2nd lower thermocouple (I think that one will be much later), but here is the hardware setup..

There were only 2 items on this build that were somewhat difficult.. The most difficult by leaps and bounds is installing the gold reflective tape. It's was a nightmare, and if I every build a 2nd one I will completely dismantle the toaster and apply the tape with the elements and element guards out of the way next time... The 2nd item was the ControLeo's mounting box, I think reversing the mounting (mount board to front panel) of the PCB would make it much easier. I do however understand that having custom enclosures would probably add too much to the cost..

I wind up over building everything, so some of the stuff I did is probably not necessary... For instance, I forgot to get some pictures, but I insulated the entire outer jacket with this stuff.. It added expense, but wow, the differences in temps from where that stuff is, and where it's not is amazing..

Removed oven jacket and feet and swap the upper and lower elements. (Take your time, the elements and spot welds are very fragile) While the jacket is off, I Insulated it. (Optional)

Removed all unnecessary wiring (I choose to keep the thermostat and switches in the circuit for some over temp protection)

Drilled a 3mm hole in front and rear of oven for door opener.

Built mount and install the door servo.

Installed Insulation on component wall. I was able to get this in there pretty tight, so I only had to use two rivets at the very top (not seen in this pic)

Fitted the aluminum that comes in ControLeo's 2 oven kit to "hang" off the top of the cavity seam. I also installed the SSR's, DC to DC converter. I Also cut out and installed power supply and cooling fan (air entering control space)

Very Important!

I drilled 5 more holes. (3) 3/8" (two for ControLeo2 Case and one underneath oven rear wall spacer) and the other 2 were for the sensors, upper and lower rear of oven cavity.

Fished all wire through lower grommet and loom. (it was VERY tight, but it all fit)

Here is a picture with everything installed. (The bracket is mounted underneath the oven cavity seem (in the pic it looks like it's on top, but it's not))

The ControLeo2 all wired up with 2nd thermocouple breakout board and servo connection. (2 sided foam tape worked well for mounting the breakout board onto the ControLeo2 board.

Installed interior Gold tape and Insulation. (Man this was the hardest part of this entire build..... )

And the completed oven....

I'm sure I missed something but I hope you found this interesting...

Until next time......

Updated: Forgot to show the use of the left-over high temp. connection covers on elements behind SSR bracket.

This is a very simple "Dry Cycle Completed" sensor. It's designed uses the same Optocoupler sensing design I used in the Kiddie Smoke Detector project. The only difference is that I'm using 2 AC to DC transformers. One to power the the Pro Mini, and the other to sense cycle completion.

Use the Dryer 120v Signal buzzer to interface with the Pro-Mini. Simply power the 2nd (sense) AC to DC transformer with the signal buzzer, and use the 5vdc output to activate the optocoupler. (I'm sure you can probably just read the raw 5vdc, but I have 60 of these opto's so I wanted to use one.. )

Uses the same sketch as the Kiddie Smoke Project, with the only change being to CYCLE_INTERVAL (For my dryer 3 works well)

Sketch:

// Based on Author: Patrick 'Anticimex' Fallberg Interrupt driven binary switch example with dual interrupts
#include <MySensor.h>
#include <SPI.h>
#define SKETCH_NAME "Dryer End Cycle"
#define SKETCH_MAJOR_VER "1"
#define SKETCH_MINOR_VER "1"
#define CHILD_ID 3
#define SIREN_SENSE_PIN 3 // Arduino Digital I/O pin for optocoupler for siren
unsigned int SLEEP_TIME = 32400; // Sleep time between reads (in seconds) 32400 = 9hrs?
long CYCLE_COUNTER = 3; // This is the number of times we want the Audio Counter to reach before triggering a signal to controller.
unsigned long CYCLE_INTERVAL = 3; // How long do we want to watch once first detected (in seconds)
//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
unsigned long CYCLE_RATE = 90; // How fast do we want to move checking the Pin state in the Status Check (in Millis) Adjust for your smoke detector
//Adjust for your smoke detector, you want to pick up the siren signal at least 3 time to help stop false alarms.
unsigned long CYCLE_TIME_OKSTATUS = 8; // How long do we want to watch for "all clear" once we have confirmed an Alarm (in seconds)
unsigned long CYCLE_RATE_OKSTATUS = 500; // How fast do we want to move checking the Pin state when checking for an OK status (in Millis)
int oldValue=1;
int value=0;
MySensor sensor_node;
MyMessage msg(CHILD_ID, V_TRIPPED);
void setup()
{
sensor_node.begin();
// Setup the Siren Pin HIGH
pinMode(SIREN_SENSE_PIN, INPUT_PULLUP);
// Send the sketch version information to the gateway and Controller
sensor_node.sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER"."SKETCH_MINOR_VER);
sensor_node.present(CHILD_ID, S_SMOKE);
//Send the state -- Always send Alarm state on power up.
sensor_node.send(msg.setSensor(CHILD_ID).set("1"), true);
}
// Loop will iterate on changes on the BUTTON_PINs
void loop()
{
// Check to see if we have a alarm. I always want to check even if we are coming out of sleep for heartbeat.
AlarmStatus();
// Sleep until we get a audio power hit on the optocoupler or 9hrs
sensor_node.sleep(SIREN_SENSE_PIN-2,FALLING, SLEEP_TIME * 1000UL);
}
void AlarmStatus()
{
// We will check the status now, this could be called by an interrupt or heartbeat
int siren_audio_count =0;
long cycle_time =0;
unsigned long startedAt = millis();
Serial.println("Status Check");
//Read the Pin
value = digitalRead(SIREN_SENSE_PIN);
// If Pin return a 0 (LOW), then we have a Alarm Condition
if (value != 1) {
//We are only going to check for status for CYCLE_INTERVAL time I think this should help stabilize Siren Sensing
while(millis() - startedAt < CYCLE_INTERVAL * 1000)
{
//We are going to check CYCLE_RATE fast
if(millis() - cycle_time > CYCLE_RATE ) {
// save the last time you Checked
cycle_time = millis();
//We will count each time SIREN_SENSE_PIN is 0 (Alarm - LOW) for the above time and at the above rate.
value = digitalRead(SIREN_SENSE_PIN);
if (value != 1)
{
siren_audio_count++;
Serial.print("Audio Count: ");
Serial.println(siren_audio_count);
}
}
}
// Eval siren audio hit count against our limit. If we are => then CYCLE_COUNTER then lets start a loop for "All Clear" reset
// If we continue to return an audio power hit, then we will continue to send to the controller.
if (siren_audio_count>=CYCLE_COUNTER)
{
Serial.println("Alarm Detected");
do
{
//update gateway with bad news.
//sensor_node.send(msg.set("1"));
sensor_node.send(msg.setSensor(CHILD_ID).set("1"), true);
Serial.println("Alarm Detected Sent to gateway");
} while (IsAlarmAllClear()!=1);
}
}
//Pin returned a 1 (High) so there is no alarm.
else
{
IsAlarmAllClear();
}
}
int IsAlarmAllClear()
// We are looking for an gap in time that we no longer see an audio power hit to the optocoupler.
{
int alarmOn =0;
long cycle_time =0;
unsigned long startedAt = millis();
//We are only going to check for status for CYCLE_TIME_OKSTATUS time
while(millis() - startedAt < CYCLE_TIME_OKSTATUS * 1000)
{
//We are going to check CYCLE_RATE_OKSTATUS fast
if(millis() - cycle_time > CYCLE_RATE_OKSTATUS) {
// save the last time you Checked
cycle_time = millis();
int value = digitalRead(SIREN_SENSE_PIN);
if (value != 1) //We are still in an alarm state
{
alarmOn++;
}
}
}
if (alarmOn < 1)
{
// We don't have any sign that we are still in an alarm status
//Send all clear msg to controller
//sensor_node.send(msg.set("0"));
sensor_node.send(msg.setSensor(CHILD_ID).set("0"), true);
// Used to update the node - NOT used for battery check.
sensor_node.sendBatteryLevel(random(1, 100) );
Serial.println("All Clear");
return 1;
}
else
{
// We are still in an alarm status
//The calling function will handle sending NOT CLEAR to controller
Serial.println("NOT CLEAR");
return 0;
}

Most here have seen me whine about wanting a 3D printer, well those days are gone. I got a FlashForge Creator Pro, which after making some repairs due to shipping damage, works quite well, at least with my test prints...

That said, one very annoying issue with the printer is that the on/off switch is located in the back, which makes it a bit of a pain to get to. So I thought, I should "MySensor" this puppy....

So before I really get into printing off really "useful stuff", I wanted to place a small HD camera inside the printer, and allow for remote and local power on/off and viewing.

I did all this kinda fast so the workmanship isn't up to my desire level, but......

The Printers power supply is fairly robust, so I didn't want to switch the 24vdc output to all the electronics (not too mention that leaves the PSU powered up all the time, and I didn't want that either). So I decided it would be best to switch the mains power to the PSU.

I Branched off the mains with a small 120vac to 5vdc transformer to power the Mini Rboard.

I mounted the camera's 12v 2a transformer inside the printers electronic compartment also. (the camera will only run if the unit is powered up)

I mounted the camera in on the back wall ( I will probably change this as I'm not satisfied with the viewing angle) and ran the line down through the left rear wire chase. Once inside the electrical compartment, I fed the Ethernet line out the back with the extruder cables and left the power line for the camera inside the electrical compartment.

I drilled a small hole underneath the control display in the middle, mounted the Rboard off a platform screw that was already present.

I mounted the power transformer for the Rboard with supper sticky double sided tape and also zip tied the wiring to a post. (I really should print an encloser for it but.....)

I also mounted the cameras power supply in the same manor.

From there it's just a matter of breaking down the wiring to the printers PSU and switching that and power to the camera....

The push button is connected to the A0 jumper set on the Rboard, and the only change in the standard relay with push button sketch was to change pin 3 to 14 (is the digital mapping to A0)

In another thread I asked about financially supporting the efforts for the board_development_site that Hek is working on, and it made me think why have I not done so for the MySensors project. I started looking around and what do I find, a Donation Link on the main page..

Not sure if others have noticed (I'm mainly in the forums) this but I thought I would bring it to everyone attention.

If we forget about all the hard work that goes into maintaining the site (which we should never ever do), the actual costs of just keeping the lights on has to be a fair chunk of money every day, month and year.

**So if you are like me and have benefited from this site why not make a small donation to help keep the lights on. I guarantee it will make you feel good **

Here is another completed project using MySensors. My current HVAC system is controlled by a Honeywell YTHX9421R5085WW/U Prestige IAQ control system which works great and has a boat load of options, but has one problem for me. The web access system does not allow control of the fresh air system remotely. It can only be control by the thermostat directly. So I decided that with MySensors I should be able to change that.

With this "mod" I'm able to remotely:

Activate the fresh air intake system (open a motorized damper, turn on the fresh air blower and the HVAC blower)

Detect when the thermostat is sending a fresh air signal. (This allows me to turn on exhaust blowers on the upper floor)

Lock out the thermostat from turning on the fresh air system. (used when humidity is too high)

Physically active the fresh air system.

Monitor the fresh air intake air temp (mixed air temp)

The project is very similar to my EH40 project, with a few exceptions.

So I've been wanting to build a Refrigeration Temp / Current logger for some time now, and I finally got around to it (spured by a post on another board). So while this is not a MySensors project, I thought it may help those who are thinking about doing something similar.

Just about all the information to build a temp / current logger is out there on the Internets so there's nothing terribly innovative about it.

Features:

Logs the following to an Adafruit SD Card Shield
3 DHT's (Temperature and Humidity)
1 Equipment Current
2 Light levels

Uses a settings.ini file to choose logging options.

Uses a fairly robust error function.

6.5 Second log rate (this is the fastest due to the DHT's)

Can log data indefinitely (Limited only by the size SD Card).

Core design can be used on both 125vac and 220vac equipment. (Internal Power Supply Allows for this)

CONTROL WIRE 26AWG. 4 CONDUCTORS. This is VERY important and I wound up going through several different wire types and sizes. You must not use anything larger then 26AWG, and It must be stranded. 26AWG stranded telephone cable should work very well, because it's somewhat flat and will help when passing it through the refrigerator door seals.

I am almost ready for a second prototype spin of the PCB, but before doing that I could use some input from the community,

If this board was going into "mass production", is there any features that I should consider adding? Any missing parts? Anything that you think that I have forgotten?

The schematics for revision 2 is a couple of posts back in the thread.

I have considered adding a ATSHA204 for future security purposes, but can't seem to find a suitable spot for it (maybe I'm just too tired to see things clearly at the moment :)).

I would work on trying to get the ATSHA204 included, even if it means the dims get a little larger. The one thing that I really don't like about MySensors is the lack of any wireless security.. Would love to see this implemented.

With all these SMT boards being offered, I decided to build a Reflow Oven, and in my research I ran across the ControLeo on Ebay, Contacted the designer and discovered that he has a ControLeo2 coming out on Kicker-starter..

You really don't need to build anymore if you are using those detectors through out the house (and they are setup interlocked), as once one goes off, they all go off and will signal to your controller that there is trouble.