[adrotate banner=”7″]

What we’re going to talk about today is we’re, going to talk about the concept of analog inputs on the Raspberry Pi and to kind of put this in perspective. We need to just take a second and look at the big picture of where we are you’ve, been through 31. Lessons with me and we’re now ready to talk about analog inputs. Now, if you’re like me, most of you probably didn’t, start with the Raspberry Pi. Most of you probably got started on the Arduino Uno: okay and the Arduino Uno was the introduction to kind of micro processors as a circuit element and as a sort of user book user. Controllable thing to me and when I got this I was just absolutely amazed. I was amazed that I could take it out of the box and in ten minutes I had the software installed. I was blinking LEDs. I was dimming LEDs. I was reading from potentiometers and just all these things analog right, digital right, digital read in analog, read man. I could just sit there and I could just do everything I wanted with this huge array of different elements. If you’re like me, you love the Arduino, but you reach the day that you could no longer do everything that you wanted to do on the Arduino and for me, what the situation was was not that I didn’t have enough pins or not that I didn’t have Enough functionality on those pins, but what happened is basically.

I was trying to do a project of complexity that I ran out of memory on the res on the on the Arduino Uno. And for me that project was the project on the Arduino, with Python series, where we were hooking up a GPS to the Arduino. I had a GPS and I had an SD card reader and then I wanted to add a pressure sensor and a temperature sensor, and what I found was was that once I loaded up all the libraries for the GPS and loaded the libraries for the SD card, There was no more room to do the pressure and temperature sensor, and so it was so like just shut down. Then. What I also found is: is that there’s just really no practical way to add memory? It’S, not you know, there’s, just no easy way and so you’re just sort of up against a brick wall. At that point, that’s how I got into the Raspberry Pi now is you started playing with the Arduino or if you did these lessons, what you saw is really quick. You could do analog, writes you could do digital rights, you could do digital reads and you could also do analog reads from the pins. You could do things like read the resistance or read the voltage off of a potentiometer. So at that point you could do pretty much anything you wanted to now as you’ve gone through these lessons on the Raspberry Pi, which you’ve seen that we can do with our GPIO pins, we can do a digital write.

We can also do an analog write by simulating analog right with PWM, well really that’s what you were doing all along on the rest on the Arduino all along you were really doing a PWM. If you look at that, underneath those pins, it says digital PWM and then the squiggly. What that’s saying is the pins with the squiggly, where we thought we were getting analog output. We were really simulating analog output with PWM and in the Arduino it’s very simple, but on the Raspberry Pi it’s, doable, it’s, straightforward it’s, just you know: it’s, just not a just single line command you’ve got to kind of think about and do a little bit more. A little bit more setup, okay, so now on the Raspberry Pi, we can do everything that we could do on the Arduino, except for analog read so now what you’re ready for is ok now I can just get rid of the Arduino and just show me how To do the analog grief and remember the analog read if you will look at those at those pins up at the top it at the top, where it says analog: n a0 to a5. Those are the pins that you can do. An analog read on the arduino. This is the thing the Raspberry Pi does not have anything equivalent to an analog in. So you remember on our lessons when you’re reading button States that’s about as good as it’s going to get as far as what you can read on the on the Raspberry Pi, there are no analog input pins, so we are stuck as far as really moving forward On the on the Raspberry Pi, so how do you deal with that? Well, when I look at the different things around the inner now there’s, some chips that you can get and those chips will sort of do kind of like a d2a or or sort of an A to D.

They can kind of take something off of your potentiometer and they can put it over there in something that can be read on the Raspberry Pi. But at that point I really don’t want to fool with it. What I think the easier solution is is, to just add a Arduino, your lovely Arduino that you already know how to use add one of those to your Raspberry Pi. There are really some small ones. This is the Arduino Nano let’s see if you can get a look at that the Arduino Nano is really very, very small, and this is kind of like a full feature. This is a full featured. Arduino works just like the Arduino Uno, but you can see that it’s much much smaller and then, if you’re you’re willing to sort of program them a little differently, there’s some Arduinos that are even smaller than this. And so, when you reach that wall, where you really have to have analog input, what I suggest is the simplest thing is to get like an Arduino Nano. You can pick one of these things up and knock off for about 10 bucks or the authentic ones are about 34 and add it as a circuit element. Add it as a circuit element to your Raspberry Pi circuit. Now, how do you talk and operate between the Raspberry Pi and the Arduino? Well, what I like to do is I like to have the Arduino do as much of the interaction with the sensors as possible and then kind of set up a client server relationship with the raspberry pot, where the Raspberry Pi is the client and the Arduino? Is the server if Raspberry Pi wants temperature, it tells Arduino to measure temperature, it measures, temperature sends it back, and so that way you can use the analog input capability as well as all the things you already learned about Arduino and then all you have to do.

Is get the Arduino to talk to the Raspberry Pi? Well, how do we do that if you’ve gone through these lessons, you already know how to do that. Let’S go back to my website. Ah let’s see uh top tech boy comm let’s go back to that website. Remember in this first series of lessons we learned how to use Arduino well in the second set of lessons. We learned how to use Python with Arduino. So remember we had Python running on the PC and then python was talking to arduino over the serial cable over the USB cable and so python talking to Arduino Arduino talking to Python. You already know how to do that, or you can learn that by going through this most excellent series of lessons here now think about it. We are running Python on the Raspberry Pi. So what does that mean? We can have the Raspberry Pi in Python. Talk to the Arduino over the serial cable and all these things we learned in these lessons using Python with Arduino all of these 17 lessons. You can then apply to this configuration. Another thing I also showed in these lessons. Let’S see. Where are we, I showed in these Arduino lessons how you could make the Arduino work over Ethernet, so you can have the Arduino hooked to Ethernet. You could have the Raspberry Pi hook to hook to Ethernet, and then the Raspberry Pi could be controlling the the Arduino via ethernet.

So if you really want to get fancy, you can do it over Ethernet. I have the. I have the lessons here on how to do that: let’s see ah yeah, and then here I have the lessons on on on how to do it over Ethernet or I’ve, also shown how you can do it in these lessons over serial. The simpler way would be just to hook a USB cable from the Raspberry Pi over to the Arduino, and I even showed how to do it with XP radios, and so you could hook an XP radio very simply to the on to the Raspberry Pi. On the USB, just like you would on the PC and then have a heaven xbradio over here on the arduino and talk back and forth, like that, all of those things you will learn if you just go in and take these using Python with Arduino. So where are we what’s the bottom line? The Raspberry Pi has the pretty much the power of a full blown desktop computer, but it also gives you access to input and output pins. The limitation is, is that you cannot directly do analog read when you get to that point, bring back your old Arduino hook. It put it in the circuit. Simplest thing talk over serial and get things running that way. Ok, so that is pretty much where we are going as far as the Raspberry Pi, using it with the GPIO pins, probably up next we’re, going to look at some of the power of the Raspberry Pi having it take advantage of that power in doing things that Are more like desktop computing types of things, and so we will see you again shortly if you like these lessons, give us give us a thumbs up.

Think about sharing lesson. Bleep comments. Man give me some feedback. Let me know that some people are listening to these things: Paul McWhorter top tech boy comm.


[adrotate banner=”1″]

Paul McWhorter arduino lesson 32 Video

[mam_video id=uO5ubW1KlnI]



[adrotate banner=”2″]


[mam_tag id=5622]



[adrotate banner=”3″]


Paul McWhorter arduino lesson 32 news






[adrotate banner=”4″]



Paul McWhorter arduino lesson 32 Social



[adrotate banner=”5″]




We’re opening the Arduino IoT Cloud to other platforms, starting with the ESP8266 by Espressif Systems — NodeMCU, SparkFun’s ESP Thing, ESPDuino, and Wemos (to name a few) — along with other inexpensive, commercially available plugs and switches based on this module.

How fast can you run the 40-yard dash? Find out with your own wireless timing gate system.


[adrotate banner=”6″]