Skip to main content

Posts

Showing posts from May, 2019

CHANGING THE ARDUINO(ATMEGA328) PWM FREQUENCY

CHANGING ARDUINO PWM FREQUENCY In some projects like boost and buck converters we may need to change the default frequency of Arduino PWM pins according to our need in order to control the charging time of inductor. in Arduino UNO pins D5 and D6 have PWM frequency of 62500 HZ , pins D3, D11, D9 and D10 has the default PWM frequency of 31250 HZ . To change the PWM frequency  following code can be written in setup function to set PWM frequency Divide the base frequency of pins by the factor you want to decrease the frequency for each pin  some examples are shown below The divisors available on pins 5, 6, 9 and 10 are: 1, 8, 64, 256, and 1024. The divisors available on pins 3 and 11 are: 1, 8, 32, 64, 128, 256, and 1024. for D3 and D11 TCCR2B = TCCR2B & B11111000 | B00000001; // for PWM frequency of 31372.55 Hz TCCR2B = TCCR2B & B11111000 | B00000010; // for PWM frequency of 3921.16 Hz TCCR2B = TCCR2B & B11111000 | B00000011; // fo

Voice Based Remote Device Control Using Google Assistant

This post shows that how can we use simple wifi module can be used as internet based home automation device using google assistant and adafruit io. for this project you will need following components and modules:- 1. NODE MCU board                                                             2. Realy board 3. Phone charger now power the node mcu and relay module using the charger and connect the node mcu pins to the relay board  and the hardware is ready now creat the adafruit io account and sign in and creat the feeds and dashboards like below now go to https://ifttt.com/ and creat account and follow following steps  creat a new applet now follow the process in the website to connect the applet to your adafruit io feeds and upload the following code by changing ssid, password, aio key, and user name and you you can control your node mcu pins via google assistant #include <ESP8266WiFi.h> #include "Adafrui