Jump to This TimeTranscription Text
00:00:03Hey, what's up, everyone? I'm so excited to talk to you today about what I've been working on, because my robot now has vision. If you've been following along over the last few months, you know that I'm building a robot that is capable of identifying to find coins that I'd like to add to my collection.
00:00:18And adding vision to the robot actually brings that project much further along. But in order to do that, I need literally thousands of photos in order to train the AI, I actually tried downloading images from the Internet, including using "Beautiful Soup" to scrape eBay listings for specific coins that I was interested in. But it turns out that even though that worked and I was able to download
00:00:44thousands and thousands of images, it takes a lot of work to actually label those images so that they're useful to train the robot with. So I came up with this other idea of creating an entire miniature photo studio, including lighting and a camera, so that I could take the pictures myself with different lighting angles and then use that information to train the robot. But as it turns out, adding vision to a robot requires quite
00:01:12a bit more computing power than was available to me on an Arduino. So first we're going to talk about some of the challenges I faced when I made that transition from Arduino to Raspberry Pi. But at the end, I'm going to show you my first prototype of a photo studio I made, specifically for coins, including lighting and a camera. The first challenge that I faced when trying to make that transition
00:01:34from Arduino to Raspberry Pi was just grabbing an old SD card that I had from an old cell phone and trying to use that in the Raspberry Pi. But it turns out that that SD card was really slow. So when I tried to install the operating system or tried to install any software on it, it just took forever and was really unusable. And it turns out I just needed to buy a new SD card that was faster,
00:01:58and everything worked much smoother from then on. Now, the next issue that I faced I didn't think would be a problem at all, because both the Arduino and the Raspberry Pi have similar GPIO pins. But it turns out that the voltage provided from a Raspberry Pi is much lower than that provided by an Arduino. So it became impossible to drive
00:02:25the addressable LED strip that I was trying to use for the lighting effects. So for the Raspberry Pi, I ended up needing to buy a logic level controller and a separate power supply to power the LED strip. That logic level controller actually steps up the voltage from the Raspberry Pi data pins and produces a five volt output that the addressable LED strip can use. Once I got that figured out, I couldn't figure out for the life of me
00:02:56why the entire LED strip had turned bright white, and I couldn't get any of them to turn off or change color no matter what I did in the program to change that. Well, after doing a little bit more Google research, I realized that because I was using two separate power supplies one to power the Raspberry Pi and the other to power the addressable LED strip, that I actually needed to make a common ground between the two of them.
00:03:23Once I connected those two grounds together, it worked perfectly and I could actually send code to the LED strip from the Raspberry Pi and would actually light up as I had intended. So the next thing I needed to figure out was what type of camera I wanted to use for this project. And if you ask my wife, she'll say that if given a choice,
00:03:49I will always choose the most difficult way to go forward. And in this case, it was no exception. I watched a video about DIY Perks where he talked about using webcam from an old laptop in his security system that he was generating. And I was intrigued by that because he said you could find old laptop webcams on eBay very cheaply.
00:04:10So I did that. I went on eBay and I actually picked up this Dell Latitude webcam, and it came with a cable. And he showed that you could cut that cable and actually get it to plug into USB. So that's what I tried first.
00:04:26But when I cut this cable, I realized that there were actually ten wires in here, and I needed to figure out which one of them was data, which one was the positive, and which one was the ground as far as powering this camera was concerned, after futzing around with this for about a week, I realized that probably wasn't the way to go. The next idea was to just see what kind of USB cameras were out there.
00:04:56I checked eBay and I came across this really generic looking USB camera. What I find interesting about this is that the bezel for the lens indicates that this is eight megapixels. But I didn't really need something that large. The ad said that it was actually running 640 x 480 pixels, which is standard definition back in the day.
00:05:18It's what we used to all watch television on. As you may be aware, AI usually trains on images that are less than 100 pixels by 100 pixels, and those images are usually black and white to reduce the amount of data throughput. So 640 x 480 is actually more than enough for what I was trying to do here. The thing that I really like about this camera is that it's very basic.
00:05:42It comes even with manual focus, which is perfect for me because I really want to lock this camera in a single position above the coin, and then I can turn the bezel to manually focus, and it will always maintain that focus, I don't have to worry about it hunting to try to find focus on the coin anytime I switch out the coin. But the next challenge I faced was how
00:06:03to lock down this camera at a specific distance that would fill the frame with the coin, but that wouldn't crop the coin at all. When I looked around the house, I came across this little pill bottle that ended up being the perfect size. It holds the camera at exactly the right distance from the coin at the bottom, and that allows the coin to fill the camera's frame.
00:06:26And the other thing I like about this size is that when I cut out exactly 20 LEDs from the strip, that makes one circle within this container. So what I ended up doing was cutting out two strips of 20 LEDs. I could then solder those together and then connect them to a ring light that I attached to the bottom of the camera lens. And then when I placed that all inside the pill bottle, it became the perfect
00:06:52little studio to take pictures of the coins. Now, the next challenge for me was to try to figure out how to put all of my ideas together. Now, I have a 3D printer that's on back order. So for now, I had to resort to the OG of additive manufacturing, otherwise known as the hot glue gun.
00:07:10But that worked out pretty good because I was able to drill some holes in the top of the pill bottle and another hole in the bottom. The top one, I was able to glue the camera into the top of the lid, and I was able to put the penny down in the bottom by drilling a three quarter inch hole. But that leads us to the next challenge
00:07:31that I face, because I realized that the camera needs to be in exactly the same plane as the penny in order to take accurate photographs of it. I traced the penny in the center of this post it note, and you can see that when I place the camera over it and got that coin centered in the camera's view and then traced around the outside of the pill bottle, they're really off center.
00:07:57That lets you know that the camera is skewed in relation to the coin itself. So I needed to get those back in order in order to get the camera perfectly aligned with the penny on the bottom, I created a camera calibration card in GIMP and printed that out on the printer. And when I placed the camera over the penny, I could kind of move that around and make sure that everything was centered.
00:08:21I could then place the camera over the pill bottle and move just the camera to perfectly align that to center the penny in the camera's field of view. I could then add hot glue to the latest prototype and make sure that the camera was perfectly coplanar with the penny that was beneath it. And I think the final prototype turned out great. You can see it running behind me here in the background.
00:08:46But where does that leave us? Well, now we can literally take thousands of images of individual pennies that can be properly named and used to train our AI. So in the next video, that's what I hope to have. A trained AI that's able to recognize at least one side of a coin and properly orient it.
00:09:02If you're into this kind of thing, I hope that you'll hit the like button, that you'll subscribe to the channel, and that you'll leave a comment down below about what you think I'm doing right, and maybe what things I could improve. So for now, that's my two cent, and I look forward to seeing you in the next video. Thanks, everyone. Have a great day.