Jump to content

Simple way to close a circuit? (momentary buttons) - (Moved)


xekon
 Share

Go to solution Solved by jchd,

Recommended Posts

I am working on a project where I have several momentary buttons, these are the normally open type of button, then when you press the button it completes the circuit.

These buttons are able to perform tasks manually, but I also have a webcam setup, and would like a way to have autoit short these circuits when certain colors are seen. (I can handle programming this part myself)

I have been using autoit for various tasks going on 20 years now, but it has always been a simply software solution.

The biggest problem is trying to search for solutions.... searching things like autoit button, autoit hardware button, autoit relay, is not very specific.

I get the idea that somebody more versed in controlling circuits via autoit would be able to point me in the right direction. (soldering is not an issue)

Edited by xekon
Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

More information is needed:

1/ which kind of charge these "switches" are going to power (AC or DC, voltage, current)?
2/ how many "switches" do you need?
3/ which port are available to drive your "switches" (USB, serial, //, other)?
4/ how this interface will be powered (from USB, from an external adapter, battery)?
5/ how frequent are the changes (once per ms, once per s, once per hour, once a month,...)?
6/ do you care about cosmetic (a pretty ad-hoc box) or is a hobby-style device OK?
7/ what is your budget for the hardware part?

Depending on your 7 answers, there can be several solutions, ready-made or more DIY.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

The momentary switches are buttons on devices, that can be pressed manually, but I also soldered some wires to the button's solder pads so that I can hopefully automate some stuff.

I prefer DIY or inexpensive. I think what I am looking for is something like the GPIO pins on the raspberry pi, but something that can be controlled directly from a desktop PC, maybe some kind of usb device that has IO pins that can be used as output, I could then send signal to short two of the pins together, and those pins could lead to the wires that I tapped into the momentary buttons.

One of the things I am trying to do is have one camera trigger another cameras flash/shutter, but I can think of other type uses, like if certain activity is seen on camera then trigger a siren.

I think I am on the right track with looking for some kind of GPIO board, but something that autoit could directly send a signal to would be great, otherwise I could see me writing an autoit script that calls some 3rd party program to send signals to the gpio device, which just seems kinda messy.

1. switches are open/close which instructs the device to do something or not do something

2. I would be controlling between 4 and 8 switches/buttons

3. usb would work, my pc has plenty of those, I could also make serial work with a usb to serial adapter (pc motherboard has no serial)

4. can be powered however.

5. the frequency of the event will depend on how often detected, could range from 3 times a minute to every couple hours. (when detected I would short two pins for maybe 200ms, to make sure the appropriate device registers the button press)

6. Cosmetics don't matter, I mean I have already hacked apart some consumer devices to add wire leads to the buttons, lol.

7. cheaper the better

Edited by xekon
spelling
Link to comment
Share on other sites

53 minutes ago, xekon said:

I think I am on the right track with looking for some kind of GPIO board, but something that autoit could directly send a signal to would be great, otherwise I could see me writing an autoit script that calls some 3rd party program to send signals to the gpio device, which just seems kinda messy.

A microcontroller would easily solve this, atmega 328p for example. There are several communication UDF's that would be very easy to adapt, you could use an Arduino UNO via the USB port or communicate directly with the 328p via serial Rx/Tx.

Link to comment
Share on other sites

You still haven't told wich power (ac/dc, voltage, current) you'll be switching.

Anyway, there's no need for an extra µC here, unless your requirements exceed what can be handled by easily found cheep devices.

https://fr.aliexpress.com/w/wholesale-usb-to-8-relays.html

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I really appreciate the responses guys! I also found another post where a person is doing basically exactly what I want to do:

https://maker.pro/forums/threads/how-can-i-press-a-push-button-with-a-relay.265601/

Knowing I might want to complete the circuit of up to 8 buttons, that would mean I need 16 relays.

I watched this video, and my immediate thought was WOW those are loud: https://www.youtube.com/watch?v=TFt480sxNWg

So Now I am thinking I want to try solid state relays to accomplish my goal, either directly controlled over USB, or if I have to controlled while connected from a raspberry pi.

I found this 8 channel one, but I am wondering if they can be found for less:

https://www.ebay.com/itm/235155940733 (this one is not usb so I would have to connect it to an arduino or raspberry pi)

 

Edited by xekon
Link to comment
Share on other sites

3 hours ago, xekon said:

Knowing I might want to complete the circuit of up to 8 buttons, that would mean I need 16 relays.

Why 16? A relay is basically a switch and probably the relays they use are SPDT (simple pole dual positions).

For SSR (solid-state relays) the specifications for switched voltage and current are more important than standard relays (typically 10A 250V~). You still haven't specify what you need.

Are you switching low analog signals, which frequency range, high-current loads, halogen lamps, ceramic oven, you name it?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

OH! now I understand what your asking, they are switches that are mounted to a PCB, One of them is a camera, I soldered wires to the underside of the shutter button.

I assumed the pcb is a circuit and that its just checking continuity or sending very low voltage and current when pressed.

I also have an infrared light that you press the same button repeatedly to cycle modes (not a toggle switch) Off, Low, Med, High, Off, that one is probably also low voltage, but I will check it.

Assuming all switches are very low voltage and current the solid-state-relay board should do the trick right?

I would just need to figure out the best way to interface it with the PC so that autoit can talk to it.

I do not know the frequency range, but I could probably use my digital volt meter to check the volts/current on the buttons.

The Camera is powered by 2 AA batteries, so there can't be much current going through that shutter button I would think.

Edit, more info:

The idea is I have a webcam that looks for general movement, then I have a more high resolution Camera that I can signal to take high res pictures, and if its night time also turn on additional infrared lights, if it goes well I have more cameras I would like to setup as well.

I know there are high end cameras that can do all of this, but this is just meant to be an experiment in remotely triggering hardware to perform functions, even old hardware that is not setup for internet of things type remote control.

Edited by xekon
Link to comment
Share on other sites

The more I look at relays, the more I see why it matters what I am using them for, the product I was looking at appears to be good for 75-250 VAC I am not even sure it would do what I am wanting.

 

Maybe what I need is to use an optocoupler, I just need a device that can complete simple small circuits, like the shutter button on a camera, or the power button on my computers front panel header. (sounds fun!)

https://forum.arduino.cc/t/arduino-to-turn-on-pc-using-opto-coupler-help-needed/468878/5

 

Then I find products like this https://www.ebay.com/itm/324988937994

why is 3.6 volts the minimum, I can understand a maximum, but why a minimum, I thought optocoupler was all about isolation, I just want to complete the circuit and let the button send whatever voltage it normally would send. What if my button actually sends less? I guess I need to get a volt meter on my intended buttons to control!

Edited by xekon
Link to comment
Share on other sites

  • Solution

You need to consider your setup in gory detail. Triggering the switches is just one of the remaining problems. If you use mosfets, then you need to realize they can't cope with alternating voltages at drain-source. Also isolation between 8 or so devices to switch is not granted and it also comes with the question about isolation from the PC (or other device) triggering the switches from the reference voltage of the switches devices!

Grounding together the PC and up to 8 distinct devices will most probably causes serious issues, noise, damage, frustration.

So yes, you need opto-coupling at the trigger inputs. Since you don't have 8 (or so) lines out of the PC, you also need some USB to 8 digital lines device. Then if the phototransistor of the stock PC817 can reliably switch any of the 8 (or so) devices, then you're fine since the 8 emitters of the 8 PC817 are isolated from each other. But if you need more switching power for any of the switched device, then you need another layer or a more capable optocoupler, e.g. TLP350 (but these then need higher power supply).

I attach the datasheet for the typical PC817 and TLP350. Note that the output max current is about 30mA @ 5V.

PC817X.pdf TLP350.pdf

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Thank you very much!

I ordered a couple of these PC817 8 way optocouplers: https://www.ebay.com/itm/334974375491

Will be like a month before they arrive, going to see what the most affordable "USB to 8 digital lines device" is that I can find.

So far I am not finding anything for less than the Adafruit FT232H breakout usb to gpio for about $14

https://www.adafruit.com/product/2264

 

Update after a bit more reading:

The Adafruit uses CircuitPython, which is a fork of micropython. CircuitPython is actually developed BY Adafruit.

I found a board that I believe would work similar(ESP32 CH340C), it is only $3 but it would use micropython: https://www.ebay.com/itm/166409779569

The difference is that it might take longer to get up and running with the micropython version, circuitpython already has massive library you can draw from.

Having never worked with either, im not sure about possible limitation like file transfer etc, the Adafruit FT232H from the description sounds very capable, they compare it to a swiss army knife!

Edited by xekon
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...