joy-it SEN-IR01 Infrared Distance Sensor Instruction Manual

July 14, 2024
JOY-It

INFRARED DISTANCE SENSOR

SEN-IR01

1. GENERAL INFORMATION

Dear customer,
thank you very much for choosing our product.
In following, we will introduce you to what to observe while starting up and using this product.
Should you encounter any unexpected problems during use, please do not hesitate to contact us.

Note that for the full range of the sensor, it can only be measured accurately with a reflective object, such as white paper.

2. USAGE WITH ARDUINO

1. Connection

Arduino SEN-IR01
5 V Vcc
GND GND
A0 Data

2. Code example

We provide the following code example to test your infrared distance sensor. In this code example the distance to the next object is displayed on the serial monitor. Note, that you have to set your serial monitor to a baud rate of 9600 to be able to see this output.
To run this code example, copy the following code into your Arduino IDE and upload it to your Arduino using the Upload button.

// Declaration of the variables
int IRPin = A0; // Pin of the IR sensor
float IRDistance = 0;

void setup() {
Serial.begin(9600);
}

float get_Distance(){
// Calculation of the distance
int value = analogRead(IRPin);
float voltage = map(value, 0, 1024, 0, 5000) / 1000.0;
IRDistance = 28.153 * pow(voltage, -1.175);
return IRDistance;
}

void loop() {
// Output of the distance
Serial.print(“Distance: “);
Serial.print(get_Distance()); // Calling the get_Distance method
Serial.println(” cm”);
Serial.println(“———————-“);
delay(1000); // 1 second interruption
}

3. USAGE WITH RASPBERRY PI

This guide was written under Raspberry Pi OS Bookworm for the Raspberry Pi 4 and 5. It has not been checked with newer operating systems or hardware.

1. Connection

Raspberry Pi SEN-IR ADC Voltage translator
5V (Pin 2) Vcc VDD VCCb
3,3 V (Pin 1) VCCa
GND GND GND GND
Data A0
SCL B1
SDA B2
GPIO 2 (SDA) A2
GPIO 3 (SCL) A1

This infrared distance sensor is an analog sensor, which requires a voltage of 5 V. Therefore, it is essential to use an analog-to-digital converter and a voltage translator.

The analog-to-digital converter is required because the Raspberry Pi does not have one, but it is needed to read the data from the sensor. The voltage converter is needed because the Raspberry Pi can be damaged when receiving signals with a logic level of 5V.
We recommend COM-KY053ADC as analog-digital converter and COM-KY051VT as voltage translator.

First you need to enable I2C on your Raspberry Pi. To open the configuration, enter the following command:

sudo raspi-config

There select 3 Interface Options I4 I2C and enable the I2C interface.

You have now successfully activated I2C.

Now install pip3 with the following command:

sudo apt-get install python3-pip

The next step is to set up the virtual environment. To do this, enter the following commands:

mkdir project-name && cd project-name
python -m venv –system-site-packages env
source env/bin/activate

We use the Adafruit_CircuitPython_ADS1x15 library for our code example, which is released under the MIT license. Use the following commands to download and install this library.

pip3 install adafruit-circuitpython-ads1x15

The code sample we provide can be downloaded here or you can run the following command in your console.

wget https://www.joy-it.net/files/files/Produkte/SEN-IR01/SEN-IR01.zip

Now, unpack the file with the following command:

unzip SEN-IR01.zip

You can now execute the script with the following command. Be aware that your file path may be differ.

python3 SEN-IR01.py

4. ADDITIONAL INFORMATION

Our information and take-back obligations according to the Electrical and Electronic Equipment Act (ElektroG)

Symbol on electrical and electronic equipment:
This crossed-out dustbin means that electrical and electronic appliances do not belong in the household waste. You must return the old appliances to a collection point.
Before handing over waste batteries and accumulators that are not enclosed by waste equipment must be separated from it.

Return options:
As an end user, you can return your old device (which essentially fulfils the same function as the new device purchased from us) free of charge for disposal when you purchase a new device.
Small appliances with no external dimensions greater than 25 cm can be disposed of in normal household quantities independently of the purchase of a new appliance.

Possibility of return at our company location during opening hours:
SIMAC Electronics GmbH, Pascalstr. 8, D-47506 Neukirchen-Vluyn, Germany

Possibility of return in your area:
We will send you a parcel stamp with which you can return the device to us free of charge. Please contact us by email at Service@joy-it.net or by telephone.

Information on packaging:
If you do not have suitable packaging material or do not wish to use your own, please contact us and we will send you suitable packaging.

5. SUPPORT

If there are still any issues pending or problems arising after your purchase, we will support you by e-mail, telephone and with our ticket support system.

Email: service@joy-it.net
Ticket system: https://support.joy-it.net
Telephone: +49 (0)2845 9360-50 (Mon – Thur: 09:00 – 17:00 oclock CET, Fri: 09:00 – 14:30 oclock CET)

For further information please visit our website:
www.joy-it.net

Published: 2024.04.19

www.joy-it.net
SIMAC Electronics GmbH
Pascalstr. 8, 47506 Neukirchen-Vluyn

References

Read User Manual Online (PDF format)

Loading......

Download This Manual (PDF format)

Download this manual  >>

Related Manuals