Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By sory sangare
#61620 Please someone can help me with how can i generate a PWM signal to control a triac with ESP8266 using Arduino IDE ?
User avatar
By AdaBill
#69019 I'm using a Portable IDE Installation with IDE 1.8.3 nightly. I read somewhere where they just do an analogWrite(Pin,val); like you do with the UNO. I have a need to control a 1200 watt @110VAC heater with a SSR and I had to switch back to a NANO to get the PWM to work. That was when I thought the PWM didn't work with the ESP8266. I've been able to light a LED off D2 ( NodeMCU 1.0) with variable brightness based on the val. I'm not yet sure what the val resolution is. On the NANO it was 0-255. I've only tested this base level and it works. I don't have an oscilloscope so I'm trying to use a volt meter to determine effective voltage. I'm only getting up to ~ 1.6 VDC. Thought it would go up to ~ 3.3VDC I'm reading this value with the LED (RED) and 330 ohm resistor in the circuit. Maybe the LED is sucking off the missing volts!

I'm also assuming the the required activation voltage for the TRIAC will be met by the ESP? My SSR claims to be activated by 3.2VDC. I'm using a TRIA to fire 5VDC into the SSR. Maybe overkill

Anyway, the PWM DOES WORK on the ESP8266 as far as I can tell.
User avatar
By AdaBill
#69020 After doing some more searching i found this about PWM on the ESP8266 at this site:
http://arduino.esp8266.com/versions/1.6 ... log-output

The portion about analogWrite is as follows:
analogWrite(pin, value) enables software PWM on the given pin. PWM may be used on pins 0 to 16. Call analogWrite(pin, 0) to disable PWM on the pin. value may be in range from 0 to PWMRANGE, which is equal to 1023 by default. PWM range may be changed by calling analogWriteRange(new_range).

PWM frequency is 1kHz by default. Call analogWriteFreq(new_frequency) to change the frequency.


I also do check the voltmeter without the LED and resistor and it did go up to 3.2 VDC.
User avatar
By martinayotte
#69039 Beware that dimming an SSR not only needs PWM, but that PWM need to be synchronized with a zero crossing detection.