Two capacitive touch sensors, one solid state relay, one solenoid not activating

I have two capacitive touch sensors, one solid state relay, one solenoid.

Process steps:

  1. Both sensors touched
  2. Solid state relay activates
  3. Solenoid activates

The code below works fine but only when my Arduino Pro Mini is connected with the usb FTDI adapter and it's connected to the PC.
When I unplug it, the led on the Arduino Pro Mini lights up, however, my solid state relay doesn't activate and the solenoid doesn't activate.

The relay is capable of accepting 3-32VDC input signals.
I measured the voltage of the relay when touching both sensors and it was ~3.2 volts
in both situations (Arduino connected to PC and not plugged into PC)

Could it have something to do with Serial.println?
Even if it did, both the commands to turn on the led and relay are before the Serial.println code.

/*
 Two capacitive sensors
 3-32VDC logic input solid state relay activates
 Solenoid activates
 */

// When Sig Output is high, touch sensor is being pressed
#define ctsLeftPin 11 // Pin for capactitive touch sensor
#define ctsRightPin 12

int ledPin = 13; // pin for the LED
int SSRPin = 10; // pin for Solid State Relay
 
void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(SSRPin, OUTPUT);  
  pinMode(ctsLeftPin, INPUT);
  pinMode(ctsRightPin, INPUT);
}
 
void loop() {
  int ctsLeftValue = digitalRead(ctsLeftPin);
  int ctsRightValue = digitalRead(ctsRightPin);
  if (ctsLeftValue && ctsRightValue == HIGH){
    digitalWrite(ledPin, HIGH);
    digitalWrite(SSRPin, HIGH);
    Serial.println("TOUCHED");
  }
  else{
    digitalWrite(ledPin,LOW);
    digitalWrite(SSRPin,LOW);
    Serial.println("not touched");
  } 
  delay(500);
}

Which arduino? (Arduino Pro Mini, but it was available in 3.3 V and 5 V versions)
Show us the actual wiring and describe the power élément
are the GND connected?

Hi,
Instead of;

if (ctsLeftValue && ctsRightValue == HIGH)

try

if (ctsLeftValue == HIGH && ctsRightValue == HIGH)

Tom... :slight_smile:

TomGeorge:
Instead of;

if (ctsLeftValue && ctsRightValue == HIGH)

try

if (ctsLeftValue == HIGH && ctsRightValue == HIGH)

i assume it’s a joke, right?

It's a 3.3 volt Arduino Pro Mini.

All the grounds appear to be connected.
Ground to solid state relay.
Grounds of both touch sensors (part number of commonly used sensors with Arduino: TTP223B).
24V ground of solenoid to terminal block.
Should I also be connecting a ground wire from the 3.3 V Arduino mini to the 24V ground terminal block? Tried it doesn't work.

@TomGeorge tried that slight code modification.
I think he was trying to see if one of the capacitive sensors is faulty.
Although the first code would test both sensors at the same time too, maybe changing the condition on one would isolate each sensor for troubleshooting purposes.
Both sensors are working based on what I'm experiencing below.

It's weird that when I disconnect the FTDI header,
the led light on the Arduino Pro Mini turns on based on the code below,
however the solid state relay doesn't.
The solid state relay only turns on when the FTDI header is connected to Arduino and PC.

I'm using a 100-240 volt 50/60hz to 24VDC/5A converter.

The power switch I'm using though supports 120/240V, 2A AC.

Here are pictures of circuit:

wiring close up arduino pro mini 3.3v ssr, solenoid, capacitive sensors.PNG

wiring close up arduino pro mini 3.3v ssr, solenoid, capacitive sensors.PNG

So I figured out it wasn’t the code.
The input voltage I had going into the raw pin of the 3.3 V arduino pro mini from the buck converter was roughly ~3.5 volts.
I increased it to ~9 volts (5 would have probably worked too.)

Now it activates the relay just fine.

https://store.arduino.cc/usa/arduino-pro-mini
The Arduino site says:
Board Power Supply 3.35 -12 V (3.3V model) or 5 - 12 V (5V model)
I don’t understand why it wasn’t good enough.

Maybe it was too close to the low end and either the buck converter or multimeter were not as accurate with the output results. Or it just needed a slightly higher voltage.

Glad you figured it out

The voltage at Vcc is supplied directly to the Pro Mini, so any voltage applied to that pin should already be regulated to 3.3V. (If it’s badly regulated then all bets are off). That’s what your FTDI pin was connected to

The original doc states

There is a voltage regulator on board so it can accept voltage up to 12VDC. If you're supplying unregulated power to the board, be sure to connect to the "RAW" pin and not VCC

as RAW runs through the regulator, the voltage at this input can be anywhere from 3.4 to 12V is what is usually documented. So If you were powering through RAW at 3.35, you were pretty much on the very very low side. 5V would be good to not abuse the regulator

Note also that the length of the wire to your relays will generate extra resistance and voltage drop and it is noticeable if it’s a small 26AWG and you have say a >5m length.get the relay close to your arduino.

Note also for your FTDI that in 5V mode (set with the jumper) the maximum current draw on the Vcc pin is approximately 500mA (from USB) whilst in 3.3V mode the maximum current draw on Vcc is approximately 50mA. So with a 3.3V arduino, if you have current hungry devices attached, you might run out of power

Thanks, I was unaware of the 3.3V Arduino pro mini Vcc draw being limited to 50mA. I’ll keep it in mind.

Three things I have connected to the pro mini currently:

  1. TTP223B capacitive touch sensors (2x)
  2. TWTADE SSR-40DD solid state relay (1x)

Luckily I’m not running wire that’s too long from pro mini to solid state relay and the solenoid (<.5m).

I’m switching to the 5V pro mini since the stepper motor driver I’ll be using next will only take logic input signals 5V-~24V I believe.

it's the FTDI (which supplies current to the Arduino) that has the 50mA limit when you run it at 3.3V - not really your arduino (but your Arduino won't be able to deliver more than it gets)