So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Yeitso
#61097 Hi

Im trying to automate a coffee machine that have a Quadrature Encoder as the controller. Im thinking that one should be able to emulate a quadrature encoder signal with a esp8266.

anyone done this?
User avatar
By g6ejd
#61760 Sounds like the coffee machine needs a quadrature output to drive a motor.
In it's simplest form a quadrature output is two signals usually square waves that are separated from each other in the time domain by 90°.
So choose your two data pins to be the outputs, choose your frequency, set both pins low, then wait 1/4 of your chosen frequency (in time domain) then toggle the fist pin high, then wait 1/4 of the time again and toggle the second output high, then wait 1/4 of the time and toggle the first pin low again and then do the same for the second pin, then repeat for ever, probably using an interrupt routine so you can use the foreground task to control the coffee machine. It is really quite simple to achieve. e.g.
start:
PIN-1 HIGH
PIN-2 HIGH
delay(10ms) // Assume a 40mS clock rate
PIN-2 LOW
delay(10ms)
PIN-1 LOW
delay(10ms)
PIN-2 HIGH
delay(10ms)
PIN-1 HIGH
GOTO start
Outputs in 10mS sections would be:
Pin-1 HHLLHHLL
Pin-2 HLLHHLLH