Electrical engineering project question

This may be a lot of information but I will try and simplify as much as I can. Basically for my final year project at university I have to design a PMU alternative device (raspberry pi 3) to detect a loss of mains. To give you more of an insight on the loss-of-mains, for example in most wind turbine sights they have an embedded generator that provides power should you lose connection to grid (islanding) but essentially you don't want this happen due to out of sync with main grid. So to do this you will measure the phase at embedded generator and compare it to reference phase of the main grid and should it go above a certain phase threshold, Bingo you detect loss of mains and shut embedded generator down. At least that's my grasp on it.

Now to where I am stuck at, I'll be using a python program to set this detection up, here is a diagram of the schematic:


(2 op amp components are a bi-polar op amp and cmos buffer)

Basically my supervisor wants me to use a pps (1PPS) module from the gps module to get the time elapsed from the rising edge of pps signal and the rising edge of the voltage wave form going into int0. This will get me period of waveform which should be 20ms. Anyway I think I have good idea of how to code this but the million dollar question for me is how do I go about testing this using real time values, will I have to order in the cmos buffer and bipolar op amp or is there a way to simulate this?

just going to define some terms for the general public as im an EE too. I am sure we know about it and know it well but for the sake of the forums interest I will do so

Phasor Measurement Unit

A railed operational amplifier

For those wishing to learn more http://www.electronics-tutorials.ws/opamp/opamp_1.html

Pulse per second.. (standard measurement unit used in gps devices

all a CMOS buffer gate is.... is one input and one output which can be simple two inverters back to back - built out of just 4 logical gates


Anyways @TheRatPack123
lets get to answering your question

i feel that you would have to actually buy the hardware to do real world simulation tests. i am not sure where you live or how expensive it might be. Unless you wanted to simulate it in a spice like circuit simulation program. Im not quite sure what your asking for so if you could elaborate a bit I maybe able to have to some pointers. I assume you have a microcontroller of your choosing picked out for this purpose. If you do what is the MCU that you are using. It maybe more prudent to find a board with everything you need already on it or at least most of it.

1 Like

The MCU is the raspberry pi 3, apologies it is an abstract question, getting the equipment won't be a problem as I can do it through the university. You mentioned spice, I am sure I seen it on one of the lab computers although I have never used it. To clarify what I am asking is that I have an idea how to code the phase angle detection, my issue is going about testing the code in an efficient manner. Do you think spice could simulate the circuit above (with the cmos and opamp etc) but I think I will have to order in the gps module and use it physically.

1 Like

Ahhh okay now I see what you are asking for. Do you have access to oscilloscopes or a lab. the best way to test this is to code it and hook the device up to an oscillioscope to compare the input phase vs the measure phase etc. Simulations are almost always better done with a prototype device and an oscilloscope handy vs just software because if the software fucks up and you do not realize it you could blow your prototype because your simulation gave you incorrect values outside possible tolerances for your device... etc You will have to order the gps module yes.

Not sure i would have to give spice a worl and see if it has all these devices. not quite sure it does

1 Like

Yeah there definitely should be oscilloscopes in the labs, the strange thing is I never got taught how to use them because my course is kind of in between electrical and computer science, so I did very little power related modules. It will be a daunting task lol but I think I should be fine, this has been very helpful thank you.

One last thing, will the oscilloscopes be connected easily to the raspberry pi's gpio?

1 Like

Yes it's connecting a single probe to the gpio which you want to measure.

1 Like

Good stuff, this should get me rolling again, thanks guys.

They should connect just fine given the correct probe. Uhmm never learned how to use an oscilloscope. They are not too difficult. It can be daunting at first but most have a manual on how to use them and I am sure a professor in the university might be willing during his office hours to show you. I would say learn to use your testing devices first.. purchase the rest of your hardware etc and get to testing.

I have a gripe about your choice of a controller board. Microcontrollers and Microprocessors aka ARM Cortex-M are better suited for your purpose. the RPI3 is a cortex A processor or application processor. I am not sure if it will do everything you need. If you find it doesnt. Take a look at a slew of boards with a cortex M3 on it or M4.

1 Like

If you want you can check those tutorials on oscilloscopes -


the second is a playlist with 3 videos those pretty much cover the basics.

2 Likes

Thanks @PhaseLockedLoop, I'll let you know if I run into any issues.

Thanks @anon5644329, will have a look at them ans go from there.

1 Like

Feel free to ask again when you encounter a problem.