Author Topic: Which type of logic?  (Read 273 times)

0 Members and 1 Guest are viewing this topic.

Offline Randy222Topic starter

  • Frequent Contributor
  • **
  • Posts: 652
  • Country: ca
Which type of logic?
« on: September 03, 2024, 08:24:37 pm »
I making a basic dusk-dawn / dawn-dusk power switch. I have some things outside that should run only at night, while other things only run during the day.

I can make the logic two ways, just not sure what the best choice is.

120VAC rms input and output. I was thinking using an MC (cktPython code) for the logic because I can use a jumper between logic and SSR to select dusk-dawn or dawn-dusk mode. I just not sure if a tiny MC is better than simple 8dip comparator config.

It's for outdoor use, environmentals can be 120F to 25F, and exposed to water. I would probably pot the whole thing.

What would you choose for logic?
 

Offline shabaz

  • Frequent Contributor
  • **
  • Posts: 306
Re: Which type of logic?
« Reply #1 on: September 03, 2024, 09:18:37 pm »
If your requirements are not fully defined, or if you think you may need to tweak things, then a microcontroller is likely a good option, even if your current needs are met by a comparator.

But, I would not use circuitPython. That's good for a concept but generally not for production. MicroPython seems more reliable. But I would most likely use C code.

Case in point: I discovered a bug in CircuitPython a while back where if power is removed or if there is a brownout that occurs within a window after a certain number of seconds after power-on, then your Python code is erased from Flash. The Adafruit fix reduced the window for this to occur but (I believe) didn't eliminate it.
 

Offline Randy222Topic starter

  • Frequent Contributor
  • **
  • Posts: 652
  • Country: ca
Re: Which type of logic?
« Reply #2 on: September 03, 2024, 09:33:44 pm »
I mentioned cktPython because I have a whole set of MC's that will run it.
I could switch to a microPY MC, but I don't think it's needed.
Would basically be using the MC as a type of "comparator" with code for the hysteresis. One big benefit I see with an MC is using two outputs for the SSR control, but one output is inverse of the other, essentially a jumper to select mode of operation.

I am thinking any code would be super simple for this application. If I left the programming port accessible I would need to think about how to protect it when the whole thing is outside being used, so maybe a sealed access door or something. I would prefer to just pot everything leaving nothing exposed at all.

 

Offline Andy Chee

  • Frequent Contributor
  • **
  • Posts: 899
  • Country: au
Re: Which type of logic?
« Reply #3 on: September 03, 2024, 09:40:52 pm »
I can imagine an implementation using a PIC 12F675, using the ADC peripheral to read the analog light values, and implementing the hysteresis in code.
 

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1760
  • Country: au
Re: Which type of logic?
« Reply #4 on: Yesterday at 12:31:57 am »
.... I just not sure if a tiny MC is better than simple 8dip comparator config.
..
What would you choose for logic?
Do both designs in parallel ?
If you can manage it with simpler logic, that will be lower power and more stable.

There are simple low power timers that can give you some delay or ON time limits.
Once the parts count goes above some limit, you can look to flip to a small MCU.

Something with few pins that can run a 32kHz xtal could give you more options ?
If this is always mains connected (likely dropper powered?) you could also count mains cycles for timing.

What power is available ?
« Last Edit: Yesterday at 03:30:54 am by PCB.Wiz »
 

Offline Randy222Topic starter

  • Frequent Contributor
  • **
  • Posts: 652
  • Country: ca
Re: Which type of logic?
« Reply #5 on: Yesterday at 04:58:02 pm »
It's 120VAC rms (mains) for source.
The PSU can be any size, but it will be made just big enough to power the logic. A 5v USB phone charging block could work, but I would build a tiny linear PSU section.

I think I can do the logic with just 7 "discrete" parts; 5 resistors, 1 LDR, 1 MC.  Using comparator dip would be about same amount of parts.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf