2

After exhausting the google searches, I decided to post here for the first time. As the title suggests, I have created the NE555P circuit and although I can calculate the frequency and high/low width, I would like to make sure that these values are correct for a matter of precision. Now, the correct and easy way to do it would be to use an oscilloscope, but I don't have access to one. Plus, it can be an interesting project for me, since it's the first time I use the GPIOs for input. For my needs, the frequency will be up to 120Hz, so it is not high at all and should be detectable by the GPIOs (from what I have read). So far I have done the following:

  • Connected the LED positive to a GPIO, which I use to input the pulses.
  • Firstly, I used the RPi.GPIO lib and code I wrote to loop over a number of cycles and then divide by the duration, to find the frequency. This didn't seem to work correctly at all.
  • Then, I used the pigpio lib and the 2 frequency counters that are available on the website, but the output was incomprehensible to me. I looked at the code and I guess it outputs the number of pulses per sample rate(?). Though, I am not so sure and the output is not stable would change up to 50 units with the same settings.

Has someone done anything similar? I'd glad if you could share any suggestions. If you wish, I can share the code I wrote for the RPi.GPIO lib.

1 Answer 1

1

Download piscope as it will show you pretty much everything you need as far as GPIO changes on the Pi.

http://abyz.me.uk/rpi/pigpio/examples.html#Python_read_PWM_py is a Python example of a PWM monitor and may be more suited to your needs.

4
  • I was hoping you would answer my question! So, I just run the script and it detects input from the PWM pin? I forgot to mention that the circuit is connected to a battery rather than the 5v rpi pin.
    – Nikos
    Commented Aug 26, 2017 at 10:24
  • You would need to edit the script to reflect the (Broadcom numbered) GPIO you are using. You will also need a common ground connected between the circuit you are monitoring and the Pi. The Pi's GPIO should not be exposed to more than 3V3.
    – joan
    Commented Aug 26, 2017 at 10:26
  • The output voltage is less than 3,3v to protect the LED. Could I connect the LED's ground to the rpi's ground pin?
    – Nikos
    Commented Aug 26, 2017 at 10:51
  • That should be fine.
    – joan
    Commented Aug 26, 2017 at 11:51

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.