4066 Bi-Lateral switch versus Transistor to emulate a button push of roller shutter controller

Thread Starter

Rumbaar

Joined May 14, 2021
9
Hi All,

First post, and hope I'm in the right place ... so here goes.

I have a project where I'm trying to make a 'dumb' roller shutter controller 'smart' via an D1 Mini (Arduino) and Alexa integration. The OEM controller is made by OzRoller (e-Port) is portable and contains a battery (14V) that powers the motors in the roller shutters. There are three momentary buttons that trigger UP/DOWN & STOP which I'm hoping to emulate.

The buttons are shown in the image below. When measure across bridging points show a 5V value, when they are bridged they trigger the button response.
button_forum.jpg

Originally I was going down the path of relays, then was looking at transistors (as a switch) and then 4066 switch as a pure analog switch. My desire is to fit it in the OEM controller, or at least make it as small and self contained as possible.

With this the 4066 IC was ideal, single chip, low power and simple bridging switch closed the circuit and simulated pushing of the analog switch. Which appeared to work, but one issue I found was that when the IC was unpowered the circuits defaulted to a state that bridged or triggered a button push. This meant that if the setup was ever to loose power (not sure if I'll be able to power it directly from the onboard power or externally powered) the circuits would close and trigger all the buttons to pressed until the unit ran out of power.

So first question, is there a way to get it so the IC doesn't allow the bridge in default state or a way for me to configure it so it's default state will never allow it to be open unless it's activated. The leads from the buttons will be 'unpowered'.

After having this come up, I reverted back to using transistors. With a setup of a NPN transistor I was able to get a proof of concept working on a breadboard to light up LED (these were powered), but then I removed the LED and put in the direct wires from each side of the buttons on the OEM controller board I couldn't get it to trigger a connection/button press. Now this could be due to my low bridge volt or the transistor I'm using as it appears the voltage when closed is well under the 5V from the buttons.

Now the units come with a RF version, but that uses rolling codes. I'm unsure if I can use the inputs from that module/functionality to input digital commands direction via RX/TX or other direct input options. But that is beyond me, and I'm not sure even how to investigate that option.

Now that's a whole lot of words, and if you've come this far thank you for reading. If anyone has any tips, suggestion, feedback or questions please feel free to comment.

Cheers,
 

DickCappels

Joined Aug 21, 2008
7,424
This is a great place for your question. Welcome to AAC!

Where, with respect to e-Port did you connect the power and ground connections for your '4066?

When power is removed (from what?) do your enable pins float or go somewhere in particular. 100k resistors from the enable pins to Vss might solve the problem.
 

Irving

Joined Jan 30, 2016
1,496
The problem I've found with trying to emulate those button presses is that the 'button' that presses on there is usually a bit of conductive foam having quite high resistance so placing something 'leaky' across there can appear to be 'pressing' the button all the time as you have found - its not about voltage but input current to the pin. You need something that is typically >10Mohm when off and <100k or so on and the former value is challenging (0.5uA leakage) for most transistors/analog devices.

There is one further key question - is the switch ground side or supply side - ie do they pull the pin up to 5v or down to 0v? (either way they will measure 5v across the switch). A MOSFET is a better switching device (a small signal bjt may be too leaky), but whether N- or P- channel depends on 'which way up' the switch is.
 

Bordodynov

Joined May 20, 2015
2,865
I don't have access to your electronic circuitry. If one pin of the buttons is common (GND), then you don't need pass-through switches. You will be fine with low power transistors: 2N7000, 2N7002. I prefer the FDV301N transistor. This transistor has a protective gate.
 

Thread Starter

Rumbaar

Joined May 14, 2021
9
This is a great place for your question. Welcome to AAC!

Where, with respect to e-Port did you connect the power and ground connections for your '4066?

When power is removed (from what?) do your enable pins float or go somewhere in particular. 100k resistors from the enable pins to Vss might solve the problem.
Thanks, and thanks for the reply.

For the 4066, it was going to be connected to the D1 Mini for power and ground connection, with the only connections to the e-Port would be the bridging wires (at the left/right arrows in the original attached image) to form the 'bridging' action of simulating the button press.

As the 4066 would be 'self contained' within the D1 Mini setup, if that lost power (at minimum it'll be powered separately via USB) due to power loss to the house, that controller would still have battery. So I'm hoping I can draw power from the controller itself. It does appear to have output power, but when I try to draw off it. It must trigger a protection circuit and cuts the power from the battery.
power.png

The problem I've found with trying to emulate those button presses is that the 'button' that presses on there is usually a bit of conductive foam having quite high resistance so placing something 'leaky' across there can appear to be 'pressing' the button all the time as you have found - its not about voltage but input current to the pin. You need something that is typically >10Mohm when off and <100k or so on and the former value is challenging (0.5uA leakage) for most transistors/analog devices.

There is one further key question - is the switch ground side or supply side - ie do they pull the pin up to 5v or down to 0v? (either way they will measure 5v across the switch). A MOSFET is a better switching device (a small signal bjt may be too leaky), but whether N- or P- channel depends on 'which way up' the switch is.
Yeah, I'm not trying to emulate the actually push, but the results of the push. Which appear to bridge the 'pad', and this achieve via pad as below. For my method, I'm just trying to bridge the points, which can be done via a wire, and I'm using a closed switch to do (hopefully, if my logic is sound).
button_pads.png

The controller switches I'm trying to simulate? I'm not 100% sure, how would I be able to check this? Sorry, I'm not sure what you mean by pull pin up 5v or down. I've only measured across the bridged points (arrow to arrow) and read it as 5V.

Yeah MOSFET like a Transistor, is an option I need to look into. Making this as small as possible is a desire, but one I'm not locked into. As I'm sure that added a lot more components then a simple analog 4066 switch. But I need a 100% reliable and robust system over one that might have issues to power loss.
 

Thread Starter

Rumbaar

Joined May 14, 2021
9
I don't have access to your electronic circuitry. If one pin of the buttons is common (GND), then you don't need pass-through switches. You will be fine with low power transistors: 2N7000, 2N7002. I prefer the FDV301N transistor. This transistor has a protective gate.
Yeah, I'm not sure how to test that. Still learning. Thanks.

Here are the front and back layouts. Yeah, I need to work out to how to correctly get transistors bridging the connection properly. But hoping the 4066 analog switch can do it, as that is a lot less components. I'll look into those specific transistors.
front_circuit.pngback_circuits.png
 

Bordodynov

Joined May 20, 2015
2,865
Three transistors in a SOT-23 package will take up no more space than your favorite chip. They don't need a power supply. The transistors will be closed when the microcontroller is powered off.
 

Irving

Joined Jan 30, 2016
1,496
The leakage of a 4066 gate when Vcc = 0 is not defined, but looking at the equivalent circuit the body diodes will make it quite leaky.
Here's how to do it with MOSFETs.

R1/R4 are the existing pull-up/pull-down resistors which might be inside the control chip and not on the PCB.

Q1 - 2N7000 in this location might work, or it might be a bit too leaky, in which case try a BS107P.


1620996172266.png
 

crutschow

Joined Mar 14, 2008
27,184
Do you know where the circuit ground is on the circuit with the push-buttons or the minus of its power supply?
If you do, measure the voltage from each of those to ground.
 

Bordodynov

Joined May 20, 2015
2,865
According to the board, the pull-up resistors are connected to the 5 volt power supply and to the pins of the buttons. The opposite pins of the buttons are on the common point of the circuit (minus power). As I suggested, low-power n-channel transistors will do. Resistors in the gates are not necessary. When you remove power from the controllers output will be 0.6 volts or less, which is less than the threshold. Although the resistor in the gate will give 0 volts.
 

Irving

Joined Jan 30, 2016
1,496
According to the board, the pull-up resistors are connected to the 5 volt power supply and to the pins of the buttons. The opposite pins of the buttons are on the common point of the circuit (minus power). As I suggested, low-power n-channel transistors will do. Resistors in the gates are not necessary. When you remove power from the controllers output will be 0.6 volts or less, which is less than the threshold. Although the resistor in the gate will give 0 volts.
I was just about to post the same.

The resistors in the gates are required if the driving circuitry goes Hi-Z when powered down which the TS says is likely. It is possible, given what the TS said, that a static charge could develop which could turn the MOSFET on just enough to be recognised as a closure- a few uA leakage - which in other circumstances wouldn't be an issue.
 

Thread Starter

Rumbaar

Joined May 14, 2021
9
Wow, a lot for me to unpack here. I'm quite a novice, and have just enough knowledge to be a danger to myself ;) Thanks for the replies!

Three transistors in a SOT-23 package will take up no more space than your favorite chip. They don't need a power supply. The transistors will be closed when the microcontroller is powered off.
Oh, looking at these transistor configuration they are certainly more compact to the ones I've currently dealt with. I still need to create a working prototype of a transistor circuit, as I've only been able to do it via LED proof of concept (they had input power) and with the bridging circuit I've yet to get it right. Most likely due to the input V to low for the bridged circuit (sorry if my terminology is incorrect).

The leakage of a 4066 gate when Vcc = 0 is not defined, but looking at the equivalent circuit the body diodes will make it quite leaky.
Here's how to do it with MOSFETs.

R1/R4 are the existing pull-up/pull-down resistors which might be inside the control chip and not on the PCB.

Q1 - 2N7000 in this location might work, or it might be a bit too leaky, in which case try a BS107P.
Thank you for taking the time for a detailed circuit diagram, at first glance I'm a little lost. So will take some time to study it, I'm just starting out.
Yes, the leaky part is my only negative of using the 4066 switch IC. There is a common path from each of the switches and they appear to be passing through a resistor, but to me they are a closed loop and I'm not 100% sure how that functions as a whole.
resistors.jpg
Do you know where the circuit ground is on the circuit with the push-buttons or the minus of its power supply?
If you do, measure the voltage from each of those to ground.
I can't say I do, and due to my lack of knowledge. I can follow circuit paths, but not sure how best to determine that. As they pass from each side of the board, and at times appear to just terminate to nothing.

According to the board, the pull-up resistors are connected to the 5 volt power supply and to the pins of the buttons. The opposite pins of the buttons are on the common point of the circuit (minus power). As I suggested, low-power n-channel transistors will do. Resistors in the gates are not necessary. When you remove power from the controllers output will be 0.6 volts or less, which is less than the threshold. Although the resistor in the gate will give 0 volts.
Ah I posted above, and assume the pull-up resistors are what I've labelled with arrows? With the opposite pins to a common point (which appears to just terminate into the board as a large copper circle). I could never understand where that point went too, and how it allow a completed circuit to exist.

Thank you once again, I'll look at your suggested SOT-23 package option for my transistors (I'll need better soldiering skills, and hopefully these are fine to use in development boards).

The resistors in the gates are required if the driving circuitry goes Hi-Z when powered down which the TS says is likely. It is possible, given what the TS said, that a static charge could develop which could turn the MOSFET on just enough to be recognised as a closure- a few uA leakage - which in other circumstances wouldn't be an issue.
Yeah, I wont even pretend to understand what "Hi-Z" means in this context, but will endeavor to learn. But yes, the sensitivity of the controller and current circuits to 'rogue' button pushes is something I need to ensure is factored in to my designs.

Thanks all, and it's given me more ideas and knowledge. Learning all the available options, from when I was originally just going to use large relays to perform switching, to making it more (hopefully) compact and robust.
 

MrChips

Joined Oct 2, 2009
23,515
Yeah, I wont even pretend to understand what "Hi-Z" means in this context, but will endeavor to learn.
If you don't know don't be too shy to ask.

In electrical terms,
R is used for resistance
X is reactance
Z is impedance

All have units of ohm.
Often they are used interchangeably, sometimes incorrectly. Know the difference.
R is resistance to DC
X is resistance to AC
Z is resistance to both DC and AC
Mathematically, Z = R + jX when both R and X appear in a circuit component.

In your context, Hi-Z is short for saying high impedance, which in this case can be substituted with high resistance.
This means that the resistance is so high that little or no current will flow, as if it were disconnected from the rest of the circuit.
 

Irving

Joined Jan 30, 2016
1,496
R is resistance to DC
X is resistance to AC
Z is resistance to both DC and AC
Mathematically, Z = R + jX when both R and X appear in a circuit component.
Extending that...

R is resistance to both DC and AC, Ohm's Law says R = V/I for DC and for AC when V and I are in phase with each other (ie go up and down together), like this:
1621090635184.png

X, (pure reactance) is 'resistance' to AC, Ohms law still works as in I = V/|X|, but the current I is at 90degrees to the voltage V like this:

1621095367465.png

Z, impedance, is technically the combination of resistance and reactance (R and either Xl, Xc or both, ie Z = R -jXc +jXl). Again, Ohm's law still works if you take magnitudes ie I = V/|Z|, but the phase varies according to the ratio of X to R. Here's the 'simple' case with R and either Xl or Xc, when X = R. Unlike two equal resistors, R1 = R2 where Vo = R1/(R1 + R2) Vin = 0.5Vin, there's a phase component to the divider effect:

1621101587020.png

Hope that's useful...
 

Irving

Joined Jan 30, 2016
1,496
Going back to the circuit, here is the actual wiring for the first switch, the other 2 are identical. There's a bit of signal conditioning & cleaning & switch bounce removal going on. I'm guessing at the cap value, but 10nF wouldn't be unusual.

1621104906823.png
 

Ian0

Joined Aug 7, 2020
2,189
There's one thing that isn't quite so dumb in roller-shutter door switch boxes. They won't go down unless you have your finger on the button, so no-one can get trapped underneath (nor can the door be accidentally shut while there is a fork-lift parked under it)
 

Thread Starter

Rumbaar

Joined May 14, 2021
9
Extending that...

Hope that's useful...
Yes, I'm sure it will be as I progress!

Going back to the circuit, here is the actual wiring for the first switch, the other 2 are identical. There's a bit of signal conditioning & cleaning & switch bounce removal going on. I'm guessing at the cap value, but 10nF wouldn't be unusual.

View attachment 238573
Wow thanks for taking the time to explain in detail what is taking place, I could follow some of the path and assumed something was shifting it ot the return GPIO path. But wasn't sure how it was achieving this.

I might test the return V of each switch back to the "ATmega88A-AU" controller. Am I right in thinking that I can delivery the V directly to the post switch/cap on the right and just tap into the three lines leading directly into that controller? As long as I can deliver the needed voltage? Or would that fry it and it's a digital signal?

There's one thing that isn't quite so dumb in roller-shutter door switch boxes. They won't go down unless you have your finger on the button, so no-one can get trapped underneath (nor can the door be accidentally shut while there is a fork-lift parked under it)
Not sure if the motor has any direct protection against an item stopping it from closing (Not reaching it's stop point), but the controller, once pressed, doesn't require the DOWN button to be depressed until it's fully closed.
 

Irving

Joined Jan 30, 2016
1,496
I might test the return V of each switch back to the "ATmega88A-AU" controller. Am I right in thinking that I can delivery the V directly to the post switch/cap on the right and just tap into the three lines leading directly into that controller? As long as I can deliver the needed voltage? Or would that fry it and it's a digital signal?
A multimeter on volts, black probe to ground, red to the via(s) to the left of the components (furthest from edge of board) should show near to +5v dropping to near zero when the button is pressed.

You must NOT deliver a voltage to the pin. You must passively connect the pin to ground using a MOSFET as discussed above. For safety I'd connect to the switch side of the protective network (the via conveniently provided at each switch).
 

Thread Starter

Rumbaar

Joined May 14, 2021
9
A multimeter on volts, black probe to ground, red to the via(s) to the left of the components (furthest from edge of board) should show near to +5v dropping to near zero when the button is pressed.

You must NOT deliver a voltage to the pin. You must passively connect the pin to ground using a MOSFET as discussed above. For safety I'd connect to the switch side of the protective network (the via conveniently provided at each switch).
Thanks for the follow up, and yes measuring the voltage shows a drop to 0V on button press. I'm just trying to see the most efficient way to get what I want. Where as it has a RF module, so I assume there is a MCU somewhere that I assume takes a digital signal and issues the commands to UP/DOWN/STOP. But having thoughts and theories without a grounding in knowledge, I'm not sure it's even possible.
But at the moment, I'll try to find the smallest MOSFET, I looked at the SOT-23 packaged transistors ... but finding the correct one was a challenge. But I'll assume that might be the case for MOSFET too.
 

Irving

Joined Jan 30, 2016
1,496
There are any number of suppliers of the ubiquitous 7002 MOSFET in an SOT-23-3 case, which should do... just look on Mouser or Digikey using search term "mosfet 7002 sot23-3" ..


Where as it has a RF module, so I assume there is a MCU somewhere
The ATMega is the MCU on that board. The Atmel ATA5724 chip above it with the large 13.52MHz crystal to the right of it and the printed spiral antenna above it is a receiver operating at 433.63MHz.
 
Top