This is the second project (1B) in the Sparkfun Inventors Kit.

Transcript

Hey guys it's Christian here from Core Electronics. Today we're going to be assembling circuit, 1B from project set 1 in the Sparkfun inventors kit version 4.0.

So similarly, to our last circuit, circuit 1A, we'll be using an LED a resistor and some jumper wires, but now we have an added analog component, called a potentiometer. So, a potentiometer, is a 3-pin variable resistor and the way that we'll be connecting it up is between 0 & 5 volts. Now between 0 & 5 volts it will create a voltage divided on the third center pin and that center pin will give a quantized digital reading to the pin that we're going to connect it to analog 0, and essentially what that does is it just tells us where this position is, where it is turned to.

So that is what we're going to be using to create the delay that we had set in the previous one to 2,000 milliseconds, so connecting it up we use this flush side and we keep that closest to that insulated centerpiece, we're going to connect the positive pin, well it's not polarized, so we're just assume in a positive pin but we're going to connect the top pin to the positive power rail and we're going to connect the bottom pin to the negative power rail.

Then we're going to connect this blue or we're going to use this blue jumper wire to connect the center pin, to the analog 0 port and we're going to connect the power bus, so we're going to have plus 5 volts connected to the positive and ground connected to the negative.

Now as mentioned in the previous video, it's important to connect the LED in the right fashion and the way that we're going to do this is we're going to connect the long leg to A2 and the short leg to A1. 

Now we're also going to use the resistor as we did in the previous one to limit the current, so E2 to F2, it's going to bridge that little gap and then we're going to connect E1 to the negative rail and we're going to connect J2 to pin 13.

Okay now that that's all connected we're able to connect the red board to the computer and open the Arduino IDE. 

Now since it's an analog component that is one new thing, that we've got in the circuit and we're going to add another new programming element. So, we'll see here that in our set up, we still want the pin mode of pin 13 to be an output and these analog pins we don't have to specify whether they're input or output because they are inherently inputs. So, at the top of the loop function we want to write something that is going to store the value of the current potentiometer position or the current potentiometer value. So, we're going to call that "int potpin" and then we're going to close it so potpin, will be equal to analog read, so we use the function analog read because it's not reading a high or a low it's reading about you from 0 to 123, or 0 to 5 volts. So, using that analog read function it'll give us more degrees of freedom in what it's registering, so we're going to analog read A0 and that means that every time this loop is done, it's going to read in that value.

Then in our delay that were written before we're going to write potpin and potpin. Now what this means is that the value stored in potpin, that's just been read will be now the value that's used in the delay and since that's in milliseconds and it's going up to 1023, that means that we can have up to, one point zero two three seconds delay and we can have down to essentially no delay.

So, once that's done we're going to file, save as, and this will be, circuit 1B, then we will upload that sketch, so I'll first compile it and make sure that it's got no errors or bugs in the code, it's uploading and now that it's done uploading, you'll see that as we turn this the delay between will become longer and if we turn it downwards it'll become a lot shorter until it's flashing really quickly.

So that there has been circuit 1B. I hope you enjoyed it and I'll see you in the next tutorial while we'll do circuit 1C.                

Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.