Newbie Help - IO act like a button

Hello everyone! I’m trying to hack together a project, and this is my first time using a photon. I think my question is more of a general one, as I’m trying to get the photon to act like a button press has happened when a web signal is received. Here’s my scenario:

My old phone has an IR blaster, and it’s great. I can use it to turn on/off my different TVs that just have an old school remote control. I love it, the TVs don’t have to be hooked up to the internet and get all “smart” and everything. Now that we are upgrading phones, I’m trying to find different options to keep things working the way I want them to. I already have code in place to trigger my photon to turn the LED on/off with the tutorial code, and in theory this is exactly what I want, but instead of sending a DC voltage to an LED, I’d like it to complete a circuit to two leads. I have disassembled my TVs remote control, wired up the power lead and ground cables to the 3.3V and gnd pins (it wanted two AAA batteries to begin with, so yay!) and I have scraped the conductive graphite off the board where the physical button used to be and connected two leads. When I test everything out, and power up the board and touch the two leads together, hooray, it acts as if the button was pushed because the circuit is completed and everything worked.

So, now I’m thinking that I need to connect those two leads to two different IO pins. Then, instead of sending a high or low write, I just want to connect the two pins so that it acts the same as when I just touch the two wires together. I may be going about this all wrong, so I’m curious what the community has to say about this.

Any thoughts/ideas?

I’ve been doing some reading, and it seems like I need to have the photon control a relay, and use that to close the normally open connection that I connect the leads to. does that sound about right?

if so, anyone have any recommendations for a good relay? I really only need the power button from this remote, but I wouldn’t mind making a few other buttons work the same way (volume +/-, input, etc) so if there is a multi-pin relay I wouldn’t mind that either. 2-5 single relays could also work.

I’m not an expert, but I think in this case, you might be able to get away with just using regular GPIO pins. Or at worst, maybe some transistors instead of relays.

Yeah I found this page which is talking about transistors for arduino:

https://forum.arduino.cc/index.php?topic=431940.0

I think this would work? I’m no expert either. :slight_smile:

The 3.3V supply on the Photon only supplies up to 100mA, and the digital pins will source/sink 25mA each or 120mA total - so whether you can directly wire the IR transmitter will really depend upon the current drawn - you also need to have common Ground between the IR Remote and the Photon. A better solution as @dougal has mentioned is to use the GPIO pin to switch a MOSFET that is acting like a solid state relay - i.e. it will switch on and off the power to your IR remote control. However, the MOSFET (or transistor) will need to be connected on one side to Ground that is common between the IR remote control and the Photon and on the other side to a 3V3 source [you may be able to use the Photon for this]. There are 2 way to switch - low side or high side - this just means the load (the IR Remote) is between the MOSFET and ground or between the 3V3 and the MOSFET. Try googling some circuits to get an idea of what you need to do.

2 Likes

yeah this is starting to make sense. forgive my newbie question, but how would I know what MOSFET to use? Also, how would I know what resistor to put before it to not blow up the little thing?

lastly, I imagine that if the connection made by the transistor no matter how short should trigger the remote to blast it’s IR code. So, I should be able to do a digitalWrite(D1, HIGH), wait a few milliseconds, digitalWrite(D1, LOW) and it will have just “pushed the button”. Right?

thanks again! coming from a software side of the tech world, it’s fun playing with the hardware components but the learning curve is high!

Some light reading for you: N-Channel MOSFET

Hi @lapubell,

another route, a bit more involved but much more future proof and less destructive for your remotes would be to implement an IR with the photon as I describe here:

That project has already the codes to control volume on Samsung TVs if I recall correctly.
The advantage in your scenario is that TV infrared codes are no secret and easy to implement and test.

One example I used in my house is this one:

Let me know if you have any questions
Gustavo.

Just wanted to report back.

I ended up reading quite a bit on all these topics, and my next build will definilty have some additional functionality. BUT, since this is really just requires on/off functionality, here’s what I did:

  • Hard wire the two leads for the power button together (now it’s always closed)
  • Wire the remote control’s negative battery lead to the ground on the Photon
  • Wire D1 to the remote control’s positive battery lead
  • On web hook, write D1 HIGH, wait 500 milliseconds, write D1 LOW

So, now instead of making the relay or transistor close the power button and always supply power to the gutted remote, I instead use the 5V from the high write to power the remote which is always sending a power toggle signal. Not elegant, definitely a hack, but it works and i’m content. :slight_smile:

1 Like

that's all that matters to me! thank you for reporting back and happy to hear you got what you wanted

1 Like