0

I connected my Arduino Uno to my raspberry via USB serial. I'm able to read out both digital and analog pins of my Arduino using the Python nanpy library (v.0.8). However, I can't find support for the pulseIn() function. It seems nanpy doesn't support pulseIn() at all.

What is the best way to measure PWM signals with the Arduino and forward the results to the Raspberry Pi?

I am able to measure PWM using the Arduino GUI, however I would to take PWM samples at fixed time intervals over a long period of time and combine this data with other measurements that my Raspberry is making.I also tried pyFirmata, but it doesn't support pulseIn() measurements either.

asked Nov 9, 2014 at 21:20
1
  • It seems like this could be a fairly trivial addition, if you can find the source code for both the Arduino and host portions, and successfully build and use new versions. Often it's useful to try to create and test a from scratch build before you try to modify it. But it may also be possible you run into more complicated interactions, for example if the usual pulse timing mechanism delays expected traffic. Commented Nov 11, 2014 at 17:13

2 Answers 2

0

You can just have a sketch in the arduino that takes the measurements at whatever interval you want using the analogRead(pin) function and then forward those results to the raspberry pi via serial using Serial.print(whatever you want here). If you don't know how to use serial with arduino just go to their site, they have very good documentation. Hope that helps :)

answered Jun 9, 2015 at 3:21
0

Nanpy seems to have a CounterClass that does frequency measurements.

Or do you want to measure the PWM duty-cycle?

answered Nov 10, 2014 at 17:00
1
  • I would like to measure the downratio. Preferably I would use pulseIn to measure one uptime pulse and one downtime pulse. From this I can calculate the desired downratio. Commented Nov 10, 2014 at 19:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.