Digital counting to trip an AC relay

Hello Forum members, another newbie programmer with a few questions.

I'm using a UNO clone, 12V 300mA AC power module, NTE3100 Photon Coupled Interrupter Module, a 2 Relay Module for AC switching. I'm powering my breadboard (for the interrupter) with 3V coming off the UNO and 5V from the UNO to power the relay board. I read you can power up to 4 relays with the UNO, I'm only using 1 relay and 1 interrupter, should be OK power wise.

I'm wishing to momentarily trip an AC Relay (normally open, N/O, via Pin8 OUTPUT) that is driven by a "count" from a Photo Resistor from (Pin2 INPUT), then the count will need to be reset after each trip.

The AC Relay trip will be instantaneous OFF/ON/OFF in milliseconds for a very quick return to the previous state, awaiting another counted trip.

I'm rotating a windowed wheel to create the "count" via the photo resistor, once the count variable is met, an AC relay will momentarily trip (for a few milliseconds).

I think the BLINK sketch will start me off, and I believe I need an IF statement (IF "6" counts is met, THEN trip Pin8, for a few milliseconds, AND restart the count again until the next trip).

I have not had much luck finding Count / Trip / Reset information on the net.

So questions:

Which sketch shall I use?

How do I set the "trip" criteria?

How do I set the duration of the AC trip?

How do I reset the trip back to Zero?

Thanks for the inputs...

With questions like that, I suspect you have not spent much time programming. You really need to write some practice programs. By the way, an Arduino can control a relay, but not necessarily power one. What relay are you using? Specs?

Paul

Quite right, ZERO time programming !!.

I've played with BLINK, successfully. Lots of looking around for answers.

The Relay Board is a "2 Relay Module" stand alone not a shield.

I can get the AC relay to trip with an interrupt, I had the relay actuating via BLINK, need to understand how to set parameters within the code.

Thx

Stormin:
Hello Forum members, another newbie programmer with a few questions.

I'm using a UNO clone, 12V 300mA AC power module, NTE3100 Photon Coupled Interrupter Module, a 2 Relay Module for AC switching. I'm powering my breadboard (for the interrupter) with 3V coming off the UNO and 5V from the UNO to power the relay board. I read you can power up to 4 relays with the UNO, I'm only using 1 relay and 1 interrupter, should be OK power wise.

I'm wishing to momentarily trip an AC Relay (normally open, N/O, via Pin8 OUTPUT) that is driven by a "count" from a Photo Resistor from (Pin2 INPUT), then the count will need to be reset after each trip.

The AC Relay trip will be instantaneous OFF/ON/OFF in milliseconds for a very quick return to the previous state, awaiting another counted trip.

I'm rotating a windowed wheel to create the "count" via the photo resistor, once the count variable is met, an AC relay will momentarily trip (for a few milliseconds).

I think the BLINK sketch will start me off, and I believe I need an IF statement (IF "6" counts is met, THEN trip Pin8, for a few milliseconds, AND restart the count again until the next trip).

I have not had much luck finding Count / Trip / Reset information on the net.

So questions:

Which sketch shall I use?

How do I set the "trip" criteria?

How do I set the duration of the AC trip?

How do I reset the trip back to Zero?

Thanks for the inputs...

first , quite using the terms "trip", and "reset". Your Arduino program will set a digital pin either "high" or "low" depending on what you want to do. There is no "trip". Your relay will follow how you set the Arduino pin.

By "blink sketch", are you referring to "Demonstration code for several things at the same time". If so, that is the basis of all programs I write, after doing several before I discovered it. Excellent basis for almost any program.

When you set a pin "high" or "low" to control a relay, it will stay in that condition until you change the pin back. That time period is how long the relay will be activated. In your loop, save the current time you activate the relay and subtract that time from the new current time the next time through the loop. When the difference becomes how long you want the relay to be active, or transferred, set the controlling pin back to it's normal value.

The Arduino pin normal value may be either low or high, depending on how you have things wired. Your comments indicate you already have this working.

As far as counts, just set to zero.

Hope this helps a bit.

Paul