How to connect button to MIO module?

Topics about the Hardware of Revolution Pi
Post Reply
curious-eng
Posts: 5
Joined: 24 Jun 2024, 22:17

How to connect button to MIO module?

Post by curious-eng »

I would like to connect a button/switch to RevPi MIO module. How to wire it properly?
User avatar
dirk
Posts: 2271
Joined: 15 Dec 2016, 13:19

Re: How to connect button to MIO module?

Post by dirk »

Great idea, you can start by this helpful knowledge base article that guides you wring and commissioning:
Commissioning RevPi MIO
And have a look at this video tutorial where we connect a button to a DIO Module - just adapt the steps according to your MIO Module.
Tutorial 12 – Digital IO Modules application example
curious-eng
Posts: 5
Joined: 24 Jun 2024, 22:17

Re: How to connect button to MIO module?

Post by curious-eng »

This is helpful. I need additional help with understanding wiring.

To which pins of the MIO module can I safely connect a button or switch? I am looking for a simple diagram similar to this one for Raspberry Pi: https://projects.raspberrypi.org/en/pro ... omputing/5

Can I connect a switch to one of Digital Inputs and the Ground as shown on the attached image?
Attachments
Example.jpg
User avatar
dirk
Posts: 2271
Joined: 15 Dec 2016, 13:19

Re: How to connect button to MIO module?

Post by dirk »

Hi take a look at this I hope it helps you
May the source be with you :-D

Code: Select all

# toggle RevPi MIO digital output 1
import revpimodio2
import time
rpi = revimodio2.RevPiModIO(autorefresh=True)
OutputValue=True
while True
    rpi.io.DigitalOutput_1.value=OutputValue
    time.sleep(0.5)
    OutputValue = not OutputValue
User avatar
dirk
Posts: 2271
Joined: 15 Dec 2016, 13:19

Re: How to connect button to MIO module?

Post by dirk »

Hi curious-eng, sorry I forgot to answer your question as I did not have a button around but an LED.

EDIT: However, you have to be aware that your circuit will not work like that. Use 24V between the switch and input 1. So like this:
[24V] - [Switch] - [Input 1]

Open PiCtory and configure the variable of the MIO module "IO_Mode_1" as digital input.
Then save the PiCtory configuration.

Finally, open a shell and type

Code: Select all

piTest -x                # reset piControl
piTest -r DigitalInput_1 # read continously input 1
The value 1/0 should reflect the circuit state closed/opened of your button.
ptthomps
Posts: 3
Joined: 24 Apr 2025, 22:41

Re: How to connect button to MIO module?

Post by ptthomps »

Hi, I’d like to add a momentary button in order to trigger a shutdown of the module. Following the information in this thread, does the image below look like it’s wired correctly?
IMG_0223.jpeg
User avatar
dirk
Posts: 2271
Joined: 15 Dec 2016, 13:19

Re: How to connect button to MIO module?

Post by dirk »

Hello ptthomps, if you have a hardware revision 1.2 then yes, otherwise no. See excerpt from datasheet:
chrome_4jQLaGs2QG.png
This page describes how to find the serial number. In addition, the revision number: https://revolutionpi.com/en/find-serial ... tem-number

You can find the complete data sheet in the download area
https://revolutionpi.com/en/support/downloads
ptthomps
Posts: 3
Joined: 24 Apr 2025, 22:41

Re: How to connect button to MIO module?

Post by ptthomps »

dirk wrote: 28 Apr 2025, 13:24 Hello ptthomps, if you have a hardware revision 1.2 then yes, otherwise no. See excerpt from datasheet:
chrome_4jQLaGs2QG.png

This page describes how to find the serial number. In addition, the revision number: https://revolutionpi.com/en/find-serial ... tem-number

You can find the complete data sheet in the download area
https://revolutionpi.com/en/support/downloads
Thanks Dirk. It looks like I DO have revision 1.2 of the MIO module. Out of curiosity, what is the correct configuration for earlier revisions?
Post Reply