Understanding Pure Sine Wave and Arduino

1st post, please go easy. So, I’ve been researching this out, playing with a starter kit, developing some thoughts of, “This seems cool, so how do I do it?” Now, I’m looking at a pure sine wave, at 60Hz.

So, what I can do now is create a square wave with 6 peaks on each wave, creating a VPP of 6V and RMS of 2V, if I am understanding the o-scope correctly. I am doing this off of 2 digital PWM pins and using them to fire 2 transistors off, using the Arduino 2560 Mega’s power. (Purely academic idea at this point.)

So, if I’m looking at this correctly, if I can create a pure sine wave, I can then fire it through transistors, stepping up current for each set, assuming they are chosen and wired correctly to pump through either one or multiple transformers and keep the pure wave signal… now to my questions:

  1. There seem to be an infinite # of ways to create a pure sine wave, from RC circuitry, LC, shifters, using PWM, using transitors with capacitors, etc, and each one has advantages and disadvantages. So, if my idea’s are correct, how would one use the 2560Mega in conjunction with whatever else to accomplish this? (I understand a little bit about a lot, just enough to know that my understanding is below par to try this) I’m one who needs to understand the why, so any links that can explain some of this - big thank you!

  2. An O-scope on my house mains produces a VPP of 328V on one leg, so, dividing by 2, I get 164V, and I can figure out that the RMS value would be 120V, for household AC current in the U.S. Following this logic, if one would create a pure wave power inverter, does it hold true that one would have to step transformer up from 12VDC to 164V, necessitating a larger than 10:1 transformer to achieve an RMS power of 120V?

  3. This part confuses me, if I am attempting to connect one transistor to another, say a NPN transistor to drive another transistor, would that transistor have to be a PNP transistor? At first, I didn’t think about it, but it seems that if positive voltage is driving the NPN base, and flow is negatively charged, than it’d have to reverse logic to PNP to keep stepping, although, I read that NPN is more efficient, so is it possible to connect an NPN straight to another NPN resistor?

  4. Ignoring power losses and heat factors, etc., and realizing everywhere else it’s said to schematic the hardware first and work to the programming, I understand that, but I really am just playing around and learning which direction to take this, is trying to get a pure sine wave signal/control circuit right off the bat a bad idea or might I be on the right track?

Side note, this is nothing more than a hobby for me, I don’t work in the field, but it interests me and I know I don’t know a whole lot, but just trying to expand on what I know and then go further,

Thanks!

You can never produce a pure sine wave with a digital device, but you can come close (stepwise) and then filter out some or most of the high frequency noise.

The easiest way to experiment is to buy an Arduino with a built in digital to analog converter (DAC) or add a DAC module. Buy those from Adafruit, for example. You can also make a DAC with a few output pins and some resistors. Google R/2R DAC, for example.

If you want a pure sine wave inverter for powering devices, don't even try to do it yourself. It takes years of engineering training and experience to design one that will function properly and safely. And they are not expensive.

i'm curious, what are you trying to build?

what I can do now is create a square wave with 6 peaks on each wave

are you suggesting creating a squarish waveform and filtering it produce 60 Hz?

necessitating a larger than 10:1 transformer to achieve an RMS power of 120V?

the higher voltage has to come from somewhere

is it possible to connect an NPN straight to another NPN resistor?

this is hardly a simple answer

yes, a Darlington is one configuration that increase current.

but amplifiers typically amplify a small signal up to the max voltage of the supply.

... and then you need a power/current amplifier stage.

this is nothing more than a hobby for me

but the voltages you're discussion are dangerous, as already said and worth repeating

I do it the easy, I have 60Hz 120/240 at my lab. I use a varactor and a transformer to get a 60Hz sine wave at whatever voltage I want. If it is other then 60Hz I use a generator. Here is a circuit complements of TI; Literature Number: SNOA839. It also has a great explanation.

gilshultz:
I use a varactor and a transformer to get a 60Hz sine wave at whatever voltage I want.

Variac, not varactor. Varactors are also known as varicaps.

If your mains is pure sine you're lucky, The high load of SMPS's distort the waveform in many environments.

The modern approach is not to generate sine waves except for RF circuitry. Why do you think you need a sine
rather than PWM approximation?

Amplifying a linear sine wave is fairly difficult and inefficient, PWM is trivial to amplify. Many uses of sine waves
are inductive (speakers, motors), so will smooth out the current effectively for you if the PWM frequency is
high enough.

@gcjr:

I'm not exactly sure what I want to build, it was a thought for a tractor trailer, and how it's done for over the road drivers that use TV's, microwaves, coffee makers, some medical devices are said to require "pure sine wave inverters." What has me interested is I'm renovating my house and always have been pretty good with DC stuff, and had a journeyman teach me how to wire up a house, so 120V/240V AC is intriguing at the moment. Which, then I got to thinking about using these little boards to make physical stuff happen, and ran across this and raspberry pi… Arduino seemed the direction I was looking. I pull a fuel tanker for a paycheck, and inverters are always a huge deal in the trucking industry, kinda like who has the bigger/louder pickup in the country. So while I have no need for one, understanding what I've used before and a greater understanding of how things work, seem like my cup of coffee.

Right now, I have some code from homemade-circuits.com that creates a square sine wave that has 6 peaks on the top and bottom, here. It gives the, intermediate peaks, I guess I would term it, during the square wave, which, I assumed had something to do with powering transistors on and off. I had the idea that it was pulsating while the transistors were "ramping up" and down, would be how I would imagine it, that would create the sine wave. The frequency is indeed 60Hz on the transistors turning on and off, although if I zoomed in with the O-scope, was showing considerably faster.

So, as far as inverters, when they're designed, are they designed so that it's 164V so it's 120V RMS? I guess that's my question on that, seems like what I've read points that direction, and I can't see an isolated inverter having different rules than utility main power. But, I do see the net say 12V to 120V is a factor of 10, so a 10-0-10 transformer is the key… okay, on the surface, I could easily look and say, yup, makes sense. But, I read in a book about RMS power and when it said it's actually higher, then confirmed with a Oscilloscope, now I wonder if it's actually a step of ten, or whether it'd actually have to be put to the 164V side...I don't know if I'm explaining what I'm trying to understand correctly.

So, I've never heard of a Darlington, lol, and looks like something I'll have to read up on more, thank you for that.

If I'm understanding what you're saying about amplifiers, relating to inverter wise, is first one gets the signal/control side operating on AC, then it's amplified to the max voltage of the supply, in an inverter case, 12V, then you would add a whole bunch of amps and run it through the transformer… that's what I'm understanding, at any rate… so, which comes into play, these transistors produce heat when operating, and then so would a transformer in operation, so what kind of efficiency would that be? If an inverter is rated at say, 1,000W, and 75% efficient… that's a LOT of heat, I would think, and when they go up to 5,000W, I guess 5kVA is a more proper way of putting it(?) 25% means lots and lots of extra heat in a very very small area.

@MarkT

I don't need a pure sine wave, but I did read somewhere that stuff like clocks and such tell time off the frequency of the power, then I read about modified sine wave inverters, inefficiency of them, and pure sine wave inverters...then I came to wonder the difference, and the cost shows it… so I set out on a research mission to find out what the deal is, how it's done, and what this "excess circuitry" is that's required… all I found so far is there are 20 million ways to make a sine wave, at all kinds of different frequencies, and everyone who seems knowledgeable shy's away from the 60Hz side, but goes on to explain how to do it at much higher frequencies. So, I understand that to get 60Hz one needs running much faster clock speeds to achieve the emulation of a sine wave, but why does it stop there and the world of shade tree electrical engineers kick in for the rest? I figure it's something like I'm missing a component, no one wants to say because some idiot (or a bunch) will try it and prove Darwinism is real, or maybe it's just not interesting to engineers… but what I have gathered is that out of everything I've read about how it's done, there's nothing I've read that makes me even feel comfortable understanding how it's done, let alone trying it… only reason I looked into homemade-circuits is it was the most complete of what I've found, although, he does state overunity and perpetual motion is possible, so that did make me suspicious right away… once I looked up what it was…

Simple R/C networks can shape a signal into a better sine wave if that is all that is needed.

However injecting that sine wave into a voltage is where the issues would come into play.

Generating mains is power electronics, so its always done via switch-mode techniques.

High quality sine wave generation involves a high frequency PWM signal, sine modulated, amplified
to high power, and then filtered using an LC circuit to remove the PWM carrier.

There are many topologies to do this, some isolated, some not, all try to avoid using low frequency
transformers (big heavy expensive). Google term "inverter topologies"

Ahhh, I see now. Generating waves, no big deal, trying to turn that wave into a massive VA signal is where the intelligence comes in.

Thanks for responding, and information, I have some time with Google ahead of me! Thanks for helping me understand some more of the plausibility of ideas and limitations of my own understanding. Also for pointing me in new directions to seek new information.

now you got me curious. what do you really need to run a clock or tv off the grid? does it need to be 120 VRMS? could it be a square wave at < 100Vpk-pk?

an advantage of square waves using mosfets is they are either on or off, some have very low resistance <0.1 Ohm and therefore waste very little power

[ PWM is not square waves unless you happen to require exactly 50% duty cycle ]

0.1 ohm is actually pretty massive, modern MOSFETs are available in the 0.01 to 0.0001 ohm range for low to
medium voltages. For higher voltages IGBTs are often employed which are more robust but have a
voltage-drop rather than on-resistance to contribute to losses.

Short essay on power transmission and conversion:

The origins of switch-mode power conversion date back a long way, MOSFETs made it much more practical in
many circumstances because they perform rather better than BJTs for switching, and the future will see GaN
and SiC MOSFETs taking centre stage as they perform better than silicon in various ways. For very high power
uses such as motor control thyristors (aka SCRs) are the device of choice as they can handle kV and kA happily
and are very rugged - alas they can’t switch off by themselves, but for AC motor control this isn’t a deal-breaker.

AC power distribution networks need to run at a single frequency without harmonics, since harmonics resonate
over long transmission lines (there’s a limit to how long a mains transmission cable can be set by the 1/4
wavelength of the frequency). Thus mains is a single frequency (aka pure sine), and all the transformers are
designed to be efficient at this frequency.

Modern mains equipment would actually be happier running from nearly-square waves since that reduces the
energy storage needed across the zero-crossing time. But the mains infrastructure wants loads to appear linear,
(not introducing harmonic currents). This makes it more expensive to make mains power supplies that are
friendly to the distribution system (power factor correction).

If the electricity distribution system were redesigned from scratch I suspect the domestic supply would be
DC, with substations doing power conversion from 3-phase. However there are so many AC induction motors in
use now that this could never be contemplated. In the old days transformers were the only economic way to
change voltage, these days DC-DC conversion is usually more economic.

AC power distribution greatly complicates infrastructure, since power factor has to be managed, and coupling
power back into the network requires complex inverters that track frequency/phase of the network they
inject power into.

High power DC-DC or DC-AC conversion (such as used for HVDC links) is still very expensive due to the high
voltages involved - thus high voltage AC is still the technology of choice for distributing large amounts of
electrical power around despite the huge transformers needed. AC has the advantage of being much easier to switch, so all the circuit switching and cutouts are simpler too. AC is much lossier underground, so HVDC is
used for under-sea power links and for coupling two AC networks running at different frequency or phase.
easier to design.

thanks for the explanation

but my question wasn't about transmission. It was about usage.

would today's common AC appliance be happy with a 60 Hz square wave?

gcjr:
thanks for the explanation

but my question wasn't about transmission. It was about usage.

would today's common AC appliance be happy with a 60 Hz square wave?

Most electronic items (domestic) have a little leeway and are pretty happy in the 45 to 65 Hz range to allow for other countries that use the 50Hz base.

gcjr: I am curious about that as well. I read somewhere before that stuff like clocks on a microwave, coffee maker, etc, use the frequency to be able to keep accurate time. To me, I could understand an engineer going, "okay, 60Hz, ± whatever % error, will keep time" and designing the clock to use the supplied frequency from mains to keep power to reduce cost/circuits/stuff to go wrong, etc. But, as I believe, the Hz may not always be 60Hz exactly, which would explain, in my logic, why you may have clocks that gain/lose a minute or 5 over some set period of time.

As far as a square wave, now it seems most of what I've read previously says square wave is an inefficient way, and only stuff like a drill would run on it, I am guessing to mean inductive loads. Then also in the same article, said that modified sine wave could cause a clock on say a coffee maker, run at 2x the speed because it's looking for a "pure" sine wave not a modified sine or square.

I can see where a square wave would be more efficient/effective, as in looking at analog vs digital. So I guess if you're trying to design something like a power inverter, you're more looking at getting something close to a sine wave, not exact, and close to 60Hz. If I am understanding correctly, trying to get a perfect sine wave with power is almost impossible and/or very expensive, and isn't truly what one would want.

I found something else that close counts for, instead of horseshoes, hand grenades, and thermonuclear devices, apparently mains power sine wave and frequency… again, if I am understanding correctly.

But, as I believe, the Hz may not always be 60Hz exactly

i built a digital clock in high school. I was told to tap off the transformer and use the 60Hz because it is accurate.

the story i was told is that every morning around 7am (?) they speed the turbines up to ~62 Hz and when every one wakes up, the turbines get loaded and slow to 60 Hz. Likewise at 10 pm (?) they slow the turbines down to 58 Hz and when everyone goes to bed they speed up to 60 Hz ............. ok, it make a good story, but i believe the total number of cycles each day is exactly what it should be for 60 Hz.

in college i saw a collection of freq meters that ranged from 55-65 Hz.

bottom line is the 60 Hz is accurate and i assume synchronized across the country. in high school i was told it was fully synchronized east of the mississippi.

Mains frequency is variable and load-dependent, the contract requires the provider to keep the absolute timing error within bounds to support mains-synchronized clocks.

This website may be of interest: https://www.gridwatch.templar.co.uk/

MarkT:
Mains frequency is variable and load-dependent, the contract requires the provider to keep the absolute timing error within bounds to support mains-synchronized clocks.

appears there's an attempt to "to ensure a long-term frequency average of exactly 50 Hz × 60 s/min × 60 min/h × 24 h/d = 4320000 cycles per day".

@Outtaluck

Almost all mains powered clocks do not rely on the mains frequency but thier own oscillator.
Especially true for microwaves and cookers etc.

@ballscrewbob:

Makes sense, I was wondering if what I read was true or not. I guess according to earlier posts and such, it's possible to time it off a frequency, but maybe not what would work best? There's so much misinformation lurking around, some things aren't correct, but also seem plausible in some ways… I appreciate the info about how they work.

@gcjr:

That's very interesting to read changing the frequencies at different times of day. I'll have to hook my scope up to the mains and watch, although, I am in Texas. I've been told by everyone in Texas we're the only state with our grid separate from the rest of the country… I have zero idea if it's true, though.

This is interesting to read what kind of information is out there, I appreciate the volunteering of information and your time. I'm learning a lot from this,