Raspberry Pi Pico LCD Projects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] welcome to another video from explaining computers.com this time we're going to connect this LTD module to a Raspberry Pi Pico microcontroller before testing out some project applications so let's go and get started in this video we're going to be using this Raspberry Pi Pico and probably later also a Pico W along with this liquid crystal display specifically this box contains a wave share LCD 1602 I squared C module which means it's got a 16 character by two line display and connects to the peakovar and I squared C interface and I'll say a bit more about that in a second I chose this module because it's one of the cheapest ways of adding a small display to a Pico although the price varies significantly depending on the retailer as I'm shooting this video in late May 2023 it's listed for seven pounds 70 at the pie Hut 12 pounds 99 on Amazon co-uk and 12.99 on amazon.com and I'll provide links in the video description note that there are more expensive versions of this display available that have a programmable RGB backlight this has got a blue blacklight I think we will find out and there are also similar LCD I squared C products on the market from other manufacturers and the control code may vary slightly for different Hardware but hopefully this video will communicate some generic principles so let's open this up very very simple unboxing it just flicks up Panda there we are things are inside this is the module itself funny obviously we've also got a cable nice that's actually supplied the module itself is a little anti-static bag as we can see and oh it's receivable no need for a cutting implementations and tools straight in here we go I've always wanted to play with one of these now if I have done before so today is the day and uh there we are take it off this little thing and yes there is our display we can take off a little piece of a thing like that looks rather good doesn't it and on the back of this there would be a connector let's look around like that and if we take a closer look at the connector we can see there are just four connections involved VCC and ground for powering the display which requires an input of between 3.3 and 5 volts and then the two other connections are for the I squared C interface also known as i2c this stands for inter-integrated circuit and is a Serial interface which has connections for serial clock or scl and serial data or SDA and so there we are this is our module seems to be a very nice little device it's quite weighty for its size probably because we've got a glass on the top with a display and also this bezel is metal so it seems to be a good quality component and if you're wondering this can be used with other microcontrollers aside from the Pico you can use it with Arduino if you want for example you can use it with singleboard computers like a Raspberry Pi or a Jetson Nano but here we are going to stick with a Raspberry Pi Pico although the general principles we're going to look at will apply to other platforms foreign test I've now got the display connected to the picot with the cable across there's just four wires as we can see in this diagram two for power and two four I squared C and so I've got a USB leading to the Pico as well so I'm just going to connect that to the PC I've got a extension lead off camera here oh it's all moving around let me just get that plugged in make it come back again I'm going to use a breadboard a bit later on but oh there we are the thing has come to life there's clearly power in the system which is good stay somewhere on the desk for me there we are that'll be okay and if we now go across to the PC here we are on the wave share page for this particular module and there's great support here as you will see if we go down they'll tell us all about the board there is support for working with a Raspberry Pi for working with a Raspberry Pi Pico just down here same wiring diagram as we just saw and there's a web address here for downloading the firmware so I'll just uh highlight that again and do a copy of that drop down cutting and there we are it'll download the file and it's going to stick it into my download Pico stuff folder that is a absolutely fine like that very small file I'm sure and if we just go across to that folder there it is it's come across down there we can just open that up and we will extract all here is okay there we go that's all brought in the files and I imagine this files for lots of things there are a lot there's files for the Pico Raspberry Pi Jets and Nano Etc here's the files we've got for the pickup so let's now run up Sony and because the Pico's connected if we now go to view and to files it should show us files both on this PC and also on the Pico picker down here PC at the top and it's gone to the roughly the right place there's we've just downloaded the files there are hopefully the files areas where we just saw here three files let's just highlight these and that and that and if we do an upload to like that it'll Chuck those files across to the Pico and I imagine the first file here is a driver of some kind if we just bring that in looks like a driver to me or straight away there's lots of a driver type stuff but it's just a python style you can edit it yourself if you wanted to but to test things out we'll go to a file labeled test dot Pi which I imagine is a test which as we can see Imports LCD 1602 there to drive the file so let's uh bring back in a shot of the display and we will now execute this code very exciting oh look it says wave share hello world things are clearly working okay so if we just stop that code it uh clears the display which looks like that's what it does down here yes at the bottom it clears the display after it's finished we could of course change this let me just to rapidly change the text there we go and if I just save this code under run again yes we've got control of the LCD display and I see we've also got a piece of code down here called A time test so that's to check that out too I imagine that's something to do with a time under oh look we've invented a digital clock this is this is really cool I'm very pleased with this little display it's a nice little device it's got please do projects written all over me and so now we will move on to use this in some projects foreign I've now inserted the picot in a breadboard and I've mounted everything to a baseboard so the display won't go wandering around again and I've also added in a push switch which is connected between the 3.3 volt Rail and pin one as we can see in this diagram which shows what I've added to our previous wiring and as we can see Stanley is now saying hello on the LCD which I forgot to tell you has got a display area of 64.5 by 16 millimeters so let's go across do some sample programs I've been experimenting with and the first one here just highlights the basic principles where to use this module we first of all import the python driver and then set the display to be a 16x2 display and here I'm also importing time so we can use that in our code and what I'm doing here first of all is clearing the screen with the LCD clear command because the screen retains whatever you sent it previously until you till you clear the screen and write something else talking of which the basic principle here is we set a cursor position and then we print something to that position which can either be a string as we got here or it could be a numeric variable and here in this test we're then waiting for two seconds and then printing up Stanley's message so if we run this code like that it says this is very exciting and understand this message appears on the screen so let's go across to something a little bit more practical this is a counter example Imports modules again but also here import pin so we can use our switch and specifically here we're setting up the pin on gp0 which is actually physical pin one that's why there's a zero here when we're connected to pin one and we're setting this up as an input with an internal pull-down resistor and if you want to know more about this I covered this in detail in my video which was all about using switches and servos and things like that with a Raspberry Pi Pico after that here we're setting up a counter we're setting the counter value initially to be zero and printing it on the screen with the word counties and then we've got a little Loop down here which while true is always true service Cycles through forever and in our second while loop here switch value will be true when the switch is pressed so when the switch isn't pressed everything here is ignored this keeps cycling through but when the switch is pressed it adds one to the counter it prints the counter on the screen again because obviously it's changed and then here while switch value is true this will cycle on until we release the switch in which case we go back on again and continue through so let's run this code very exciting and we can see on the screen it says count is zero but if I take the switch and press it count is one two three four and if I hold down the switch you see it doesn't do anything until we release it it's properly debounced and trapped and everything like that so this is a very effective little counter and of course here I'm counting using a switch pressed by a human being but this could be a contact somewhere all sorts of things could be counted using this type of system I find this very exciting indeed but you might be thinking is there anything even more exciting we can do and there is because if we go across to our third piece of code I'm sure some people are asking does it game and it does game I've written for this system the most exciting game probably in the whole world and it starts off as we did previously setting things up with the switch and then we've got a section called get game ready which prints the instructions on the screen to try and hold down the switch for 10 seconds we then got a large loop which goes on all the way through and what basically happens here it waits until the switch is pressed by cycling on through here until the switch is pressed and then it records a start time using a time.time NS which basically records the current time in nanoseconds the Pico won't know the actual time it'll never time since it was turned on but that's absolutely fine but after that it clears the screen and tells us the game is in play and then after that it waits until the switch is released I'm sure you would have guessed that was about to happen and then after that it works out the elapsed time taking the current time minus the start time reports the actual time that's elapsed and then gives us some feedback on what it thinks about our performance so let's run the game it is as I've said already very exciting and it's inviting us to hold down the switch for 10 seconds so let's just do a simple test initially just to check it's all working that wasn't 10 seconds that was three seconds which was useless should I have a better go let's try a counting cups of Tears animators always do one cup of tea two cup of tea three cup of tea four cup of tea five cup of tea six cup of tea seven cup of tea eight cup of tea nine cup of tea ten cup of tea well there we are that was 10 seconds it was perfect do you think I can do it again one cup of tea two cup of tea sweet cup of tea four cup of tea five cup of tea six cup of tea seven cup of tea Equity nine cup of tea 10 cup of tea that was eight it was fair I should have stayed with the the first result shouldn't I anyway the game clearly works it's very exciting probably the most popular game in the world in a couple of months time but I think we're now going to move on to incorporate the display into another project greetings here I am back again and I've now dug out the anemometer that I built in a video a few years ago and this was initially connected to a Raspberry Pi 3 B plus but it's now connected to a Raspberry Pi Pico and LCD display and as you can see this is disconnected from the computer this is entirely independent it's got a power bank to power it and if I turn on the power bank like that it says measuring wind speed let's give it some wind there we are that was a wind speed of I managed to achieve 5.03 miles per hour it basically measures wind speed over a period of of 10 seconds and it's continuing to do it so it's now dropped down to a 0.74 it might it must have been just finishing on the end of that 10 seconds of the first sort of cycle if you like it'll drop down to zero in a second I imagine because there'll be no more yes there's no more wind speed going on let's uh give it a bit more wind speed like that and the way that this works is that inside here there's a disc on the spindle and this has a white mark on it and under the disc is a sensor with an infrared LED and when light from this hits the white mark it reflects back to trigger an infrared photo transistor which in turn allows us to measure rotation and calculate wind speed a little control board contains the necessary current limiting and pull down resistors with the wiring to the picot being as we can see here in this diagram and which once again I've added to what we had earlier to make this work the code is obviously saved on the Pico it's saved as main.pi so it auto executes when the picot boots up but over here on the computer I've got a copy of the code just you can see roughly what's going on it's pretty similar to what we had previously at least at the start it Imports the various things required for LCD and it sets up gp28 to be an input we don't have to set a pull down resistor because we've got a physical pull down resistor in the circuit for the ammometer and then down here we've got various calculations to allow us to calculate the speed of the wind from the rotation of the spindle and then we've got a loop which does just that it runs for 10 seconds makes the calculations and then puts the results onto the LCD display and if you want to know the detail of how this works look at my video about creating a Raspberry Pi alemometer and I'll provide links to all code in the video description anyway having demonstrated how this works sitting on the desk I think we should now Take It Outside you can see there's lots and lots of cable involved so we can get this at the top of a pole so let's go and do just that and here we are outside let's turn things on like that and I really must get a rolling stone in at some point to help me deal with all the Moss around here but uh as we can see we're measuring the speed of the wind I've got the center of a pole about nine or ten feet high it is going around a little bit not massively but it is going around and yes it's giving us a wind speed 0.37 miles an hour this thing is working there's not a lot of weather here today it's rather dull not very windy sister non-weather but anyway the key thing is this is working we've proved a principle this could have cut all be put together into a much smaller unit and I like the idea it can be battery powered you could come out turn this thing on take a measurement turn it off again that will work very well indeed and it's also I think always nice to revisit an older project to add a new component which here of course is our LCD display so there we are we've tested out various applications for an LCD module connected to a Raspberry Pi Pico and I hope it's given you some interesting project ideas and at the very least it's given me the opportunity to give my homemade anemometer another wool but now that's it for another video if you've enjoyed what you've seen here please press that like button if you haven't subscribed Please Subscribe and I hope to talk to you again very soon [Music]
Info
Channel: ExplainingComputers
Views: 105,234
Rating: undefined out of 5
Keywords: Raspberry Pi Pico, Pi Pico, Pico microcontroller, LCD display, I2C LCD, I2C LCD display, Pico LCD screen, Pico LCD, Waveshare LCD, Waveshare I2C, MicroPython LCD, Pico MicroPython LCD, MicroPython, micro python, Christopher Barnatt, Barnatt, Pico project, Raspberry Pi Pico project, anemometer, pico anemometer, measuring the wind, measuring wind, Raspberry Pi anemometer
Id: UJjAryNI9fs
Channel Id: undefined
Length: 17min 25sec (1045 seconds)
Published: Sun Jun 25 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.