Digital output - pulse

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
pjthomas
Posts: 3
Joined: 03 Nov 2016 15:14

Digital output - pulse

Post by pjthomas »

Hi,

Can someone please assist me with creating a pulsed output on a digital pin?

I am not an experienced programmer, but I have used and compiled the certified 10 channel sketch. I have also modified it a little bit, for the purpose of creating more digital inputs for door/window sensors. This is now working.
I was thinking of modifying one of the LED outputs from 10 channel sketch for the pulsed output.

Does anyone have a smart solution for this? :-)

Brgds
Thomas
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Digital output - pulse

Post by A.Harrenberg »

Hi Thomas,

what kind of pulses do you need? A PWM (pulse width modulated) signal?
This can be done in hardware, but I think that it is currently not possible to change the frequency of the signal.

What do you plan to control with this signal?

Best regards,
Andreas.
fhem.de - ZWave development support
pjthomas
Posts: 3
Joined: 03 Nov 2016 15:14

Re: Digital output - pulse

Post by pjthomas »

Hi Andreas,

I want to trigger a relay, for just ex 500 msec.
This relay will again work as a dry contact for my garagedoor motor, to be able to open/close the door remotly.

Brgds
Thomas
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Digital output - pulse

Post by A.Harrenberg »

Hi,

that should be quite simple...

#define doorRelay 9

then in setup() you define the pin as output and initialize the state
pinMode(doorRelay, OUTPUT);
digitalWrite(doorRelay, LOW);

and in the function where you want to trigger the relay you just use something like

digitalWrite(doorRelay, HIGH);
delay(500);
digitalWrite(doorRelay, LOW);

Regards,
Andreas.
fhem.de - ZWave development support
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Digital output - pulse

Post by A.Harrenberg »

Hi,

I forgot to mention, be carefull when you connect a relay to a digital pin!

First make sure that the current needed for the relay is not higher than what the Z-Uno allow -> Z-Uno specification says 8mA for normal pins, 16 mA for pin 3-6.

Second a relais is a coil! That means if you switch back to LOW, a peak in the current/voltage will be created that can destroy the Z-Uno. You would need to protect the Z-Uno with a diode or a resistor and a zener diode.

So best would be to use a transitor to allow higher currents AND to protect also the transistor with a diode / resistor+zener diode or to buy a cheap "chinese" relay card that works on TTL level.

Regards,
Andreas.
fhem.de - ZWave development support
pjthomas
Posts: 3
Joined: 03 Nov 2016 15:14

Re: Digital output - pulse

Post by pjthomas »

Hi again Andreas,

Thanks alot.
Appriciate your quick and helpful response!

I will try your tip and let you know how it goes.

The info about pin/Z-Uno limitations with regards to current etc is very much appriciated!
I had planned for a very small relay, but now I will have another look at the spec and reconsider the design.
Probably I will go for a transistor solution

Have a nice evening :-)

Brgds
Thomas
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Digital output - pulse

Post by A.Harrenberg »

Hi Thomas,

yes, 8/16 mA (at 3.3V) is not very much...

I would use a transistor and then go for a cheap relay card, just type "relay arduino", "relay module" or "relay board" into the ebay search and there will be hundreds of them. But take care of the voltage, most need at least 5 V and the lower TTL level need to be considered. If you go for a card with an optocoupler, take a close look at the specification, most of them need at least 4-5 mA.

Regards,
Andreas.
fhem.de - ZWave development support
joergm6
Posts: 24
Joined: 03 Nov 2016 21:16

Re: Digital output - pulse

Post by joergm6 »

you can have a look at a "Solid State Relais Modul Board".
These are small, switching completely electronically and the ready modules can be connected directly to the pins. The only question is which switching power is required.
... Oh, I'm too slow
A.Harrenberg
Posts: 201
Joined: 05 Sep 2016 22:27

Re: Digital output - pulse

Post by A.Harrenberg »

Hi,

yes that is also an option, but most (or all?) of these do not switch potential free. Depending on what you want to switch this can be an issue.

Regards,
Andreas.
fhem.de - ZWave development support
michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

Re: Digital output - pulse

Post by michap »

Hi,

I use for this in most cases a Darlington Array - here are the clamp diodes for switching inductive loads included.

Samples are:
ULN2803
UDN2981
TIP120
....

Michael
Post Reply