Wikipedia

Search results

Navigate

Wednesday, December 25, 2019

ESP8266 - Bought it but now what...


ESP8266 - THE BIG STEP 


ESP8266 controlling a servo through a webpage 
I'll get straight to the meat of it - If you ever wished to connect your project to your wifi or to the internet and control things - servos, leds, entire projects etc. That's where the ESP8266 brings the party.( drinking is not cool kids )

This Wifi module is very similar to your HC-05 bluetooth modules except somebody decided to make it very hard to use, at least to a beginner. It took me on - off  a month to finally get the hang of it but chill out my bros you don't have to. You came to the one stop destination, where I give you nothing  but only the necessary morsels of information to make the darn thing work as fast as possible.



Okay i assume you've just bought the ESP8266 ( just the module ) , it's arrived but now what . Here's what, if you don't have these things buy them :

1. 1k ohm Resistors - 3

2. Breadboard Power Supply module - optional but makes life very easy
















Now, check if you have these things or get them too.

1. Arduino UNO
2. Breadboard
3. Male to Male Jumpers
4. Female to Male jumpers
5. Patience ...

Out of the box, your wifi module needs to be configured to communicate with the Ardiuno .
Use the Circuit Diagram given below to set up the system.

IMPORTANT -  DON'T POWER THE ESP8266 USING THE ARDUINO'S 5V PIN . USE IT'S 3.3V PIN OR BETTER USE A BREADBOARD POWER SUPPLY. BE CAREFUL WITH THE CONNECTIONS.


Do remember to connect the grounds of  both the rails. (purple jumper below)


Once it's all connected, switch on the power supply and upload the following code to your Arduino


Or use this link CLICK ME!


After you've uploaded the code, open the Serial monitor and type in AT and hit enter . See below




If you get an OK awesome, we're talking with the ESP8266.


Now we'll send a series of commands to change the wifi module's baud rate from 115200 ( too fast ) to  9600.

Send this command    AT+UART_DEF=9600,8,1,0,0

If you get back an OK awesome again , we have changed the modules' baud rate to 9600. If you try giving it any commands it shouldn't work as intended.

Close the serial monitor and change this in the code

Change 115200 to 9600 in both the places.
Upload the code.

We changed the baud rate and now we'll try connect to a network.
Open the serial monitor and send the command AT

If it looks like this after sending the command . cool

Now, send this command to set the module on mode 1 -  AT+CWMODE=1
The result should look like this.




Dessert Time - We'll search for nearby Wifi networks by sending this command - AT+CWLAP
The monitor should show you the networks like this.

As an example , let's try connecting to Liberty Media
Send the command  -   AT+CWJAP="Liberty Media","nlj-hyiyk187"
As understood just replace Liberty Media with your wifi's name and nlj..... with your password.:)

If you get WIFI CONNECTED and WIFI GOT IP. Damn kid you did it We connected !!
To know the IP address send in this command -  AT+CIFSR


And that's your IP address . Congratulations you've just opened up to an exciting field in robotics - IoT ( Internet of things)

 Next post , we'll learn how to control a servo using an ESP8266 and an arduino through a webpage
So stay connected !
my setup

Monday, December 2, 2019

MPU6050 Ardiuno bot UPDATE

UPDATE TO STOP TWITCHING

MPU6050 + Arduino Gyro bot



First up , a huge thanks to all of you who followed the link it really helps :)


THE PROBLEM

In the previous post the bot had this tendency to constantly twitch once it regained it's original orientation. Here's a video that demonstrates the difference between the bot with and without the software fix.




To fix the problem all you gotta do is fix this -

problem in the code
Here's the solution -

fix to take the threshold as a range 
Setting the resting yaw value in a range between 3 and -3 does scrub some accuracy but it's very little , come on it's not like we're writing code for self driving cars here haha.

This little buffer on both ends of 0 , 3 degrees on each side allows for the overcorrection the wheels do when returning to 0 nf BOOM it doesn't twitch no more.

Here's the new code with the fix.

CLICK MEEEE!!!   ( GitHub )



Hope this helped and more exciting projects coming soon.

WPL - C24 ft.Arduino Build