How to control a lead that needs to go to GND

I am trying to write a program to activate the switches on this device.

Assuming I connect the UP button (as indicated) to PIN12 and configure it as OUTPUT, how would initialize and operate it?

i'm used to doing digitalWrite(PIN12, LOW); in setup and digitalWrite(PIN12, HIGH); to turn something on, but in this case (as per the instructions) it says that the lead needs to be set to GND (LOW).

do I just reverse this and set pin 12 to HIGH in setup() and to LOW in my loop when I want to press the button?

Yes, you are correct. Just invert the pin logic, as you describe.

Yes that should work.

One thing I considered is that rather that setting it to LOW or HIGH, change PIN 12 to INPUT in setup(), then when I want to press the button change pinmode to OUTPUT and writing LOW, delay(10), and then set pinmode to INPUT to release the button.

just reversing the logic will put 5V into the switch. how do I know that its normally open behavior is to have 5V on it?

That is even better. Write two functions that do that, one to set and one to clear the button. Pass the button pin number to the functions. That will eliminate a lot of repetition and keep all the coding in one place.

this is not a software hygiene question. i'm asking how the electronics work

You didn't post all the details of the electronics, or really any electronics question. You don't have to respond to my suggestions if you don't value them. Have a nice day and enjoy this and future projects.

Where I went to school it was called "engineering", not "hygiene".

if my question was incomplete, I'm happy to answer any clarifying questions.

That is not how the protocol is explained in the forum guidelines. It is specifically discouraged because of how frequently it becomes a "game of 100 questions". You are told to post all the relevant information up front. Goodbye.

as an electronics novice of less than one day, I wish i knew what all the relevant information was!

If you have an electronics question, just go ahead and ask. If you don't know what is relevant just post all of it, everything you know and any related helpful links that you used to find or work on your project. For example, you could tell us where you found the diagram you posted. That, and more, is detailed in the forum introductory threads. I'm sure someone will be glad to answer, but I already bowed out.

Realistically, we can not tell you "how the electronics work" without knowing what the electronics are.

When paralleling an Arduino output to an existing switch, one needs to be careful.

Consider

  • Opto FET.
  • MOSFETs open drain
  • Arduino output configured to act as an open drain.
  • Open collector BJTs
  • Dry relay contacts.

Always trace out the switch circuit you are trying to control remotely.

this is what I found under "arduino open drain". it seems to be the same thing I wrote above?

You can SIMULATE an Open Drain output by using:
pinMode(pin, OUTPUT); digitalWrite(pin, LOW);
for LOW and:
pinMode(pin, INPUT);
for High Impedance.

Do you have a common GND from the Arduino to the device ?

Always show us a good schematic of your proposed circuit.

This should include the switch circuit of the device you want to interface to.

Show us a good image of your ‘actual’ wiring.

Where did you share your test sketch ?

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

I haven't wired it up yet, but here is my proposed wiring from the Hero (Arduino uno) to the remote control pictured above.

I don't have a schematic of the remote, just the above photo.

Since the remote is powered by the Arduino, they share a common ground.

Here is my proposed sketch:

#define UPSWITCH 10
#define STOPSWITCH 11
#define DOWNSWITCH 12
#define PRESSDELAY 100

void setup() {
}
void press(int pin) {
  pinMode(pin, OUTPUT);
  digitalWrite(pin, LOW);
  delay(PRESSDELAY);
  pinMode(pin, INPUT);
}

void loop() {

  press(UPSWITCH);
  delay(500);
  press(STOPSWITCH);
  delay(500);
  press(DOWNSWITCH);
  delay(500);
}

Why would you connect the Arduino 3v3 to device (assume battery) 3v ?

Do you have a DMM ?

Do you have a logic level MOSFET ?

Why would you connect the Arduino 3v3 to device (assume battery) 3v ?

because it calls for 3V. is that wrong?

Do you have a DMM ?

yes

Do you have a logic level MOSFET ?

i didn't even know what it was until I looked it up! but, no.

Will the Arduino be powering the device, i.e. the device will not be powered from and other source (battery) ?

If so, measure the current that the device requires.


  • with no power applied, confirm with your DMM (resistance) that one side of the switch is connected to GND ?
  • with power applied and the DMM set to current, short out a switch with the amp meter, what current flows when you do this ?
  • do the above for all switches.