Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More Inputs
#1
Hi I’d like to wire some buttons as inputs (contact closure) and drive the LED,s in the buttons. I have this working via sensor ports button i/p) and dc port (LED) however there aren’t enough sensor/dc ports for what I need. Can I flip the Power Bar outputs to become inputs for the contact closure and drive button LED from PWM channels (like a DC port on/off not as a schedule)?
[-] The following 1 user Likes iancarp's post:
  • Rob F
Reply to top
#2
Hi Ian, I just changed your username on the forum, I removed the @ section as it's not a good idea to have your email address exposed. Bots regularly scan websites to find email addresses.

To drive the button LED's with the PWM ports you would need to add a circuit to handle the load, the PWM ports don't support much current, less than what an LED will draw. If you don't want to build any circuits I do have some extensions that plug in the AC power bar DB9's, you could add a combination of 2 of these, if you went with one of each you would have 8 extra sensor ports and 8 DC ports.

https://www.robo-tank.ca/reef-pi-Plug-an..._Assembled

https://www.robo-tank.ca/reef-pi-Plug-an..._Assembled
Reply to top
#3
Hi Rob thanks sorting the profile name I can definitely do without the spam tbh!

I wasn’t aware of the extra modules which is great! One thing for me to try and keep my cost down can I run the button contact closures directly onto the db9 and flip the ports to inputs I don’t need any extra sensor? I think I would need the extra DC ports to drive the LEDs although they do work OK on LED ports I just can’t seem to control them in the same way as a DC port as an output).

Best, Ian
Reply to top
#4
Hi Ian, I'm very sorry, the forum didn't let me know you left a message.

The LED ports are good for 25mA each and your LED's must be under that so that's great, you can use them.

You can connect the switches directly to any of the 8 ports on each DB9, one wire goes to the port and the other to ground but I highly recommend adding a pullup resistor to each line going to the DB9. Without this the GPIO is floating and can randomly switch to LOW/HIGH just like when you press the button.

Here's a diagram, the MCU is the GPIO coming from the DB9. The pullup resistor should go to 3.3v instead of 5v as the GPIO is only 3.3v tolerant. A resistor from 4.7k to 10k will be ok.

https://circuitdigest.com/sites/default/...sistor.png

Here's the pinout of the DB9's.

https://docs.google.com/document/d/157ep...=h.44sinio
Reply to top
#5
Hi Rob

I’m making progress but something isn’t quite right! I have 0v from the PSU connected to pin 5 of powerbar input. And I have +5v running through a 10k resistor via a latching switch onto pin 1 of the powerbar. I’ve re assigned the powerbar outputs as inputs. I understand that CH1 is pin1 on the DB9, pin 5 of the reef pi driver.

I can receive an input when configuring this for as ATO calling a (reversible) macro but it doesn’t seem to switch off the equipment . Even when I disconnect the DB9.

Curiously I also seem to get an input when assigning reef pi driver pins 11 & 9 which aren’t connected. Please see image attached.

Any help will be greatly received! ?

Best,Ian
Reply to top
#6
Hi Ian, sorry I'm a little confused. Pin 5 wouldn't have any voltage once you configure it to an input, instead it's listen for voltage between 0-3.3v.

GPIO 5 is connected to CH 1 or pin 1 of DB9 two. You want one wire from the switch going directly to CH 1 then on the same line you want to connect 1 end of the resistor and the other end of the resistor goes to 3.3v. You don't want to use 5v as that's too much for the Pi GPIO's. This resistor forces 3.3v to GPIO 5 on the Pi so it always reads HIGH, then when you switch the switch it gets pulled down to 0v as the other wire on the switch is going to ground.

Sorry the picture didn't get attached. After you select the image using the "Choose Files" button you have to click the "Add Attachment" button on the right side.
Reply to top
#7
Hi Rob

Thanks for this you’ve confirmed my understanding was correct. That said it was receiving the input but it wasn’t resetting for some reason. I tried to get this working but have opted to get the extension boxes as I’m not using the power bars.

Thanks for you assistance!

Best, Ian
Reply to top
#8
Hi Ian, I got your order and thank-you, I appreciate it! I'll get it ready and should ship on Friday, I'll be sure to email you the tracking number when I have it.
Reply to top


Forum Jump:

Current time: 04-23-2024, 04:35 AM