Connecting Arduino with 24V Sensors,...

Hi everyone,

I would like to connect my Arduino with different 24 V powered industrial components like relays, 0-20ma Output/Input, Digital Inputs/ Outputs. Therefore I use a special Starter Kit for Raspberry Pi but I do not see any reason why it should not work with a 5V Arduino. Link to datasheet:

I use an Arduino Mega microcontroller for testing purposes. I tried the first example on page 15. Therefore I have switched jumper 7 to the 5V position, connected Arduino 5V and GND to 5V and GND on the breakout board. And pin 3 from Arduino to pin 16 on the breakout board. The signal jumper is also in the correct position.
After that i have connected the +24V cable from my 24V power supply to the second and GND to the last of the external circuit connector like in the picture on page 15.
When I power the Arduino via USB cable and plug in the 24 V power supply nothing happens despite the red LED on the breakout board goes on. My simple test code always prints 0 to the serial console. As long as my 24 V power supply is plugged in it should be a 1.

I would be very grateful if you could help me solve my problem. I am working on this for several days and I really have no idea what I am doing wrong :frowning:

My simple test code:

void setup() {

  // put your setup code here, to run once:


  pinMode(3, INPUT);


void loop() {

  // put your main code here, to run repeatedly:





Please read the post at the start of any forum , entitled "How to use this Forum".
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

pg.15 shows the interface board, with the appropriate modules populated into the slots for the 4 scenarios on that page.

Are you trying scenario #1 "Detecting a voltage of 24VDC.Input wiring diagram BID0324B1.M5S 1 connected to Raspberry Pi pin 16 (GPIO23)" ?

If so, do you have a BID0324B1 module plugged into slot #1 on the interface board?

Also, just to confirm ... your 24v power supply ... it is 24v DC, correct? Not 24v AC?

I recently did a project where I received signals from 24vac to monitor my home's HVAC system; and I used opticouplers to do it.

Thank you very much for your reply TomGeorge and Stoopalini! I have formatted my code in the correct way :slight_smile:

Please find attached my circuit :slight_smile:

Yes I try scenario #1 and the BID0324B1 module is plugged into the first slot.
My power supply is 24 V DC.

I would like to use these modules because I need several 24 V inputs, outputs, analog inputs and analog outputs. I thought that would be an easy and clean solution.

I read that the modules I have are 3V3, so I switched the power jumper back to the original position like in the documentation on page 15. As far as I could find out 3,3 Volts should also produce a logic high. But no luck so far.

If you manually jump 3v from the arduino to pin #3 on the arduino, then does your serial monitor print 1?

Yes, when I connect 3V3 from Arduino to Arduino pin 3 then I see 1 in the Serial monitor as expected. So the Arduino is fine.

When 24v is applied, use your meter to check pins S1 and 16G ... do you see 3.3v there?

Sorry, I meant check the "yellow pin 1" with 16G for voltage. Not S1 and 16G.

The yellow pin 1 should be the switching pin from module #1.

Ops pic.

If you are powering the Pi and the Mega separately, you do not need the 3V3 to 3V3 connection, you are in effect connecting TWO power supplies together, all you need is the gnd to gnd connection.
Have you programmed the Pi to make pin 16 HIGH?
Do you have a DMM to check the voltage on the Pi 16 to Mega 3 connection?
With the Mega completely disconnected from the Pi, is Pi pin 16 3.3V, HIGH?

Tom... :slight_smile:

When I disconnect the 3V3 cable from the arduino, then the red light on the board with the modules is off. There is no Raspberry Pi involved, just the Mega and the board with the modules (which was meant to be used with a raspberry pi but that should not really matter.
When I put the probes of my DMM between the yellow pin and GND there is only 0V on the display.

When I put the probes of my DMM between the yellow pin and GND there is only 0V on the display.

This is where your problem lies then.

When 24vdc is applied to the BID0324B1 module (through the I/O connectors), it should flip the relay and pass 3.3 volts through pin one of that module. Pin one of that module is connected to the yellow pin 1.

When you apply 24vdc to the I/O pins, do you hear the relay trigger?

My guess is you don't, because the relay module isn't getting 3.3v to it.

On the interface board's Pi connections, I notice there are many GND pins, and two 3v3 pins (there's one between pins 15 and 19). Maybe these are routed in a particular way? Try connecting your 3v3 from the Arduino to both 3v3 pins on the Pi connections. The one you're using now may be used to power the board up, while the other may be used to feed the voltage through the relay.

Just to confirm: The JP_V+ and JP_0V jumpers on the interface board are NOT jumped, right?

What "yellow"pin?
What are you trying to accomplish with a Pi hat and no Pi to control it.

With everything connected as in your picture, what voltage do you measure on Pi pin 16?

Tom... :slight_smile:

My aim is to use this board with a different microcontroller board which is only 3V3. That is why I have ordered the PI hat.
I meant the first yellow pin in the middle of the board.

Now I have tried something different. I have pulled out the first module and applied 24V to pin 8 of the small module and GND to pin 6. Then I measured the resistance between pin 1 and pin 4 which is ~280 Ohms when 24 V is applied and of course 0 when the 24 V power supply is off.
After that I have connected pin 1 of the module with pin 3 from Arduino and pin 4 from the module to GND pin from Arduino. Result --> I see only 0 in the serial monitor.

But when I change the input pin from INPUT to INPUT_PULLUP I get 0 when everything is connected and a 1 when I disconnect the 24 V power supply. Why is that? Is there something different between Raspberry and Arduino pins?

I pulleg in the module into the board, wired everything together again and I can reproduce the result. So there must be a difference between Arduino and Raspberry PI :confused:

With INPUT_PULLUP, the Arduino is activating an internal pull-up resistor for the input pin. This means it'll be HIGH when nothing is connected to it (hence the serial print of 1 when everything is disconnected) and will go LOW when a ground is connected to it.

This is actually a better way to go, if the control module can send GND through pin 16 when the module is activated; since it will prevent a floating input on the Arduino.

If you apply 24v to the module, and then use your meter to test for voltage between the yellow pin 1 and pin 16V, do you see 3.3v here? If so, then the control board is routing GND through the relay pins, not 3.3v.

So set the code to use INPUT_PULLUP and test. It should be 1 when the relay is not activated, and 0 when it is. If you prefer to be 0 when not activated, then just modify your statement to this:


The ! in front of the digitalRead will result in the opposite value of the read. So 0 when not active, and 1 when active.

The reason your test worked the way it did, is because the relay module is connecting pin 1 and 4 together when active. So you basically sent a GND signal through, not a 3.3v signal; since you connected GND to pin 4.

When you checked for resistance, was it really 280 and 0? Or was it 280 and Infinite?

0 would mean no resistance, and they are connected. Infinite would mean infinite resistance, and they are not connected together at all. 280 makes sense to me, since it looks like those relays are using opticouplers (based on the doc you linked above).

When I measure between yellow pin1 and pin16 I measure 0 V. But this seems correct to me. On page 3 of the datasheet you can see the pinout of this module and as far as I can see it is always connected to GND.
Sorry the resistance was of course infinite :slight_smile:

Thank you very much for the hint with the "!" :slight_smile:

As the next step I will try to get the output module working.

When I measure between yellow pin1 and pin16 I measure 0 V.

Yes, but yellow pin1 to 16V (not 16) should be 3.3v

By 16V, I mean the 16th in the row of pins labeled 'V', under the 1-8 yellow ones.

The row of 'V' pins carry the VIN voltage (3.3 in your case). And if the relay module is passing GND, then the yellow pin1 should carry GND when the module is activated by the 24v signal.

Looks like you're probably all set now though, yes? Use INPUT_PULLUP, and flip the reading with an !

The "yellow" pin is one of the SSRelay SOCKET pins.

So you are using the 3V3 supply from the Mega to power the Pi module?

Why should Pi pin16 be HIGH?
Isn't it part of the 3V3 logic circuit, it is controlled by a PI that should be under the module. not 24V supply that is the supply for the OUTPUT pins of the SSR,
24V input is not for the control circuitry of the module, it is ONLY wired as the supply you switch with the SSRs

Do you have a schematic of the Pi SSR module you have in your "image".

Tom... :slight_smile:

I have attached a schematic of the module.
As you can see in the picture INT-S is connected to the yellow pin.
INT- is connected with GND

EXT- to GND of 24V power supply
EXT-S to +24V of power supply

The jumper connects the yellow pin to the GPIO pin.


Do you have a schematic of the complete PCB, or a link to where you purchased it and possible data?

Thanks.. Tom.. :slight_smile:

No, the only thing I have is the datasheet. The company website is:
There is also no sample code available.

What yellow pin?
This optical isolation component, you apply 24V to the EXT terminals and use another supply on the INT output terminals.
The 24V supply is not connected to the 3V3 system.
You seem obsessed with a yellow pin when the WHOLE array of sockets is YELLOW.
What jumper?
Have you used a DMM to check that the GPIO has 3V3 on it?

Can you tell us your electronics, programming, arduino, hardware experience?
What do you know about Arduino and Pi?

Tom... :slight_smile: