measuring the RPM of 4 motors with Beaglebone Black

Hello

I want to measure the RPM of 4 motors at the same time using phototransistors to count the pulses generated by the blades as they cross the sensor . I had thought of using the BBB interrupts .
Is it possible ?
The BBB can execute other operations in parallel while it is measuring the RPM ?

Thanks

A couple of questions. How many blades? Or more precisely how many on off pulses per rev. Next how fast are the motors turning? Or again what sort of frequency from each opto sensor do you expect? Are the motors reversible so are you using two sensors for quadrature? How much will the motor speed change per single revolution or are you looking more for average speed?

Use CAP on pin

P9_28 (or SD_10, JT_04)

and single wire QEP on lines

P8_12 (or P8_41), P8_35 and P9_42

Find details at

https://users.freebasic-portal.de/tjf/Projekte/libpruio/doc/html/ChaPins.html

Regards

The sensor (CNY 70) will measure one pulse per revolution.
5000 RPM will be the maximum speed of either motor.
The motors will rotate in one direction only and the speed variation is negligible. The average speed will be sufficient.

Thanks

I have read the information in this link, and it seems to me that the CAPS and QEP lines can serve me.
The maximum speed of the motors will be 5000 RPM . I am using the CNY70 to measure the revolutions.

The other question I have is if I will be able to read the pulses from all the sensors simultaneously and also execute other functions, for example: mathematical operations, read digital or analog inputs, write on the PWM outputs, etc?

I have no experience programming the BBB, and it would be ideal, if there were already sripts or libraries with routines that read the pins of the CAPS and/or QEP lines that I could use as a base to develop my application?

Thanks

I must admit I do not know how to set up interrupts on the Beagle in such a way that they don’t have jitter. It’s why the MachineKit version was developed for CNC with the BBB.

But for your RPM measurement I’d look at doing it this way. Set up an interrupt at say 20kHz which is one every 50uS. Inside that interrupt routine read the 4 sensors and increment a counter. When the sensor edge falls to 0 (or to 1) reset the counter to start over. The number of 50uS counts since the last reset will give you the RPM with a bit of math.

My Electronic Leadscrew code is open source. In this case it’s a single sensor and detected with an interrupt but there is a 20kHz clock too. You can see the state machine code that debounces the sensor. That should serve as a guide on how to detect a single pulse per rev with debouncing to deal with electrical noise. The pulse has to be low for a number of 50uS pulses.
Int.c (32.8 KB)

The AM335x CPU contains hardware subsystems working that way @100MHz. Just read out the hardware registers.

Did you read the link I pointed to? It’s a documentation on such a library. It contains example code (scripts) in three different programming languages.

Didn’t get around to reading you link. It’s on my do list.

Misunderstanding, sorry. My question was directed @Pitufo1900 (under his quote), who asked for library and examples, but already got this information.

Anyhow, you’re welcome reading the docs, too.

@DTJF I did read through them. Good reference information. Not so much tutorial though. But thanks for posting that.

I will check the code, but I think it will help me to start the application.

Thanks

I understand, the information in the link is quite complete, I will read it in more detail, I think it will also be useful for another project I have to develop.

Thanks

@Pitufo1900
Four interrupts into the Beagle
The above link is dated 2014 so it’s probably useless information since the BBB seems to change every year or so.
The last time I looked into this sort of stuff it seems the response time of this approach is pretty poor. But maybe it’s a starting point?