Need support in creating a data logger for an industrial application

Hello,
Good day to you.

I am planning to use an existing raspberry pi 4 and a proximity sensor to make a data logger for an industrial application.

The application involves monitoring the time between each cut in a band saw machine and get the production date per hour.
We have 10 machines and run 24x7 and hence the effort to develop a simple low cost solution.
We are currently facing difficulties in monitoring the production everyday using old methods and people to do it.

The way I plan to do this is to use a proximity sensor to get the ‘piece count ’ . This is the input data.
I then plan to use the raspberry pi to program it to calculate the time difference between each count which is nothing but the ‘cycle time’.

Using this, I would like to monitor the actual number of pieces cut per hour against a set value to ensure we are getting the optimal production.
Currently there is no automatic way to monitor this and we are losing money by not running optimal production.

If the pilot works I would like to do it on the remaining 9 machines.

Can you please suggest a shield which I can use to interface between the Pi and the proximity sensor since the voltage of the sensor is 10-30v and I cannot directly connect it to the board.

If you need any more information I would be happy to share it.

Warm regards

Can you clarify? Are referring to the power to the sensor of some type of signal it creates? Can you supply a data sheet for the sensor so someone can identify the TYPE of signal you are referencing?

implemented a similar system some years ago monitoring dozens of machines in a factory
used PIC24 microcontrollers - because if the electrically noisy environment Ethernet was used for communication to a central server - protocol used was UDP
each machine was equiped with a LCD display and a membrane keypad for operator to enter job number etc
the PIC24 could monitor the machine for overall usage and check for broken tools etc

these days I would probably use a ESP32 https://www.espressif.com/en/solutions/ ... automation on each machine using WiFi for communication to a RPi or a PC - if environment was not suitable for WiFi use Ethernet

also for data entry I would use a toutchscreen
there are plenty of low cost toutch screens for RPi or even touchscreens with onboard ESP32 microcontrollers

It appears you may be able to monitor the start cycle relay and get your count and timing from that, without a schematic this is a guess. You could add a relay to do that for you from the same signal for isolation. There are other ways but without knowing control voltage, etc I can only guess as to the interface. Considering your environment consider something robust such as CAN to take info back to control center. From my experience WiFi has problems in industrial environments. A simple Arduino would do this, be sure to use industrial harden ones.

Hi Paul.

What I meant is that the sensor has an operating voltage of 10V to 30V.

The GPIO pins on the raspberry pi have 3.3V and 5V.

Hence I am thinking connecting the proximity sensor directly to the Pi would damage the board.

Hence I thought connecting the sensor through a shield would be safe for the raspberry pi

Will surely share schematic and pictures

Hi @abhi291,

could you post a datasheet for the sensors you want to apply? Or at least a link to the product?

Thanks for your reply.
What schematic would you want?
If you tell me I will get back to you with this.

I will also share a few pics and a diagram to make it clearer

1 Like

I would suggest you spend some time with some tutorials on basic electronics and get a copy of the Arduino Cookbook and skim it cover to cover and read the sections penetrate to your project.

An annotated schematic showing the machine control system.

Yes I will definitely share the schematics and the product pic itself and any link I get.

Hello,

Your project sounds interesting, and using a Raspberry Pi for a data logging solution is a great idea. To interface a proximity sensor with a voltage range of 10-30V to a Raspberry Pi, you can use an interface or a shield to handle the voltage level conversion.

One commonly used solution is to use an opto-isolator or a level shifter. An opto-isolator provides electrical isolation between your Raspberry Pi and the sensor, ensuring that the high voltage from the sensor doesn't damage the Pi.

Here are the general steps you can follow:

Choose an Opto-Isolator:
    Look for an opto-isolator that can handle the voltage range of your proximity sensor (10-30V).
    Ensure that it is suitable for digital signals and has a fast response time.

Connect the Opto-Isolator:
    Connect the sensor's output to the input side of the opto-isolator.
    Connect the output side of the opto-isolator to the GPIO pin of the Raspberry Pi.

Power Supply:
    Provide a separate power supply for the opto-isolator if required.

Programming:
    In your Raspberry Pi code, read the GPIO pin connected to the opto-isolator to detect the proximity sensor's state changes.

Cycle Time Calculation:
    Use the timestamps of the state changes to calculate the cycle time between each count.

Here's a simple example in Python using the RPi.GPIO library:

python

import RPi.GPIO as GPIO
import time

sensor_pin = 17 # GPIO pin connected to the opto-isolator output

GPIO.setmode(GPIO.BCM)
GPIO.setup(sensor_pin, GPIO.IN)

try:
while True:
if GPIO.input(sensor_pin) == GPIO.HIGH:
# Proximity detected, log timestamp
timestamp = time.time()
print(f"Proximity detected at {timestamp}")
# Add your cycle time calculation logic here

except KeyboardInterrupt:
GPIO.cleanup()

Make sure to adjust the GPIO pin number according to your actual wiring.

This is a basic outline, and you might need to adapt it based on the specific requirements of your proximity sensor and the opto-isolator you choose. Always refer to the datasheets of the components you are using.

If you have specific sensor or opto-isolator models in mind, feel free to provide more details for a more tailored response. Good luck with your project!

Be sure to use items approved for industrial use. I would seriously consider a commercial unit designed for this.

IF the OP is the owner, that doesn't matter. IF the OP is not the owner, does the owner approve of the project? In any case, the project needs to include error checking and reporting and needs to include documentation so the next guy can fix the failures when they will occur.

Depending on how any metrics these systems generate are used, I'd be concerned about "inexplicable" failures of the Pi. The kind where it gets accidentally stepped on, or run over by a fork lift etc.

Yes and if it fails or hurts somebody he is still responsible. It also depends on local regulations, some areas it will need an electrical inspection. Also consider the insurance and will they cover if something fails. I would rather be safe.

It certainly depends on the type of sensor (do you have a link to it?), but I've used many such sensors and they are commonly open-drain/open-collector type (often called NPN output) which means that while the power supply is at industrial levels of around 24V, the output itself is either floating or grounded.

What all that means is that you can safely connect it directly to the Pi if it's that type. At most you may need a pullup resistor to 3V, which is trivial to add.

Hi paul. I am making the project for our own use. I am also the owner. Planning to document everything.
This way when I get the pilot up and running and I need to copy these for all the remaining 9 machines, the documentation will come helpful.

1 Like

Hi wild bill, I am putting the Pi and the sensor on the machine directly. No forklift movements near the machines anyway and since they are mounted next to the machine control panel, it should not be affected by anything.
Will share photos of the same once I have mounted them.

In india, we don't have any regulations for things like these.
We are just developing a unique solution using open source hardware.

Hello ChatGPT

1 Like

This is the basic Idea. Not an expert but will start with this. Thinking this should mostly work