Voltage Logger - Alarm output

Costas.I

New Member
Please Help.

I try do to the following.

I have a voltage data logger , where:

1. On Lowvoltage alarm (According settings) the relative output sends a single pulse every 10 seconds.
2. On Highvoltage alarm (According settings) the some relative output (like above) sends a double every 10 seconds.

How to identify with the help of picaxe the Low or High alarm.
I want to drive a relay output.

Thank you

Costas.
 

premelec

Senior Member
Welcome to this forum - please give information as to what hardware you have - PICAXE chip type and set up? - Have you any experience with program writing? What you want to do is quite possible... Have you looked at PICAXE manuals on hardware interface and program commands?
 

Costas.I

New Member
Welcome to this forum - please give information as to what hardware you have - PICAXE chip type and set up? - Have you any experience with program writing? What you want to do is quite possible... Have you looked at PICAXE manuals on hardware interface and program commands?
Thank you for your interest.
I have picaxe 08M2,14M2,18M2.
I have the basic experiance with program writing.
I have aready use a voltage data logger with alarm outputs
as i described.I need to use that alarm outputs to control
some machines.

i hope to help you.
 

eggdweather

Senior Member
So you want to determine whether there is a single or double pulse occurring and then set an alarm output pin low for a single pulse and high for a double pulse - correct?
 

premelec

Senior Member
@Costas.I Is your question about how to control the machines from the PICAXE? If so please indicate what voltages and currents the machines run on. The alarm output can usually be used to control a relay which then controls the higher power to machines. The PICAXE cannot control high powers directly. Manual 3 deals with some of these issues.
 

Costas.I

New Member
So you want to determine whether there is a single or double pulse occurring and then set an alarm output pin low for a single pulse and high for a double pulse - correct?
Almost correct.

The voltage logger (see link EL-OEM-3 page 5 ALM1 from Lascar Electronics)
please see ALM1 sends the alarms as I decribed in first message.

If for eg. 2minutes the alarm is present (Undervoltage or Overvoltage , then
for undervoltage - single pulse- the pinX will be high
for overvoltage -double pulse- the pinX will be high.

Thank you.

http://www.lascarelectronics.com/pdf-usb-datalogging/data-logger0292936001311161006.pdf
 

BESQUEUT

Senior Member
@Costas.I Is your question about how to control the machines from the PICAXE? If so please indicate what voltages and currents the machines run on.
+1
A static relay can be directly connected to a Picaxe.

If for eg. 2minutes the alarm is present (Undervoltage or Overvoltage , then
for undervoltage - single pulse- the pinX will be high
for overvoltage -double pulse- the pinX will be high.
How long are each pulse ? What is the voltage ? Is there a common earth ?
 

eggdweather

Senior Member
The programme logic needs to deal with this: ALARM 1 and 2 show logging status when the hardware isn’t in an alarm condition. These are the alarm conditions:
ALM 1 single pulse (10 seconds) - The data logger is currently logging. Low alarm.
ALM 1 single pulse (20 seconds) - The data logger is currently logging. Low alarm. However, the battery is low and should be replaced before logging important data.
ALM 1 double pulse (10 seconds) - The data logger is currently logging. High alarm.
ALM 1 double pulse (20 seconds) - The data logger is currently logging. High alarm, but battery is low and needs replacing
ALM 1/ ALM 2 single pulse (20 seconds) - The data logger is full and has stopped logging. Alarm (high, low or both).
ALM 2 single pulse (10 seconds) - The data logger is currently logging. No alarm.
ALM 2 single pulse (20 seconds) - The data logger is currently logging. No alarm, but battery is low and needs replacing
ALM 2 single pulse (30 seconds) - The data logger is not currently logging, but is primed to start at a later date and time (delayed start).
ALM 2 double pulse (20 seconds) - The data logger is full and has stopped logging. No alarm

The ALARM output earth is common to the data logger supply.

The PICAXE needs to measure ALARM 1 output and when a pulse starts determine number of pulses within a 10-sec duration. One pulse means alarm LOW then indicate status via an LED or relay, two pulses means alarm HIGH then indicate status via LED or relay. PULSIN can't be used because of the long pulse out duration of the ALARM conditions, time measurement therefore needs to be accomplished under program control, something like: test input for transition, when a transition occurs maintain a duration and pulse count, wait 1-sec, then repeat, when the command time limit is reached e.g. 10-secs perform an action for ALARM to signal data logger status and so on.

Is that correct. You really do need to give an idea of what you wish to control when an alarm is detected, it may change the logic or design.
 

BESQUEUT

Senior Member
Read the Time special variable each time ALM1 or ALM2 change,
Keep in memory the Time for last two low to high and high to low transitions,
For each high to low transition, measure delta time for pulse length and pulse interval
==> select what is the current state
==> switch static relay is necessary

Is that enought or do you need a program sample ?
How long are each pulse ? What is the voltage ?
 
Last edited:

Costas.I

New Member
The programme logic needs to deal with this: ALARM 1 and 2 show logging status when the hardware isn’t in an alarm condition. These are the alarm conditions:
ALM 1 single pulse (10 seconds) - The data logger is currently logging. Low alarm.
ALM 1 single pulse (20 seconds) - The data logger is currently logging. Low alarm. However, the battery is low and should be replaced before logging important data.
ALM 1 double pulse (10 seconds) - The data logger is currently logging. High alarm.
ALM 1 double pulse (20 seconds) - The data logger is currently logging. High alarm, but battery is low and needs replacing
ALM 1/ ALM 2 single pulse (20 seconds) - The data logger is full and has stopped logging. Alarm (high, low or both).
ALM 2 single pulse (10 seconds) - The data logger is currently logging. No alarm.
ALM 2 single pulse (20 seconds) - The data logger is currently logging. No alarm, but battery is low and needs replacing
ALM 2 single pulse (30 seconds) - The data logger is not currently logging, but is primed to start at a later date and time (delayed start).
ALM 2 double pulse (20 seconds) - The data logger is full and has stopped logging. No alarm

The ALARM output earth is common to the data logger supply.

The PICAXE needs to measure ALARM 1 output and when a pulse starts determine number of pulses within a 10-sec duration. One pulse means alarm LOW then indicate status via an LED or relay, two pulses means alarm HIGH then indicate status via LED or relay. PULSIN can't be used because of the long pulse out duration of the ALARM conditions, time measurement therefore needs to be accomplished under program control, something like: test input for transition, when a transition occurs maintain a duration and pulse count, wait 1-sec, then repeat, when the command time limit is reached e.g. 10-secs perform an action for ALARM to signal data logger status and so on.

Is that correct. You really do need to give an idea of what you wish to control when an alarm is detected, it may change the logic or design.

Almost your very close to do it.
A detail is that: That logger sends a single pulse every 10 secs for Low alarm OR 2 double pulses every 10 secs. NOT a single pulse 10 secs duration.
The realy may drive a washing machine when the logger detects over/under voltage of 230VAC, to protect the electronics of that.
As you understand I dont like to stop the machine due to peak of voltage, but at a stationery condition of lets say a few minutes.


Thank you very much for your help.

Costas.
 

rossko57

Senior Member
You'll need some kind of relay driver to operate a relay heavy-duty enough for a washing machine. That is easy enough and explained in the Picaxe manual.

As you understand I dont like to stop the machine due to peak of voltage, but at a stationery condition of lets say a few minutes.
Don't really understand this? If the idea is to protect the machine, but doesn't act for a few minutes, it is probably not going to save things from damage.

If the idea is to avoid stopping the machine at some point in its cycle, say when the motor is running, then you would need some kind of feedback from the machine to say what it is doing?
 

Costas.I

New Member
You'll need some kind of relay driver to operate a relay heavy-duty enough for a washing machine. That is easy enough and explained in the Picaxe manual.


Don't really understand this? If the idea is to protect the machine, but doesn't act for a few minutes, it is probably not going to save things from damage.

If the idea is to avoid stopping the machine at some point in its cycle, say when the motor is running, then you would need some kind of feedback from the machine to say what it is doing?
Ok, I can manage the over/under voltage alarm through the software of logger. Dont worry about that I can manage it.

Thanks,
Costas.
 

tmfkam

Senior Member
It's possible to measure the incoming AC voltage, by proxy. Connect the output of a low voltage AC transformer to a (single diode) rectifier. Depending on the output of the transformer, reduce this with a voltage divider. This half wave signal can then be sampled by an ADC input a number of times with the peak reading being multiplied by a factor to give the AC supply.

Transformer secondary supply = 9V
Voltage divider = 3.18

AC Supply = 240V

9V / 3.18 = 2.83V
2.83V * 1.414 (RMS to Peak) = 4.00V (this means that you WILL need to protect the PicAxe input from the voltage possibly rising above 5V)

240V / 4.00V = 60

The ReadADC10 command gave me a value of ~800 (for an input of 4.00V) so my VoltsFactor was 30. The adjusted ADC value will be 240000, ideal for displaying with a decimal point, with a resolution of 300mV. The reason I don't simply multiply by 3 is that I wanted to cater for voltages of 240V, 220V and 120V, by multiplying the ADC value by 30, 28 or 15 allows this. Assuming a suitably rated transformer primary is connected, with a nominal AC secondary of 9V applied, the ADC value will remain at ~800 (for an input of 4.00V) multiplying this by 28=224V, by 15=120V. With the variable resistor in the divider, the 220V value can easily be adjusted. If I'd used 3 as my VoltsFactor, I'd have had to use more complex maths to compensate for being unable to use 2.8 and 1.5.

In practice, the voltage divider is made adjustable, so that the VoltsFactor is an exactly round figure. Something like a 10k (10 turn variable) in series with a 1k5 to ground, with the wiper of the 10k connected (through a 1k series resistor and diode to the 5V supply as protection) to the PicAxe ADC input. Starting with the wiper in the middle position and then fine tuned to suit. Naturally, I adjusted my units while measuring the supply with a voltmeter, you could always feed the voltage divider with a regulated 5V DC supply. This would give an input to the ADC of 1.57V (5V / 3.18 [No RMS - Peak conversion required for DC]) 1.57V * 30 = 47.1V.

I read the voltage like this:
Code:
For Temp=1 to 40
      readadc10 voltspin,VoltsIn
      Pause 4
      ;At 32Mhz, this should sample the volts once per mS, 
      ;with 40 samples taken, that should give two full 
      ;cycles of 50Hz (1/50Hz=20mS), slightly more at 60Hz
      If VoltsIn > VoltsPk Then 
            Let VoltsPk = VoltsIn
      EndIf
Next
The VoltsIn value can then be multiplied by the VoltsFactor (and the ADC reference) to calculate the AC supply voltage. For my unit, with an AC secondary of 9V and a supply voltage of 240V the VoltsFactor and ADC reference compensation meant that multiplying the 'raw' ADC value by 30 allowed me to display the voltage to within 300mV.

Once you have the supply voltage this way, you can do as you wish with it, all from within the PicAxe.
 
Top