Raspberry pi square wave generator

In this post I will show how to use Universal Plus family hat to turn Raspberry Pi into an Arbitrary Waveform Generator and visualise the generated waveforms ie to create the simple oscilloscope. From the Universal Plus datasheet :. DAC ports are on the pins 7 and 8. I will use ADC ports on the ports 34 and 5. As a source of the digital signal I will use the port 28 which is the PWM port number Universal Plus DAC can autonomously generate the analog signal.

It is enough to create the list of the values the DAC converter is 12 bit so the values should be in the rangeset the number of the samples and period or frequency of the generated signal and start the generation:. Your email address will not be published. DACInit uzp0. DACGenerate uzp0. DACStart uzp0. DAC1 uzp0. DAC Initialisation.

Waveform Generator using Raspberry Pi

PWM19] uzp0. PWM19 ]. PWM duty ratio change every iteration. ADC1, uzp0. ADC2, uzp0. You can add the additional ones or just use one ADC initialisation and Vref read uzp0. ADC1uzp0. ADC2uzp0. You can add the additional ones or just use one. ADC initialisation and Vref read. Click, double click and long click button timer interrupt library. Leave a Reply Cancel reply Your email address will not be published.

This site uses cookies: Find out more. Okay, thank you.Ron Hoffman April 11, 0 Comments. ElectronicsProjects. Function generators are quite expensive and due to that many engineers limit themselves by not getting on for their workbench. This hinders many testing and prototyping opportunities. Gladly there is a work around for this, a DIY Function generator that can produce Square, Sine and Triangle wave with adjustable frequency. This project is a improvised version of DIY function generator which was published in our website earlier.

Unlike the previous version, this FG comes with logarithimic sine wave converter and improved efficiency. Refer to the schematic in Figure 1 for the following theory of operation. They work together in the following way. U1C has its output low. When the input feeding U1Bin- is less than the reference voltage, the output of U1B ramps up. The output of U1B is a triangle wave. The output of U1C is a square wave. To produce a pseudo-sine wave, the output of U1B is connected by R11 to input Q1.

Q1 and Q2 are connectd with coupled emitters to form a logarithmic amplifier. R11 controls the amplitude of the signal into the log amplifier. R17 adjusts the emitter loads to adjust the waveform symmetry of the sine wave. R24 adjusts the offset symmetry for the logarithmic amplifier. Each control must be adjusted several times to achieve the best sine wave waveform with the least Total Harmonic Distortion THD.

The output of the logarithmic amplifier is fed into a ground referenced Common, Cmn node to buffer the sine wave and shift the signal referenced to Common. R28, a 10K potentiometer, provides the appropriate feedback to control the output level of U1D, from zero to Vmax. R29 protects the output of U1D and couples the signal to the output jack. Selector switches S8 — 10 are used to select the desired output type of waveform, sine, square, or triangle. R1 provides the coarse frequency adjustment.

R2 provides the fine frequency adjustment. R30 is used to protect the output of U1C while providing an output signal to an external frequency counter or oscilloscope trigger.I searched through internet how to command the speed of a fan by a gpio port.

Now, I have to adapt your code, calculate how much i have to get for my capacitor sand my pi will run cooler than ever! My theoric thinking: 1rst step: I create a schematic that allows me to output a gpio port in a transistor, to command the fan.

A period isn't alway symetric. Look for "duty cycle" in square signals, you will find about what i'm talking about. Thank you very much for this.

A fantastic article that was well wriiten, easy to ready and informative to boot. Added bonus: code worked flawlessly the first time and I got this up and running in no time at all.

Thank you! Thank u and waiting your reply, El Amin. As the errors tells you - out of range I'm looking for a cheap, MHz frequency generator for a physics experiment. Am I reading it right that the Pi is only capable of MHz?

Or am I misunderstanding? If the Pi can't do it, would you have any suggestions? I don't require communications-grade precision, a bit of frequency drift shouldn't hurt anything as long as it's manually correctable. Sunday, January 26, Raspberry pi as a simple low cost rf signal generator [quick and dirty solutions].

Rspberry Pi RF Signal generator A simple radio frequency signal generator is very useful for testing components, filters, receivers and other test systems in a wide range of applications. After the famous pifm project, which can generate an fm signal from the GPIO pins of raspberry pi, i cam across the following code which convert pi in to a simple portable signal generator. It works by using the hardware on the raspberry pi that is actually meant to generate spread-spectrum clock signals on the GPIO pins.

It should be kept in mind that the signal is a square wave with strong odd harmonics. However, this provides an easy and quick portable signal generator which can be controlled in software by a computer. This radio frequency generator based on the Raspberry pi can be easily modified to generate a sweep signal or can be modified as a simple wobble generator for tuning bandpass filters, simple rf circuits e. It is possible to use this in conjunction with a simple sdr receiver like funcube dongle or an rtl sdr to build a poor mans spectrum analyser and sweep generator.

Any way there are limitations but this offers a simple and quick solution. Other possibilities based on the pi includes controlling a DDS module like AD or Digital signal generators like Si to produce more cleaner signals. They run from the peripherals clock sources and use clock generators with noise-shaping MASH dividers.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up. My code controlling GPIO output is based on this article. When I run my code, it shows the square wave with the period of 4. It's not a tolerable error since the order of hundreds Hz and MHz. I've googled for this problem and found that usleepnanosleep cannot work properly if the sleep time is too short since some kind of linux system scheduling.

But I have no idea to solve this problem. Some suggest to use delay instead of sleep but I'm not sure it will work or not. My pigpio library will let you generate repeating waveforms with a resolution of microseconds.

Subscribe to RSS

If you need less than microseconds you'll need to find another solution. What you are trying to do is impossible using Linux, because it is not a realtime OS. This is not just a problem with the delay routines. Try your code, omitting the usleep calls, which might give you some idea what the maximum frequency might be, but even here you will find quite long and unpredictable delays due to interrupt handling.

It is not impossible to set the Pi hardware to generate a square wave, but this requires a totally different approach. It will not be accurate, because of which you'll NOT get a steady tune, instead the tune will fluctuate in frequency. If you try to do same in microcontroller e. You can use this snippet to get a beep by adjusting the timing parameters.

But you cannot make beautiful melodies :. Sign up to join this community.The Raspberry Pi in use as RF generator. But it was not very difficult to make a simple GUI in Python. You can press buttons with the mouse and the program makes the correct "command lines" and sends it to the nice program of Jan Panteltje. This program was also modified a bit, so that you can make an FM or AM modulated burst of 20 seconds.

Installation Create a new directory and copy the files in the following ZIP file to that directory: 17raspigensource. You will see this file appear in the directory. The Graphical User Interface that makes it easier to give the commands.

StartSweep Starts the sweep. After 20 seconds, the signal stops and you have to press the button again. Measurements of the audio characteristics of receivers Connect the audio output of the receiver with the soundcard of a PC with an audio spectrum analyser program. For example: 11sa. Frequency step: 10 Hz Time step: ms Set the trace of the audio spectrum program to Max Hold and start the sweep, the trace will be drawn on the screen as shown below.

If you want to compare two measurements, save the first measurement into the trace memory. Below you can see the wide bandwidth green colored. The orange colored narrow bandwidth has been measured first and is stored in the trace memory. When measuring the unwanted low sideband, the stop frequency is set to zero beat with the receiver 0 Hz audio tone and the start frequency equal to the stop frequency minus the audio range you want to measure.

The desired sideband is the orange trace, the unwanted one is the green trace. The sideband suppression is the difference between both traces. The peak of the desired orange sideband and the unwanted green sideband dip should lie at the position of the red arrow. Could be better! Bandwidth of the QRSS receiver Sideband suppression of the QRSS receiver Adjustment of the AM suppression of a direct conversion receiver From the 30 meter QRP transceiver, the ohm potentiometer in the receiving section has to be adjusted to maximum suppression of the detection of strong AM signals in the nearby broadcast band.

The RF generator is AM modulated and tuned to a frequency in the middle of this band. The level is adjusted positioning and adjusting the length of the antenna that a clear signal is heard.

Then the potentiometer is adjusted so that this signal is minimally audible. The ohm potentiometer of the direct conversion receiver has to be adjusted to maximum AM suppression. Measurement of the sideband suppression of the 80 meter CW transceiver Tune the RF generator to the desired sideband and measure the level. Then tune the RF generator to the unwanted sideband and measure the level again. The difference is the sideband suppression.

raspberry pi square wave generator

It was exciting to measure that side band repression. Because 20 years ago, the receiver had to be adjusted quite accurately for a sideband suppression better than 40 dB. After 20 years of use, it was still 41 dB!We're grateful for your business and hope to serve you again. Yes No Share on Facebook Share on Twitter The team at Gilleland is wonderful which is one reason I came back to purchase another vehicle. Read More Business ResponseSheila, it was so nice having you back in.

We appreciate the continued business and thank you for the 5 star rating. Yes No Share on Facebook Share on Twitter I had a wonderful first time experience at gilleland and I will definitely be shopping there in the future.

Read More Business ResponseTravis, we're so glad we were able to help you get your new Tahoe. Thank you for your business and we look forward to seeing you again soon. Yes No Share on Facebook Share on Twitter Two thumbs up. Read More Business ResponseThank you so much, Irene. It was a pleasure doing business with you. Yes No Share on Facebook Share on Twitter Awesome.

Mike Anderson as well as Cory Anderson went above and beyond in helping me with financial and vehicle decisions. Read More Business ResponseKathleen, we're happy we could help you find your new Trax. We appreciate the positive review and rating and look forward to future encounters. Yes No Share on Facebook Share on Twitter Great people.

Read More Business ResponseWe appreciate this, Matthew. It was a pleasure having you in and thank you for the 5 stars. Yes No Share on Facebook Share on Twitter It was a great experience BRANDEN C.

raspberry pi square wave generator

Read More Was this review helpful. Yes No Share on Facebook Share on Twitter I had service done on my pickup, communication wasn't the greatest.

raspberry pi square wave generator

They found I had a bad tire, then ordered the wrong one. I wanted to know the cost and I wasn't told the correct price till I got there to pick it up. Seemed like he was too busy to explain everything and was in a big hurry. Read More Business ResponseWe appreciate the feedback, Patrick. Comments like these help us improve our services for our customers. We apologize for any inconvenience we may caused.

We value your time and business and hope to serve you in the future. Yes No Share on Facebook Share on Twitter Great. Read More Business ResponseThank you, Brooke. We're happy to have your business. Yes No Share on Facebook Share on Twitter Gilleland is the best!. Read More Business ResponseThank you so much, Brenda. We're grateful for your business. Yes No Share on Facebook Share on Twitter Great Service SHANE F.

Read More Business ResponseWe appreciate it, Shane. Thank you for your business. Yes No Share on Facebook Share on Twitter They gave me a bunch of options that fit my financial situation.

Read More Business ResponseWe appreciate the positive feedback, Zachariah. We're happy we were able to help you find your new Silverado. Thank you for your business and we hope to serve you in the future.I'm hoping the Frenchies and Italians playing this game get ATLEAST one each, I'm not super knowledgable about either of these, but it's fairly obvious which ships COULD be a premium this year (plenty named in this thread alone).

A competitive Tier VIII USN. Which'll probably be the Alabama. And no more Russian Premiums for a year except maybe a BB one other than Nikolai, they had plenty as of late, at this rate they'll have an additional tech tree of Premiums before major navies get their silver tech trees. Since I'm really not sure whether i should buy the tirpitz or not right now. And 5 special paint jobs. And a polar bear as captain. But it plays alone against everyone else (or with a few Tier I ships for the lolz of confused Tier I players wondering what the hell just happened).

One of the Fantasque-class destroyers could be a pretty good premium, maybe Le Terrible since I assume Fantasque herself would be a tech tree ship and also WG selling a Terrible premium would amuse me.

Ridiculously fast (45kt), cruiser-sized, heavily armored and with pretty good torpedoes. Also, I'd love to see more pre-dreadnought battleships. And to add the imperial russian black-and-yellow paint scheme for russian ships. By having a Reddit account, you can subscribe, vote, and comment on all your favorite Reddit content. Sign up in just seconds. Log InDon't have an account. Sign upReddit is filled with interest based communities, offering something for everyone. Check out some communities and we recommend you subscribe to at least 5.

Your username is how other community members will see you. This name will be used to credit you for things you share on Reddit. What should we call you.

OP-AMP as Square wave generator

Having a hard time picking a name. Here are some available suggestions. Log in or sign up in seconds. Scorecards belong in the weekly scorecard thread, while container results belong in the weekly achievement thread. Unless they cause a positive discussion. No memes, macros, reaction gifs, rage comics, matchmaker screenshots, or other low effort posts that do not relate to the game.

All posts must relate to World of Warships or Warships in general. X-Posts MUST BE MARKED, if any specific kind of post is posted too frequently they may all be subject to removal. No duplicate posts, search for a similar post within the last week before posting. Posts and comments that are toxic to the nth degree will be removed and the poster will be banned without warning. No posts that ask for, link to, or enable piracy, malicious software, or illicit tools or sites in any shape or form.

No RMT Posts (Selling, trading, buying of goods) YouTube and Twitch links must have a combined 20 link and comment karma to be posted. Posting referral links is prohibited, however you can ask for them to be sent via PM.

Follow the reddiquette as closely as you can. Promotional Content Guidelines If you post a screenshot of the game, try to explain what people should focus on in the image in a comment.


thoughts on “Raspberry pi square wave generator

Leave a Reply

Your email address will not be published. Required fields are marked *