3 Replies Latest reply on Feb 9, 2020 3:57 AM by michaelkellett

    Sine Wave Generation Using A raspberry Pi




      For my project, I am trying to generate a Sine wave of two different frequencies, 28125Hz and 37500Hz to be fed into an op amp and then switched between using a multiplexor. I have not worked with an rpi much before but I know that it is not a good sine wave generator on its own so I need some help to determine if there is any intermediate hardware I can use to achieve this and how to code that up. What kind of rpi pin would I have to use and what is the maximum voltage/current output this pin would provide? The amplified sine wave is to be fed into ultrasonic transducers.



      Thank you very much in advance,


        • Re: Sine Wave Generation Using A raspberry Pi

          Hi Antony,


          You're using the wrong device.. it's like asking, "I'm baking a cake and I've not read the recipe to see what ingredients are required either. Help me to do it with a Pi, even though I know the Pi isn't great at making cakes".

          That's not being rude, I'm afraid that's expressing the reality.


          Once you have read up on your transducer and how they are driven, then you can decide on the best part for generating any driving waveforms, whether they are sine waves (sounds unlikely) or square waves. You will likely find that you use a different part or microcontroller. Then, there's nothing stopping you from switching on or off that part or microcontroller from the Pi, but I doubt the Pi will need to generate the signals, sine waves or not. This isn't a Pi topic (yet) basically..

          2 of 2 people found this helpful
          • Re: Sine Wave Generation Using A raspberry Pi

            There are lots of ways to achieve your goal. I am not sure what is best in your application, but if you want do it with an RPI, you could store the waveforms as sampled waveforms in the RPI. The RPI can send the samples to a DAC to create the desired sine waves and switch between them as needed. The DAC may need to feed a power amp depending on the DAC and how much power you need.

            1 of 1 people found this helpful
            • Re: Sine Wave Generation Using A raspberry Pi

              Perhaps you could explain your project in more detail - then we could make some better suggestions.


              I certainly agree with Shabaz - this doesn't sound like a good fit for an RPI.



              2 of 2 people found this helpful