Using continuous signal 0.1 - 4.9 V signal to trigger Digital Output

Hello fellas,

I’m new in arduino, really need your help, for the programming and hardware configuration.

I have a tilt sensor that generate 0.1 - 4.9 V continuous signals, i want to convert it to contact signal.
for example, if the input signal = 1 V then the digital output active.

The sensor has 3 wire for output (10V Excitation voltage, Return signal and Side reference), please be kind to share the hardware configuration and the programming code for Arduino Uno R3.


Please be kind to provide a link to your hardware sensor and your attempt at writing, powering and also test code you tried to write

Hi, thanks for your answer

thats the link for the sensor

The power source for the sensor i think will be from the Arduino Uno, but the sensor need 10Vdc.

For the code, I need to measure the output of the sensor which is the analog input for arduino (0.1 to 4.9 Vdc) and when the analog input of Arduino measure 1 Vdc, the Digital output of Arduino active

The power source for the sensor i think will be from the Arduino Uno, but the sensor need 10Vdc

You will need an external power source for the sensor and a means of limiting the input voltage to the Arduino to a range of 0 to 5V


If you run the Uno from a 10-12V supply via the 2.1mm power jack the this voltage (less a 0.6V diode drop) is available at the VIN pin on the Uno to power your sensor. Don’t forget to add a 47k ohm load resistor between the sensor output and ground as per the sensor data sheet.

The following code will work:-

int sensorVal = 0;

sensorVal = analogRead(sensorPin);

if (sensorVal > 205) {
   digitalWrite(digitalOut, HIGH);
else {
   digitalWrite(digitalOut, LOW);

But this will be more stable as it requires a distinct change in the value before the output changes state (this is known as hysteresis):-

int sensorVal = 0;

sensorVal = analogRead(sensorPin);

if (sensorVal > 210) {
   digitalWrite(digitalOut, HIGH);
if (sensorVal < 200) {
   digitalWrite(digitalOut, LOW);

Any value between 200 and 210 will leave the current state unchanged. Adjust the boundary values around the 205 figure to suit you application.

Hope this helps.


Thanks all for your answer.

I will try it then, and write the test result

Really thanks for your help