Go Down

Topic: PWM Sensor Data Processed and Transmitted Over USB (Read 407 times) previous topic - next topic

A_Reed

Hello,

I'm typically a mechanical guy but have a theory question and an Uno to experiment with. I'm looking to add a PWM based absolute encoder to a project but our software guy isn't willing to add code and processing time to interpret the PWM signal/timing to get the data out so I am looking to offload that part of the task to an Arduino script and import it into the larger robot project via USB COM (serial?) data.

The plan would be to supply the sensor with +5V/GND and receive a PWM signal back from the sensor, process the PWM data into a number representing the absolute angle of the encoder and write that data to the USB port.

I've found bits of code to process the PWM signal into a numerical value and I've found ways to transmit via serial (Pins 0 and 1, I think) but I would like to know if there is a way to communicate or stream the bits over the USB port via COM or Serial? I don't know exactly what I'm talking about here, clearly but I am willing to learn. I just want something from a mechanical and systems perspective that I can plug in to the main board and tell the software guy what data to pull from it.

Bonus points if I can send more than one sensor's worth of data over USB, some kind of identifying bit perhaps?

Paul_KD7HB

There are always to do something, but you are locked into a single clock speed for any serial communications. Think about some other way.

Paul

jremington

#2
Aug 19, 2019, 08:29 pm Last Edit: Aug 19, 2019, 08:31 pm by jremington
Quote
a way to communicate or stream the bits over the USB port via COM or Serial
If you are using the standard Uno Rev 3, just use Serial.print() to send formatted ASCII data via the USB connection, to a PC or Mac. The data will also appear on pin 1, as TTL level RS232 ASCII.

A terminal program can save the output to a log file.

The pulseIn() function can be used to measure the PWM period.

TomGeorge

Hi,
Welcome to the forum.

Can you post link to sec/data of the absolute encoder please?

Thanks.. Tom..  :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up