woodworking tools for the beginner

woodworking for beginners the beginner's guide to woodworking woodworking is 100 that can also be arewarding profession if you love to ...

Ads


electric wood branding iron custom logo


hey i'm bob and i like to make stuff, and today i'm going to make some bike lights, that are motion activated. [intro] this video is sponsored by intel, and

electric wood branding iron custom logo, they challenged me to come up with a project, to take advantage of some of the features of their brand-new arduino 101 board. this is an arduino compatible

board but it has a real-time operating system and a 32-bit processor. the size and shape is almost identical to the arduino uno but it's got extra features on it as well. on board, it's got bluetooth low energy, which is really awesome. and a six axis gyro and accelerometer. you can get those features in other modules, but it's really nice to

have it built on board for quick prototyping. so, intel asked me to come up with a project using just the board and the onboard sensors. and for a while i've been considering making a lighting system for a bike based on an arduino. so in this case, i decided to use the accelerometer on board to change the brightness and color of the lights based

on motion. right, let's check it out. there wasn't really any circuitry to put together, in fact i just had to solder a few wires. in this case, i soldered on some pins to the end of these wires and then slid them into a connector. this connector connects to the battery, just so i can get power out and drive my board and my lights.

let me walk you through the electronics for this project: they're actually really simple, there's not a whole lot together. most of the work on this project is actually in the code, not in the circuit, so let's walk through the electronics real quickly it will look at the code. i've got the whole thing prototyped here so let's walk

through it a little bit. i've got a lipo battery this is an 11.1 volt. it's connected to the breadboard with a switch so i can turn the whole thing on and off. the breadboard is just handling power. i've got power and ground coming in here they split off into two different places. the first one goes here to this white box which is a voltage

converter this takes be essentially 12 volts down to 5 volts which is what the leds need. so, the power for the led is running through here. the arduino 101 is powered through here, with 11 volts now this board can handle 7-12 volts as a voltage input which is different than some of the other boards a lot of them only take 5.

so this one is ok take 11 volts directly from the battery. so, essentially we have power, with a switch, going to the board, which splits off into 5 volts or into 11 or 12 volts. the leds themselves are actually controlled by this pin they're just connected with one data pin and a ground. so that's the entire circuit, basically everything is

on this board it's just power. before we look at the code let me tell you what this is actually supposed to do. the idea is the bike would have two lighting-states. one, when the bike is stationary is going to have a parking light on, which will be kind of an amber color and once the bike starts moving it'll turn into a white light and it

will be much brighter to make sure that everybody around you on the road can see you. there's also going to be a small section of lights behind the seat that will be bright red and those will kind of act as a taillight. there's not a whole lot of code to make this happen but let's take a look at it really quickly. the code i

started out with one of the example programs that actually was installed when i installed the libraries for this board. i started with the example project called "motiondetect" essentially it does exactly that, it just detects motion. it has everything set up for the threshold as to what it thinks is motion and you can modify that just by changing

a couple of numbers. it does some basic setup for the callbacks and then it just prints out all this information into the serial monitor. the loop here just checks constantly to see if it's been more than one second since the last motion and then changes the led on or off based on that motion. everytime motion is detected it calls this event

callback and from that you can figure out which axis the motion is happening on in which direction it's going in whether it's positive or negative on the xy or z axis. so i started with that code and just added some led code on top of it. i brought in the adafruit neopixel library i set up some basic information about which pin it was connected to, how

many leds i had and how many lights i wanted to be the brake light on the back. i added a few variables but the biggest one was to change the time out. instead of one second without motion i set it to 3 seconds. you can modify this line right here to change it even further. at the end of the set up, i just turned on the leds and then ran my blank startup

function and that just runs the lights a few times through sequence to let you know that it started up and ready to go. the loop is pretty much the same except instead of turning on and off the onboard led and just setting my strip to white. nothing really happens here in the callback i just left it in so that you could see it but essentially it just

happens all up here in the loop. if motion is detected it sets them white, if motion is not detected it sets them back to the amber color. these functions set white and set amber i just defined down here at the bottom and all they do is set the entire strip to a single color. i'll have this code link down below it will be on my github you can get it, modify it,

change it, do whatever you want to with it. let's test it out, all you have to do is flip on, it does a little power-up sequence to let me know that it's starting and then it's ready. it's waiting for motion so as soon as i move the bike in any way it lights up it will stay on for about three seconds and then power down until

there's motion again. as long as the motion continues to stay lit up white. i used a breadboard to prototype this and that makes it really easy to plug and unplug wires while you're testing. to actually put it onto the bike and needed it to be more permanent so it cut a small piece of perfboard and then just ran everything through the through holes

and soldered them in place. and in this case really all i'm doing is putting all the grounds into one place and all the power wires into one place and soldering them together. the only other thing connected here is a switch just so i can cut the power to the board. i used some hot glue to hold the pins in the arduino it'll keep them in

place but they'll come out very easily when i'm ready. i measured the overall size of these electronics and then made a box using "maker case". it's a website that lets you generate a template for making a finger jointed box with a laser cutter. i know not everybody has a laser cutter and you don't need one at all you could make a box in any way that you wanted to,

in fact you can put these electronics in a plastic bag and it would work just fine for prototyping. but in this case i get to test out my new laser cutter and make a finger joint box. this only took about five minutes to cut into pieces fit together perfectly. this is a really quick and easy way to make an enclosure for a prototype. if you

don't have a laser cutter and you're curious about them check your local makerspace because a lot of them have them available. to assemble this box i just used a little bit of ca glue to hold it together. i didn't use a ton of glue in case i wanted to knock it apart and change anything about it'll come apart pretty

easily. i set the battery in place and glued-in a divider just to hold a battery separate from the electronics they did knock into each other too much. i dropped everything in place and then marked where i wanted the wires to pass through and switch to be. i could have added these two the laser cutter file and actually had them cut, but i just used

that template right out of that website, so it didn't have these things. i just drilled some holes and popped these things in place. i ran the wires through, plugged in the two wires to the leds and then turned on the power. and of course, i had to put my sticker on it. it works! since this is a prototype and i want to be able to get back into this i just used

a zip tie to hold the top onto the box. in fact i'm going to use zip ties to attach this entire thing to the frame because i can't use my own bike. the frame on my bike is a little weird and not really good for this application so i borrowed a more typical bike from my friend to test out with. so i'm also going to use and zip ties just to attach the

lights to the frame to hold it in place so i can test it out. obviously how you mount this and even the length of the led strip is going to be really dependent on specific bike that you're working with. right let's put this thing on and test it out. zip ties work great for testing but if you want a more permanent solution you can get some

waterproof double-sided tape or some led strips even come with adhesive on the back already. that makes it quick and easy. and when i was putting this on i realized that the water bottle mount on the frame would be a great way to mount the box next time. after i got it fully mounted, i turned it on to make sure everything still worked

and it did but it really shines at night. it feels a little bit like tron when you're riding it. it's cool because the lights mostly face down so they're not shining up into your eyes but it looks pretty awesome when you're going down the street. it's surprising how much they shine down onto the street as well so it's almost like

having a headlight even though should probably also have that too if you're gonna be riding at night. it actually worked out really well on the first try and i think this is a really good first step to a larger project. having those onboard sensors gives you a lot of capability that you can add just the code and since you can detect how far is

leaning in any direction imagine you put leds on both sides of the bike and change the brightness based on how the bike is leaning you can get some like auto turn signals. i'll have my code linked down in the description, you can go get it add to it, change it, do whatever you want to with it, i'll also have some information

about the arduino 101 on board if you're interested in checking it out as well. thanks to intel for sponsoring this video it was really cool to work with that board and i'm looking forward to doing more of it in future. i hope you liked this one i've got lots of other electronics as well as a bunch of other types of projects that you might be

interested in so be sure to check those out and don't forget to subscribe. that's it for this one thanks for watching, i'll see you next time.