I am not entirely convinced that is the case. To measure to 0.1Hz accuracy requires timing the 50Hz ±2Hz period to about 40us resolution. If pigpio can time a signal to a resolution of 10us or better then it would seem to be possible.
Code: Select all
G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10000 G=13 l=1 d=10000 G=13 l=0 d=10001 G=13 l=1 d=10000 G=13 l=0 d=10000
I just mean you can't wire a Pi to mains and not fry everything. Some other circuitry is required, such as a zero crossing detecto opto-isolator
Looks like a few posters missed this bit and immediately assumed ItsCool was planning to plug his Pi directly into the mains .I know the basic hardware to generate a square either as 50 or 100 Hz, so that is not an issue.
It looks like you missed this bit:
That is a very good general point to make, but the pigpio library claims to be able to sample and time-stamp the GPIO inputs to a resolution of about 5 microseconds. Taking that claim at face value, which would imply that it is using a high-priority interrupt to circumvent the latency you describe, it should be capable of the task required by the OP. However in a critical application I would want some assurance that the "accurate to a few microseconds" claim by pigpio really is a worst case figure rather than a typical value.Z80 Refugee wrote: ↑Sun May 27, 2018 11:06 pmThe problem here (as I see it) is that the standard OS for the RPi is not what we call "real time". That means you can never rely on program execution to look at some input at or even near exactly the right time, because you cannot guarantee execution won't have been interrupted off somewhere to do some housekeeping.
Indeed not, but I would be surprised if a few milliseconds latency was significant when switching ballast loads into or out of circuit, which is the required function as I understand it. Mechanical inertia places a limit on how fast the generator set itself can respond to a change of load. There's a description of what the OP is presumably wanting to achieve here.
Users browsing this forum: No registered users and 10 guests