0:05
hello everyone welcome to the IOT
0:10
section of controllers tech today in
0:13
this video we will see how to use stm32
0:17
to log data to the things speak server
0:19
using esp8266 let's first start by
0:24
creating the project in cube IDE I am
0:33
using nuclear 4 4 6 ar e for this
0:36
project give some name and click finish
0:40
here is our cube M X first I am
0:57
selecting external crystal for the clock
1:04
next I am selecting an ADC which will be
1:08
used to read the potentiometer data
1:14
changing the resolution to ten bits
1:24
even if you don't enable continuous
1:27
conversion it should be fine
1:29
because I am going to use the pole for
1:32
conversion method so continuous
1:34
conversion is not required leave
1:37
everything else to default now enable
1:45
the UART with interrupt this is where
1:48
the esp8266 will be connected let's set
1:54
up the clock now I have eight megahertz
1:57
crystal and I want the system to run at
2:08
click Save to generate the project
2:20
let's include the library's first I am
2:24
going to use the ring buffer library and
2:27
data logger library put the source and
2:30
the header files in the respective
2:32
folders click refresh and you can see
2:39
the files here in our project let's take
2:43
a look at the ring buffer dot C file
2:48
here you can change the UART
2:51
that you are using copy this function
2:54
from here and paste it in the interrupt
2:58
dot C file also we need to modify our
3:06
UART Handler and comment out the
3:25
let's take a look at the data logger dot
3:35
ESP in it takes the SSID and password as
3:39
the parameter ESP send data sends the
3:44
data to a particular filed label the
3:47
parameters are self-explanatory here
3:50
here you have to give the label of the
3:52
field such as either 1 or 2 or 3 etc
3:59
this is the one I am going to use it
4:04
sends data to multiple fields at once
4:07
let's first go to the things speak
4:10
register yourself or log in click on
4:14
channels then click new channel give
4:19
some name to this channel I am going to
4:25
use for fields in this channel
4:36
we can modify these names also I will
4:44
quickly modify others too
4:48
you can see the modified names remember
4:53
that field label number is the one that
4:55
we need while sending data let's start
5:05
include the data logger dot H I will
5:13
write a function to get the ADC value
5:21
this includes start a DC pole for
5:25
conversion get the value and stop a DC
5:48
let's define the variables that we are
6:00
also a buffer to stall the four values
6:04
inside the main function
6:06
first of all initialize the ESB with the
6:09
SSID and password now in the while loop
6:16
we will get the value of ADC then
6:20
convert this value to the voltage
6:33
and at last increment the count variable
6:37
now we will store these values in the
6:40
respective position in value buffer
6:56
and send these values to the sever now
7:01
here we need the API key go to your
7:04
channel click API key and copy write API
7:08
key I have for number of fields so enter
7:16
4 here and pass the value buffer give a
7:21
delay of 15 seconds minimum things feed
7:25
server will not update the data if we
7:27
send it within 15 seconds
7:30
let's build and debug our program
7:37
I am adding the variables in the live
8:07
you can see the first entry in the
8:09
things speak now I am rotating the
8:12
potentiometer so the ADC value will
8:24
you can see the new entries now also
8:28
note the values of count and count times
8:52
everything is as par with the values we
8:55
have in the live expression
9:05
this data will keep updating every 15
9:47
this is it for the video guys this
9:51
program uses the 80 commands so any ESP
9:54
module that supports 80 commands will
9:57
work you can download the code from the
10:00
link in the description be safe and have