Have you heard about the Circuit Playground? It's the new all-in-one electronics platform from Adafruit. It was created to bring all the fun features of electronics and physical computing to makers, but It's dead-simple to use, solderless and extremely affordable.
?Getting Started with Adafruit's Circuit Playground
Hey guys, Aidan here from Core Electronics and today we’re going to take a look at Circuit Playground which is one of the newer boards from Adafruit. Adafruit have decided to take a bit of a step away from the microcontrollers for a bit with this one and they’ve actually just loaded this board up with sensors, LEDs, the lot. It’s all capacitive touch sensing pads that go around the outside of this circular board. It’s portable, it’s everything, this board is just an entire playground for young minds, old minds, whoever’s interested in electronics to just get their hands on and just go crazy with all the different features on board.
What we’re going to do is take a look at those sensors, really quickly we’re just going to go around and see sort of a definitive list of what’s on board and then we’ll take a look at how we can set it up and use them.
So we’ll just start with the processor which is always a good place to start. So you can see right here at the centre of the board we’ve got the Atmega32u4 which is just an Atmega Processor and an 8 Bit Microcontroller that we see in a lot of Arduino boards. Some of the big features that we do see round the board off the bat are these two big switches, these are just two big push switches and we’ve got a slide switch here as well so that’s 3 switches in total, ah actually and we’ve got the reset switch, almost forgot that one. At the top of the board, the interesting thing is it’s a circular board which I find is pretty strange, usually you don’t see that so that’s something to take into account and around the board we’ve got pretty much a feature at every angle. We’ve got something that we that we can play with or use, something to get our hands on so, at the top we’ve just got the Micro USB Port and you can use that to power and program your Circuit Playground. And then we’ve got these alligator clip friendly pads that go around go around the outside. Like I said before they’re also capacitive touch sensing, so you can interface with those in a bunch of different ways as well. As we move around all those pins are actually the pinouts, there’s no headers on this board at all, it’s just alligator clip friendly.
As we move around the board we start seeing the pin labelling, you know number 10 here, number 9 here, we’ve got ground pins, battery pins, TX and RX pins. We’ve got a clock pin, data pin for I2C, we’ve got all the pins that we need but they’re in a completely different orientation than we usually see.
On the bottom of the board, which is this side here, we’ve actually got a JST connector like a female connector for a Lipo battery and it’s also got a voltage regulator so you can plug a battery straight into it and power your project on the go, no mucking about, it’s just all there and ready to go. So, that’s sort of the outline of it.
Diving into the insides here, around the outside here we’ve got the 10 mini neopixel LEDs, these guys are all addressable on their own, you can just say, pin one light up, LED one light up and light up to this colour so they’re all addressable and controllable through your IDE which is a great feature. We’ve got the temperature sensing resistor here which is up the top here so we can actually find the value in degrees celsius or fahrenheit as part of the library, that’s that part there. Just underneath it we’ve got a sound sensor so that’s like a little microphone, you can actually tell the levels of the audio that’s happening in the room, we could do that right now if we wanted. We’ve also got a little speaker here which can play a tone which is pretty cool and we’ve got the light sensor over this side of the board.
In the very centre of the board we’ve actually got a little accelerometer which I think is probably one of the coolest parts about this little board. Adafruit have pretty much bundled up all these things for thirty bucks so you can get yourself one of these for thirty dollars and you get all those sensors and all the fun without having to go and buy yourself a kit that’s worth a hundred dollars or something like that. That’s not to say that anything’s wrong with kits, I just think that idea of grabbing yourself one of these, one of these, and just having a ton of fun with such a tiny board is sensational.
So, lets jump into setting it up and then that way you guys can get to making and inventing which is what we all want to do at the end of the day. The first step we’re going to set up our Circuit Playground in the IDE which involves downloading some drivers, so if you go to our tutorial or we can watch it in the YouTube video here, just go to the download link and download those drivers. Once you’ve got them downloaded run through the install just like any other time we’re doing an install on this thing. So we’ve got that done, Umm right, so the next step will be jumping into the IDE and doing a few things on that side of it. If you go onto our tutorial page or you can grab the Adafruits boards library, from the, just get the link from the video below in the comments section below and go to your IDE. So once you’ve got that open you want to go “file” which is up in the top left there, “preferences” is the next step, go about three quarters of the way down your preferences box and you’ll see an Additional Boards Manager URLs field and you can put what ever you want in there and you can see on the video here that I’ve got already a Sparkfun one and an Adafruit one in there so if you’ve got something else in there you can just put a comma and then paste in the Adafruit one. Or if you’ve already got the Adafruit one in you’re done, you’re fine there’s nothing else for you to do here. Next step would be to go to your boards manager and download the info you need, so go to your boards manager. That might’ve gone a bit quick, that was in “Tools”, “Boards”, “Boards Manager”, once you’re in there we’re going to type in AVR, so type in AVR. Now there’s one by Arduino which is probably installed by default, so if you scroll down just a little bit you should find the AVR Boards by Adafruit so you want to grab that one. Once you’ve got that installed, should only take a few seconds, we will go ahead and include the library. So we all know that the libraries are pretty much the instructions for our IDE to be able to talk to our specific board or specific module using different pinouts and all that sort of stuff.
So what we’re going to do is grab the Circuit Playground library, so type in Circuit Playground and Adafruit have got their library up there which is pretty much prepped everything ready to go. So grab that one there as well, make sure that you’ve downloaded those drivers you’ve installed those, you’ve got those two things out of the way and we can take our next step.
So the first thing we’re going to do is open some examples. This is a micro USB cable and it is a data USB cable it is not just a charge USB cable so you guys want to make sure you go ahead and grab yourself a data USB cable and not just a power one. Thats a very important point, next important point is if you’re doing this with a laptop the Circuit Playground can draw a bit of current, it might not be safe for you to use it with a notebook or something so if you need to grab a powered USB bank or something which is why we’re using our one. So I’m just going to go ahead and plug this in (plug it in, just like that, awesome, try and get that in the shot for you guys). There we go, so you can see our Neopixels are running through the usual stuff. Now, if we go to “file”, “examples” and scroll down we should find “Examples from Adafruit Circuit Playground” which is exactly what we want and what I’m going to do today is just going to take a look at the demo. We’re just going to take a look at the demo because we’ve got a bunch of examples here on how we can interface with the sensors and it’s a really simple way to go through it and figure it all out. So like any Library we see at the top there’s the include for the Circuit Playground Library, which is that one there, and also got the Wire and SPH Library which is important and then they start the serial begin, they call it the Circuit Playground test, and then they begin Circuit Playground and that sets all of the things up for us to be able to do what we’re about to do.
So we can test the red LED so the first thing they do is blink the red LED on and off which we can see is happening right there. We’ve got the capacitance of the touch pads around the outside of the board and that’s going to be displayed to the serial output so we’ll be able to grab on to them and see what the change is with those things which is cool. So you can see that that’s the, ah, function there serialplayground.readcap and then in the brackets just the pin number that we want to read. The Slide Switch is the next one, so the Slide Switch is this do this else do this which is just a normal thing. So if the Slide Switch “is”, the Slide Switch returns a Boolean true or false value so if it “is” print that it’s to the left, if it’s to the right print that it’s false. So that’s the two states that the Slide Switch can be in and the two things that when you read the value of it you’ll get.
Moving down, we’ve got the Circuit Playground Set Pixel Colour, so using that we can set the Pixel number, I believe it starts from, looking at the board, you’ve got zero and it moves around to 9. So 0 1 2 3 4 5 6 7 8 9 and you go around and set those to your colour so that colour is just given in RGB format. So that’s one way to set your Pixel colour. Similarly you can clear the Pixels as you can see in this part at the end once we get through that loop it all, they all turn off. So we do that with “circuitplayground.clearpixel” and that turns them all off which is pretty simple.
What else have we got? The Left and the Right button, similarly to the Slide switch, they just return a true or false which we can do and it will tell us in the serial monitor later on when we have a look at that. We’re going to read the light sensor and tell us what the light sensor value is, that’s going to give us an analogue value same as the sound sensor so me talking should influence the sound sensor. Next step would be the Accelerometer of course, like I said that was at the centre of the board and we can read the values in an X Y and Z direction and that’s the value of motion so its in metres per second per second acceleration and we’ll be able to, just moving it around like this will change the readings. If we sit it down on the table it should say zero in the X and the Y axis but in the Z axis it will still measure gravity just like a little thing that happens with Accelerometers. And of course we have the Thermistor which is the first sensor we looked at which is up the top there and that’s just the thermometer that we can test out in a second. So lets give that a go, I’m going to make sure that that’s on my board, I know that thats already the demo code but if you guys didn’t this is what we’re going to do. Go here, “Board” I’m going to make sure that we have the Circuit Playground selected, “Board”, “Circuit Playground”, “Adafruit Circuit Playground”, is on COM 8 for me today and we’re going to upload it. So we’ll wait for that one to upload across, hopefully it all works well, if not it is running Demo code so we should be fine. Awesome, now we’ve got that uploaded and we’re on the right COM port and we should be able to open the serial monitor for that COM port, so “Serial Monitor” there you go and we’ve got COM 8 talking to us so lets just have a look at this data and see if we can break it down. Looking at the bottom one we’ve got, from the bottom, its autoscrolling but bear with me, the last thing that we read like we saw on the sketch will be the temperature, so it’s currently 28 degrees in here, celsius, which it kind of feels like, it’s starting to get onto Summer here in Australia and it’s pretty toasty. We’ve got the acceleration, so very small amounts of acceleration data here on the Accelerometer but like I said that’s gravity there in the Z direction so that’s measuring gravitys pull on the thing. As I’m talking we can see that the sound sensor is going up and down so that’s good. Covering that over the light sensor is going towards zero, it’s tending towards zero as I’ve got it covered up but when I expose it it jumps right back up there which is cool. Let’s have a look at this Slide Switch which is the next line up from there, what happens when I turn it, (beeps) so that’s the little speaker playing its little jingle and as I happen to move it to the right so if I look at that now it will actually say slide to the right. So it’s telling me the current state of the switch which was part of that “if” statement that we read before.
And as we go up we’ve got a bunch of capacitance readings, so Capsense, and it tells you the value thats being read from each of these little pads. So, lets test this out, we can get that Serial Monitor up with this so I’m going to grab pad, let’s see, pad 2, no, we’ll grab pad 3 it’s the top one. So I’m going to grab that and we’ll see how that changes on the screen, so thats just jumped up to 7000, 6000 down to zero. Thats pretty quick, it’s reading it, it’s reacting, there’s some cool stuff about these things as well, so the Accelerometer can actually read tapping so when you tap the Accelerometer it can read that it’s got that bit of jerk and actually react to it. It can also measure free fall detection, so it can measure when its just free falling which would be cool if you wanted to turn a project off in mid air or something like that if you were to drop it.
So there’s a few little like niggly things that you can take a look at Adafruits write up for their library but this was more of a run through of what the board is, how it’s all getting thrown together and how to get you guys started as quickly and easily as possible so you can make things.
I just want to take a quick look at one more little project that I think is interesting, so it’s just part of the Circuit Playground. We’ve got a mouse here so you can use your Circuit Playground as a mouse, it’s awesome, but the one I was going to look at is just the VU Meter which I think is quite cool. So that is reacting to my voice, if we can see those LEDs on the camera there, if I talk to it, Yeah, see! I just think that’s cool, that’s all it does I’m pretty sure, I think that’s pretty cool.
Yeah! Thanks for watching guys, I hope that you guys learned something about the Circuit Playground. Remember these boards are like so cheap, for what you get, like all those sensors all that stuff for 30 bucks. Grab one, get it out of its packaging watch this video again and play with it heaps. Let us know on the forums or in the comments what you made with your Circuit Playground. I’d love to hear about it, its just exciting to me :-)