Raspberry Pi show sensor data in a graph Python [w/ subs]



00:00:00 – hi folks my name is masa for youtube
00:00:02 – channel lock market 360 in the previous
00:00:05 – video I explained how Python can
00:00:08 – communicate with the Raspberry Pi pins
00:00:11 – and in this video I'm going to connect
00:00:15 – our DHT 11 sensor to the Raspberry Pi
00:00:19 – and read out the temperature value and
00:00:23 – share this value inside Gaborik the
00:00:27 – purpose of this video is to connect our
00:00:30 – sensor put the Raspberry Pi and the
00:00:35 – reason i chose tht is because it's a
00:00:39 – very famous center you can buy this
00:00:42 – sensor almost everywhere and there are a
00:00:47 – lot of libraries out put in general if
00:00:49 – you got a new sensor then the best way
00:00:54 – to connect it to the hospital by is to
00:00:58 – have searched online for library so i
00:01:01 – just typed in google Python libraries
00:01:05 – and tht sensors and i got a match on
00:01:08 – this website and somebody put our
00:01:12 – library for the sensor on github and all
00:01:15 – i have to do is I have to clone I have
00:01:20 – to download this library with this
00:01:22 – command and after it is download I have
00:01:25 – to install it so let's rock a hole
00:01:29 – inside the terminal the first command is
00:01:31 – sudo apt-get update always a good
00:01:34 – practice to do this that's breaking the
00:01:38 – jay-z image and they'd fighting with
00:01:41 – this command confirm yes and we gonna
00:01:45 – get our download from this URL gay.com a
00:01:54 – deferred a default python and we clone
00:01:59 – this slightly inside before and after
00:02:04 – the download with LS we have a look
00:02:08 – inside the directly this is the library
00:02:12 – video staff download
00:02:13 – let's open the library and right here
00:02:17 – when we call a baton skit called set up
00:02:20 – and we have to win this script to
00:02:23 – install the library on the Raspberry Pi
00:02:27 – and we do this with the command sudo
00:02:30 – bikin set up top by install and it takes
00:02:37 – a while it's installing let's check out
00:02:41 – all the shell recognized lively you open
00:02:45 – the Python 20 and type in the import
00:02:50 – Adafruit DHT and we get no errors so
00:02:56 – everything works move I hold a small
00:02:59 – python script to test the sensor and I
00:03:03 – import the library and I import another
00:03:07 – library called time and I made our
00:03:09 – endless loop because ALS will be always
00:03:13 – go so this loop is non-stop and I'm
00:03:18 – gonna read two values you win at the end
00:03:21 – temperature from the sensor and on the
00:03:26 – Raspberry Pi on pin for and that's the
00:03:30 – GPIO pin which I explained in the
00:03:34 – previous video and that's a tpo pin for
00:03:38 – or if you start counting from the upper
00:03:41 – left corner it's pin number 7 connected
00:03:45 – to the data this is pin number 7 and it
00:03:49 – connected to signal and ground and fold
00:03:55 – and fold is to 3.3 which is the first
00:03:59 – most left top one back in the skip if
00:04:03 – Python hits normal sensor values then it
00:04:07 – will print them and if not then it will
00:04:12 – print cannot connect themselves and then
00:04:16 – it sleeps for one I tested the script
00:04:20 – and everything works as expected I
00:04:23 – updated the sketch
00:04:25 – to save the incoming sensor values
00:04:28 – inside our CSV file and CSP sensual
00:04:33 – comma separated values and in this file
00:04:40 – I save the time and that on one line and
00:04:45 – that works with those three lines of God
00:04:48 – so it is stored inside our file called
00:04:53 – temp and we can check this by opening
00:04:57 – inside the JC image on the office that
00:05:04 – is our program called calc and if you
00:05:08 – open this it's like Excel from Microsoft
00:05:12 – and we go to file open and is called
00:05:15 – down then here we have our temp file and
00:05:19 – if we open it then we cut out the in the
00:05:25 – e call week at the temperature and in
00:05:29 – the bicol week at the time and I played
00:05:33 – a little bit around with the center I
00:05:36 – put a hot cup of tea close to it and I
00:05:40 – let cool it down and I don't I put some
00:05:44 – cold water in the cup and you see that
00:05:47 – it's dropping then I will remove the gap
00:05:50 – and it is rising back so we get some
00:05:53 – variety in our temperature data now we
00:05:57 – called everything opening and center
00:06:00 – failures are flying in like spaceships
00:06:03 – inside our star war movie and I was
00:06:07 – thinking wouldn't it be nice if we
00:06:10 – display the temperature value inside our
00:06:13 – graphic well the beauty of python is
00:06:17 – that they have libraries for almost
00:06:19 – everything and a good library to display
00:06:24 – traffic is called met plot flip and of
00:06:29 – course we can linux system we can easily
00:06:33 – download this with this command line so
00:06:37 – let's say
00:06:38 – but basis one in the terminal and it
00:06:41 – starts downloading from yes and
00:06:43 – congratulations we got our new library
00:06:47 – installed let's test it in the shell or
00:06:49 – everything is set up in the right way
00:06:51 – open ridin and import muds plots lip and
00:06:59 – everything looks good and with this
00:07:03 – library I hold a new Python script and I
00:07:08 – importer the script and avid winning and
00:07:12 – this script is he making a graphic and
00:07:19 – he you can see the data it was nineteen
00:07:22 – decrease all the time and then i heated
00:07:24 – up with a cup of tea and then it cools
00:07:28 – down and because the other script is
00:07:32 – still running so I caught the other
00:07:37 – script still running it's still updating
00:07:39 – the CSV file and I'm pulling down the
00:07:43 – sensor on this moment with some ice
00:07:47 – cubes so you see a huge interaction in
00:07:50 – the life traffic just for this video I
00:07:55 – turn down the date-time from 60 seconds
00:07:59 – to 60 seconds and because we have two
00:08:05 – scripts running on the moment we got our
00:08:07 – life update from this graphic every six
00:08:11 – seconds i will put a link from all the
00:08:15 – code in the description of the video
00:08:17 – hope you like it and please subscribe to
00:08:23 – my youtube channel i'm going to make
00:08:25 – another video about the raspberry pi and
00:08:28 – how you can interact with sensors with
00:08:30 – the c language hopefully all this
00:08:33 – terminal and command-line notice wasn't
00:08:37 – too boy


Video Url:
http://youtu.be/PNbsyHocM2U

Comments

comments