[00:00.000 --> 00:05.700] DVDs of all of the talks here at The Last HOPE are on sale right outside in the vendor area here on the 18th floor. [00:06.620 --> 00:17.980] And if you have a talk similar to relationship hacking or on another sort of screwball topic or something very serious that you want to talk about, go ahead and sign up for the fourth track in ZUSA. [00:18.060 --> 00:19.660] There's still a lot of open slots left. [00:21.780 --> 00:23.640] This room is so packed. [00:23.820 --> 00:25.420] It's never this packed on a Friday. [00:26.460 --> 00:29.700] I probably shouldn't say this, but I'm kind of afraid of what's going to happen on Saturday. [00:29.700 --> 00:33.180] And Sunday when, you know, the people with day jobs show up. [00:38.760 --> 00:40.900] Okay, it looks like Mitch is getting ready to go. [00:41.120 --> 00:45.900] It is my distinct honor and privilege to introduce Mitch. [00:46.040 --> 00:52.440] Basically, anything, you know, Mitch is heavily involved, obviously, in microcontrollers, TV-B-Gones, brain machines. [00:53.140 --> 00:57.580] He's involved in the hackerspace effort that's going on in San Francisco right now, Noisebridge. [00:59.140 --> 01:02.760] You have an awesome resume, and I love your hair. [01:03.400 --> 01:05.400] Give him a round of applause just for his hair. [01:12.140 --> 01:12.880] Let's see. [01:14.380 --> 01:15.680] I need to... [01:15.680 --> 01:18.660] I mean, I can keep throwing compliments up here at you, you know. [01:18.660 --> 01:23.920] Yeah, just give me one sec here while I tell Windows to do what it's supposed to do rather than what it does. [01:23.940 --> 01:25.300] That's kind of a futile effort, isn't it? [01:25.360 --> 01:25.920] Yeah, it is. [01:29.720 --> 01:42.740] But, you know, while I'm here and wearing my hackerspace village logo, if you're interested, obviously, if you're here, you're interested in microcontrollers, you're interested in design, please come check out the microcontroller workshop going on in the hackerspace village. [01:42.740 --> 01:52.400] We also have, right next to the microcontroller workshop, circuit bending, so if you're interested in making old electronic things make noise in ways that they're not supposed to make noise, check that out. [01:52.580 --> 01:57.960] Also, we have a live video feed to the MetaLab in Austria right now. [01:58.680 --> 02:07.580] I know some of you who know about the MetaLab know that they have this really awesome phone booth, and right now there's a demo scene conference going on at the MetaLab in Vienna right now. [02:07.840 --> 02:15.860] And as one of the items of that conference, people are controlling a little car that has a webcam on it that's roaming all around the hackerspace village. [02:16.200 --> 02:19.660] And so, you know, people are seeing, they look up, they bounce into people, things like that. [02:19.740 --> 02:21.200] It's being controlled from Vienna. [02:21.200 --> 02:27.700] And right now they're working on making a live link so that people here can communicate to the MetaLab in Austria right now. [02:27.820 --> 02:29.780] That's all going on in the hackerspace village. [02:30.100 --> 02:31.520] The hacktory just showed up. [02:31.620 --> 02:33.160] They've got a lot of cool stuff going on. [02:33.260 --> 02:35.040] NYC resistor is on the way. [02:35.160 --> 02:40.140] And also at 2 o'clock, the hackersmart is opening up in the hackerspace village. [02:40.140 --> 02:56.120] If you have any sort of need for LEDs, components, solder, other things like that, or if there's things that you need, if there's a charger that you can't find, if there's other things that you'd like, we actually, around the clock, are going out and sourcing these things in New York City so that you don't have to leave the conference. [02:56.420 --> 02:58.460] We will get it for you and bring it right here. [02:58.920 --> 03:08.900] And actually, I, you know, I know this is self-serving, could I get a round of applause for the people who are out in New York City during con, finding chargers and stuff for you guys, so that you can stay here. [03:10.420 --> 03:11.420] I think that's awesome. [03:11.480 --> 03:13.400] All right, I'm not going to cut into any more of Mitch's time. [03:13.400 --> 03:17.240] And with, it's my great honor again and privilege to introduce to you guys, Mitch Altman. [03:17.540 --> 03:20.520] Give him a huge round of applause right now and when his talk is over. [03:26.220 --> 03:26.920] Hey, everyone. [03:27.200 --> 03:30.560] I hope some of you at least got more sleep than me last night. [03:31.080 --> 03:32.160] I'm envious of you. [03:33.380 --> 03:39.260] So I started this company, Cornfield Electronics, to put out my one and only product, TV-B-Gone. [03:39.260 --> 03:41.680] I didn't plan on running a business. [03:41.940 --> 03:45.020] I'm not a businessman, but the world is a weird place. [03:45.760 --> 03:55.280] So, I put together this workshop and this talk to try to give people a hardware bug. [03:56.080 --> 04:01.160] I think that it's really great to be able to build cool things. [04:01.160 --> 04:07.060] And I can teach anyone to build cool things. [04:07.300 --> 04:10.780] I've taught thousands of people just with this workshop that I've been doing. [04:11.180 --> 04:16.680] And this includes people who've never even, like, sewn a button or soldered ever before. [04:16.980 --> 04:24.000] So, if you're interested in learning or want to continue what you've already learned, feel free to come to my workshop. [04:24.220 --> 04:25.860] I've got lots of solder irons. [04:25.980 --> 04:28.580] I can teach you how to solder if you need to, give you refreshers. [04:29.120 --> 04:30.460] I have lots of parts. [04:30.760 --> 04:36.500] And I'm only charging just slightly more than what I paid, just so I can break even for coming out here. [04:36.780 --> 04:43.600] So, I just want to pass along what I think is just a really cool thing to do, which is to play with hardware. [04:44.020 --> 04:50.420] And, you know, not be stuck with the corporate crap that we would only have available otherwise. [04:52.980 --> 04:55.660] So, I have some ideas of what cool projects are. [04:55.840 --> 04:57.840] Here's a few that I think are cool. [04:58.500 --> 05:00.260] TV-B-Gone and a few variations. [05:00.980 --> 05:03.680] The last talk was more in Phil. [05:03.900 --> 05:07.020] I worked out TV-B-Gone Kit with her. [05:07.360 --> 05:11.860] And that turns off TVs pretty far away, like, you know, 150 to 200 feet. [05:12.200 --> 05:16.040] The TV-B-Gone Pro I just released turns them off at 100 meters. [05:17.740 --> 05:18.540] It's kind of nice. [05:19.300 --> 05:20.720] I couldn't resist. [05:20.900 --> 05:26.800] I mean, even though it is the Hotel Pennsylvania, I turned off all their CNN TVs yesterday with the push of one button. [05:26.800 --> 05:28.800] Today, they didn't work. [05:29.980 --> 05:30.660] Excuse me. [05:30.760 --> 05:34.620] A manual said that they actually put tape over all the sensors. [05:35.620 --> 05:40.980] And I'm also sorry to say that the TVs in the elevators are not remotely controllable. [05:43.000 --> 05:48.120] I'm tempted to hurt them, but it's the Hotel Pennsylvania, and we don't want to make them angry at us. [05:48.120 --> 05:55.900] So, anyways, I've hacked a whole bunch of projects from Limor's Mini-POV Kit. [05:56.100 --> 05:59.140] Now, POV in this case stands for Persistence of Vision. [05:59.200 --> 06:02.680] That's how our eyes make sense of the world. [06:02.840 --> 06:06.960] A little bit of the information sticks in our eyes and our brains after it's gone. [06:09.540 --> 06:10.940] And it's this kit here. [06:12.120 --> 06:23.620] I don't know if you can see it with all this light, but you wave it back and forth, and whatever you program it in with this programming port, you see pictures or words, whatever you program in it through the space you wave it through. [06:23.620 --> 06:30.980] And it's a really wonderful, cheap little kit that anyone can build designed for beginners. [06:31.100 --> 06:36.060] And I thought it would be really cool to hack it to do a bunch of different projects. [06:36.060 --> 06:40.820] So, here's a few of the projects that I did, and I'll be talking a little about them more in this talk. [06:41.760 --> 06:46.220] I also have parts to build all of them at the workshop downstairs in the mezzanine. [06:46.540 --> 06:50.380] So, I have a new project that I worked out with my friend Rolf. [06:50.380 --> 06:54.480] We are part of a San Francisco microcontroller club. [06:54.940 --> 07:04.980] And it's kind of interesting here in our 21st century that there are a whole bunch of geeks in big cities that get together and form clubs about microcontrollers. [07:05.460 --> 07:07.440] And the meetings are pretty big. [07:07.680 --> 07:14.400] So, here's the thing. [07:16.060 --> 07:17.400] Let me reset it. [07:23.700 --> 07:25.860] So, it has a library. [07:25.860 --> 07:27.000] You can hack it. [07:27.240 --> 07:30.100] And it has a sound library, a visuals library. [07:30.340 --> 07:31.720] This one is kind of like Pac-Man. [07:31.960 --> 07:37.340] You move the red one around and try to eat the green before the yellow eats you. [07:38.080 --> 07:39.540] And it has four levels. [07:39.840 --> 07:40.540] It's kind of cool. [07:42.500 --> 07:43.100] Okay. [07:43.800 --> 07:46.420] So, this is about microcontrollers. [07:46.560 --> 07:48.600] So, what is a microcontroller? [07:48.900 --> 07:52.580] Well, it's a complete computer on a little chip. [07:52.920 --> 07:57.560] It's not quite as powerful as modern PCs or Mac hardware. [07:57.900 --> 07:59.560] But it's really powerful. [07:59.940 --> 08:01.780] And really cheap. [08:02.320 --> 08:06.240] So, it's pretty much exactly the same as any other one, but it's on one chip. [08:06.240 --> 08:09.100] And there's often a little bit of extra hardware. [08:10.020 --> 08:18.100] So, in most ones that are available now, like the ones on the mini-POV or all these things here, there are hardware timers in it. [08:18.220 --> 08:19.920] I'll mention a little bit more about that later. [08:20.040 --> 08:24.920] And there's also input and output pins that you can control with the software. [08:25.200 --> 08:29.360] And the software for microcontrollers is called firmware. [08:30.000 --> 08:36.120] It's not quite software, because it's, you know, it's directly twiddling with the hardware. [08:36.560 --> 08:39.100] But it's not hardware, so it's in the middle, so it's firm. [08:41.300 --> 08:42.860] What does a microcontroller do? [08:42.940 --> 08:53.420] Well, it does absolutely exactly the same thing that all computers do, whether it's supercomputers or PCs or Macs or microcontrollers. [08:53.420 --> 08:58.740] They fetch instructions from program memory, and they execute them. [08:59.160 --> 09:00.180] And that's all it does. [09:00.460 --> 09:02.120] Fetch the next instruction, execute it. [09:02.220 --> 09:03.640] Fetch the next instruction, execute it. [09:03.720 --> 09:05.660] And it does that forever until you turn off the power. [09:09.740 --> 09:12.960] So, how do you make cool things with microcontrollers? [09:13.680 --> 09:15.900] Well, first you have to have an idea of what to make. [09:16.520 --> 09:18.720] And then there's hardware and there's firmware. [09:19.400 --> 09:22.000] And you don't have to do it necessarily in any order. [09:22.380 --> 09:27.580] And then you just make something cool. [09:32.090 --> 09:38.270] So, in software, most people go to hacker conferences, know something about software. [09:38.730 --> 09:44.810] Anyone who's done software knows that one of the things you have to do at the beginning is to do a hello world. [09:44.810 --> 09:53.610] So, if you can have your development environment on your computer or print hello world on the screen, then you can do just about anything. [09:54.210 --> 09:58.690] Well, the equivalent of that for microcontrollers is to make an LED blink. [09:59.470 --> 10:03.770] If you can make an LED blink, you can do anything, really. [10:06.170 --> 10:09.650] So, first of all, so, you know, that was the idea. [10:09.830 --> 10:11.470] And here's some hardware to do that. [10:11.710 --> 10:13.430] Well, this is a schematic. [10:13.990 --> 10:19.030] Now, you don't need to be able to read a schematic to do cool things with microcontrollers. [10:19.070 --> 10:25.410] But I want to teach you just a little bit about hardware and electronics here, so you know what's going on in the background. [10:25.730 --> 10:28.550] You know, we're hackers, we're inquiring minds, and we want to know. [10:28.550 --> 10:34.130] So, that big box in the middle, that's the microcontroller representation. [10:35.150 --> 10:39.050] And the little circle on the top connects to the plus battery. [10:39.350 --> 10:43.530] The three lines at the bottom connects to the minus terminal of the battery. [10:44.070 --> 10:46.090] The zigzag, that's a resistor. [10:46.790 --> 10:54.500] And that weird thing, that's an LED, a light emitting diode. [10:54.720 --> 11:01.200] And I'm going to mention just a bit here by taking a little digression and teach you just a very, very little bit about electronics. [11:01.520 --> 11:04.200] So, electronics is dealing with electrons. [11:04.220 --> 11:05.500] That's why it's electronics. [11:05.840 --> 11:11.780] So, it can be analogous in many ways to water flowing through a pipe. [11:12.360 --> 11:15.380] So, it's not water flowing through a pipe. [11:15.560 --> 11:17.940] It's actually electrons flowing through wires and parts. [11:19.420 --> 11:21.340] And there's this notion of current. [11:21.340 --> 11:25.580] That's one of the main things in electronics, and that's electrons flowing. [11:25.580 --> 11:31.680] The faster the electrons flow, the higher the current, and the unit of that is amps. [11:32.300 --> 11:36.100] And then a battery is like a pump pushing the electrons. [11:36.460 --> 11:42.840] The more it pushes, the faster the current goes, and the more the current, and that's volts. [11:43.260 --> 11:52.100] And then resistors is kind of like a kink in a pipe, and that will slow the flow down, and the measurement of that is ohms. [11:52.100 --> 11:55.380] And there's a simple relationship with all these, which is Ohm's Law. [11:55.760 --> 11:59.520] And like I said, you don't need to know all this, but you can see that there is a relationship. [11:59.520 --> 12:01.280] If there's a kink, it'll slow down the current. [12:01.400 --> 12:03.220] If there's a bigger battery, it makes it go faster. [12:04.420 --> 12:10.800] And there's also a relationship with power, how fast the battery will wear down with all them as well. [12:11.420 --> 12:13.800] So a diode is a one-way valve. [12:14.580 --> 12:16.600] Electrons only go one way through a diode. [12:16.600 --> 12:22.920] An LED, light emitting diode, when the electrons are going the correct way through the diode. [12:23.580 --> 12:28.140] It emits photons, and you make all sorts of lights like these. [12:29.220 --> 12:31.080] And a transistor is one other part. [12:32.500 --> 12:35.120] It's like a remote switch. [12:35.660 --> 12:37.560] You put a teeny little... it's got three terminals. [12:37.700 --> 12:44.360] You put a little bit of current on the middle terminal, and it allows a large amount of current to flow from the top terminal to the bottom one. [12:45.860 --> 12:47.680] And that's in the digital world. [12:47.880 --> 12:49.100] We use them as switches. [12:49.920 --> 12:52.600] So we either turn the large amount of current on or off. [12:53.000 --> 13:02.420] And a microcontroller is nothing but a bazillion transistors, set up in a bunch of ways so it can do sequences of switchings on and off. [13:03.480 --> 13:06.440] Okay, so that's your very basic electronics. [13:08.840 --> 13:12.720] Firmware really is very much like software. [13:14.500 --> 13:21.980] So if you're familiar with software at all, one of the things you can do with software is make a variable that can be set to any value you like. [13:22.680 --> 13:24.600] And that's exactly the same in firmware. [13:25.060 --> 13:28.820] So if we have a variable x, we can make it be one. [13:29.600 --> 13:36.300] One thing though with firmware is you try to think about the hardware while you're doing it, unlike with software. [13:36.780 --> 13:39.980] So with most microcontrollers, there are eight bits. [13:40.420 --> 13:46.260] So the physical memory actually has eight little bits that can be one or zero, and that's in binary. [13:46.740 --> 13:50.960] So that's why I put the leading zeros on there, and there are eight places here. [13:51.220 --> 13:56.720] So that's really the only difference is a little shift in the way you can think about it. [13:56.720 --> 13:58.820] Okay, but here's a difference. [13:59.120 --> 14:03.840] With software, you can't make output pins go high or low. [14:04.100 --> 14:05.280] Because they don't exist. [14:05.660 --> 14:06.820] You don't have control over that. [14:06.940 --> 14:08.040] But with firmware, you do. [14:08.400 --> 14:15.780] And output pins are... or input pins are often called ports on a microcontroller. [14:16.120 --> 14:21.620] So if I want to make a pin go high, I can do what that first line says. [14:21.620 --> 14:25.160] Port A equals 00001. [14:25.720 --> 14:27.880] And if I want to turn it off, I just make them all zeros. [14:28.440 --> 14:29.280] And that's it. [14:29.420 --> 14:33.260] That's an actual firmware program to turn a light on and then off. [14:34.080 --> 14:35.200] There's only one problem. [14:36.240 --> 14:37.520] Instructions take time. [14:38.320 --> 14:39.500] Very little time. [14:40.740 --> 14:41.300] So... [14:41.300 --> 14:42.560] And it can be... [14:42.560 --> 14:43.700] It depends on the clock. [14:43.920 --> 14:47.000] And a clock is sort of a heartbeat for any computer. [14:47.520 --> 14:52.620] And with more modern computers, there are like 3 billion clock pulses per second. [14:52.840 --> 14:58.060] With a microcontroller, it's more like 1 million to like 20 or 50 million. [14:58.560 --> 15:03.100] And still, instruction happens in 1 or 2 or 5 or 10 of those pulses. [15:03.100 --> 15:05.020] So it can be really, really short amount of time. [15:05.140 --> 15:10.380] This firmware program actually will make an LED blink, but you won't be able to see it because it's too fast. [15:10.760 --> 15:14.720] So we need to put a delay in between those two statements. [15:15.880 --> 15:18.260] So you can do that with a subroutine. [15:19.580 --> 15:21.360] Subroutine, you just call it. [15:21.740 --> 15:24.340] It goes to the subroutine, which I have at the bottom. [15:24.740 --> 15:29.620] And then it returns when it gets a return statement and goes back where it left off. [15:30.100 --> 15:35.040] So in this case, it's a little loop that just goes around and around and around 10,000 times. [15:35.680 --> 15:37.840] And it wastes time and then returns. [15:38.600 --> 15:39.520] How much time? [15:39.680 --> 15:43.680] Well, you can calculate it, but it's a pain, so it's easier to do trial and error. [15:44.060 --> 15:48.580] So if it's too long, make 10,000, you know, try 5,000. [15:48.680 --> 15:51.780] If it's too short, try maybe, I don't know, 15 or 20,000. [15:53.720 --> 15:58.640] So we're getting close to the whole hello world make an LED blink thing here. [15:58.640 --> 16:04.000] But there's one other way to do a delay, and that's with timers, a hardware timer. [16:04.260 --> 16:07.220] So most microcontrollers have a hardware timer in them. [16:08.300 --> 16:10.560] And it's nothing but a counter. [16:10.760 --> 16:13.360] It counts from some big number down to zero. [16:13.500 --> 16:16.860] You can tell it how fast or how slow to decrement that number. [16:17.080 --> 16:19.940] When it reaches zero, something can happen. [16:20.140 --> 16:23.840] And you can tell the microcontroller with some special registers what to do. [16:23.840 --> 16:26.360] Well, in this case, it just sets a flag. [16:26.640 --> 16:31.820] So we can say, make it count at one microsecond downward. [16:32.180 --> 16:36.540] Set it to 60,000, so after a minute, it'll turn it off. [16:37.960 --> 16:40.480] Or a second, rather, it'll turn it off. [16:41.220 --> 16:42.360] And that's really it. [16:42.540 --> 16:49.760] So another cool thing with software, I'm not making, like, great software here, but one thing you want to do, there's a main routine. [16:49.960 --> 16:51.460] That's the main thing your program does. [16:52.000 --> 17:00.400] At the beginning, you initialize all the variables and set up all the hardware to do what you want it to do, including set up the timer to count down, et cetera. [17:01.300 --> 17:04.880] And then you do the program, make the LED blink, and then put it to sleep. [17:05.560 --> 17:11.360] Now, sleep just puts it into a very low power mode so that you don't actually have to flip a physical off switch. [17:11.620 --> 17:14.200] It just sits there waiting for you to hit the reset button. [17:14.700 --> 17:20.320] So all my projects, they do something for either a minute or three hours, or whatever, and then go into sleep mode. [17:20.920 --> 17:26.260] TV-B-Gone, which, of course, I always have with me, it's now in sleep mode. [17:26.500 --> 17:31.860] If you push the button, it wakes up and does the thing that makes the world a better place. [17:36.240 --> 17:45.200] Okay, so one other thing, just sort of background stuff for doing microcontroller stuff, and this is the thing that scares most people. [17:45.200 --> 17:57.180] It's actually, you have to have a computer to hook up to your microcontroller to program it with some cool firmware to do the cool thing of your choice. [17:57.740 --> 18:09.140] So the software you need is different depending on what microcontroller you use, and there's all of these different microcontroller companies, and they're all good, and they all kind of suck in their own way. [18:10.020 --> 18:14.380] There's always trade-offs, just like all operating systems suck, and all of them have cool things. [18:14.620 --> 18:15.700] It's just trade-offs, you know? [18:16.200 --> 18:22.020] So there's packages for the AVR, which all of these use. [18:23.960 --> 18:29.240] There's one that you just double-click, it installs itself on Windows or Mac OS, and it just works. [18:29.300 --> 18:34.780] And it has a text editor, compile all the code, and then it can program your chip for you. [18:34.780 --> 18:39.140] But you also need to have a little hardware programmer. [18:39.580 --> 18:43.480] One of the cool things with AVR is that the hardware programmer is really cheap. [18:44.460 --> 18:47.540] Most of it's built into the chip, and you can program it... [18:47.540 --> 18:48.560] What's that? [18:48.740 --> 18:49.820] Build it yourself cheap. [18:49.820 --> 18:50.960] Yeah, you can build it yourself. [18:51.160 --> 18:55.840] And there's Lady Ada, who just talked before, has one for like $15 or $20, something like that. [18:55.920 --> 18:57.520] There are other people who have it for a similar price. [18:57.880 --> 19:01.460] The company who makes the chip sells it for like $25 or $30. [19:02.600 --> 19:03.720] So, and it's cool. [19:03.860 --> 19:06.120] And PIC is also a really good one. [19:06.280 --> 19:10.740] I use AVR just because I learned it more, so I keep using it. [19:10.860 --> 19:12.380] But there's nothing wrong with any of the others. [19:12.840 --> 19:15.300] The TV-B-Gone uses a Zilog Z8. [19:15.300 --> 19:17.100] That's also a good one. [19:18.520 --> 19:19.780] But there are a lot of good ones. [19:20.040 --> 19:24.000] But one thing, just kind of a plug for AVR, since I like it so much. [19:25.120 --> 19:36.660] There's a lot of free open source software and also free open source hardware plans that you can find online and download and build so many different projects. [19:37.400 --> 19:54.340] And one of the things that makes it easy to make cool things with microcontrollers is that so many are out there and you can hack already existing, already working ones and change them to make them cooler or to just do something totally different. [19:54.640 --> 20:01.100] And one of the things with microcontrollers, the hardware is almost always very similar from project to project to project. [20:01.500 --> 20:06.020] All of these things have almost the same hardware, but the firmware is different. [20:06.280 --> 20:11.280] You just program it with something different, different firmware, and you have something totally different. [20:11.620 --> 20:18.340] Rather than the mini-POV, I just change the hardware a little bit, put new firmware in and it's a brain machine. [20:18.900 --> 20:22.700] Or it's this RGB trippy light or whatever these things are. [20:22.880 --> 20:24.680] You can do so many different things with it. [20:26.140 --> 20:31.680] Back to AVR, one other thing is there's avrfreaks.org. [20:32.380 --> 20:41.660] And there are thousands of geeks all over the world, 24-7, who would love nothing better than to answer your questions about AVR chips. [20:44.220 --> 20:46.400] Sad, strange, but true. [20:47.620 --> 20:51.440] And if you get the hardware bug, maybe you'll be one of them. [20:51.640 --> 20:53.420] I know I often am. [20:55.000 --> 20:56.860] So here's a real project. [20:56.860 --> 21:02.920] This is like a brief overview of how Lady Ada's mini-POV3 kit works. [21:03.680 --> 21:09.600] I actually made something very similar to this with an older, clunkier microcontroller in 1990. [21:10.160 --> 21:14.140] It costs a lot more than the technology now. [21:14.440 --> 21:17.700] But let's say you just want to make the letter M. [21:18.020 --> 21:24.680] You can program the firmware to have a little section which is just data. [21:24.680 --> 21:27.680] And the data can be representing M. [21:28.000 --> 21:30.280] So what I have here is columns. [21:30.720 --> 21:33.880] So those [21:37.010 --> 21:40.850] are actually one byte of program memory. [21:41.310 --> 21:43.750] So what you do is take that byte. [21:44.270 --> 21:49.470] All of them are one to make the LEDs on in the first column. [21:49.470 --> 21:54.730] Put that on all of the pins of the port A. [21:55.350 --> 21:57.370] And that turns all the lights on. [21:57.970 --> 22:03.110] Then take the next byte, which has only one bit high. [22:03.490 --> 22:06.210] Put that in the port, which is connected to the LEDs. [22:06.450 --> 22:09.170] So now all of them turn off except that one. [22:11.010 --> 22:13.250] And then that LED lights. [22:13.250 --> 22:16.010] And then do the next byte, the next byte, the next byte until you finish. [22:16.210 --> 22:17.670] And then just rotate through and repeat. [22:18.730 --> 22:24.850] And when you do that, it just sits there. [22:25.050 --> 22:26.670] And looks like it's flickering. [22:27.450 --> 22:29.870] But because of our persistence of vision... [22:29.870 --> 22:34.010] Actually, if you wiggle your eyes back and forth quickly without moving your head. [22:34.390 --> 22:35.250] Don't move your head. [22:35.410 --> 22:36.930] Just your eyeballs back and forth. [22:36.930 --> 22:37.650] Look crazy. [22:38.670 --> 22:39.790] Like someone on the subway. [22:39.790 --> 22:44.450] And you might be able to see that there's some strange things in there. [22:44.610 --> 22:46.870] But it's a lot easier to... [22:46.870 --> 22:49.550] We can look crazy without doing that and just look at this. [22:51.150 --> 22:52.990] So that's how that works. [22:53.170 --> 22:56.550] And like I said earlier, I just hacked this. [22:57.030 --> 23:02.430] Since it's just an easy development platform really. [23:02.730 --> 23:04.490] To do a whole bunch of different projects. [23:04.710 --> 23:06.210] The first one I actually did was the brain machine. [23:06.350 --> 23:08.870] But I'm going to show you that one last in this sequence. [23:12.210 --> 23:15.870] But here's how to hack this into a TV-B-Gone. [23:22.430 --> 23:28.290] So you can see with the pictures here, the hardware is exactly the same. [23:28.550 --> 23:30.030] With some minor differences. [23:30.390 --> 23:33.690] I didn't bother putting in all of the visible LEDs. [23:33.910 --> 23:34.830] I only put in one. [23:35.250 --> 23:39.730] And I put in an infrared LED. [23:39.730 --> 23:42.710] That's how TV remote controls work. [23:42.830 --> 23:44.630] With invisible infrared light. [23:44.990 --> 23:48.090] Pulsing in certain ways. [23:48.570 --> 23:54.450] So that when the TV sees the pulsing sequence for off. [23:54.870 --> 23:57.470] It does the cool thing and turns itself off. [23:57.970 --> 24:00.570] If you tell it to do something else, it does uncool things. [24:05.800 --> 24:07.380] That's the infrared emitter. [24:08.120 --> 24:12.680] And every time it puts out an off code, the visible LED will blink. [24:13.000 --> 24:15.220] So I don't know if you can see that in this light. [24:15.400 --> 24:22.740] But this has 2,000 bytes of program memory. [24:23.060 --> 24:25.440] And it can be programmed through the programming port. [24:25.440 --> 24:28.720] And that's not really enough for too many codes. [24:28.920 --> 24:30.200] Only for 8 codes. [24:30.560 --> 24:33.260] So I actually hacked this hack. [24:34.020 --> 24:36.180] And came up with the TV-B-Gone kit. [24:36.420 --> 24:37.800] Along with Lady Ada. [24:38.160 --> 24:39.700] That has 8K of flash. [24:39.940 --> 24:42.380] Which is enough for 44 of the most popular codes. [24:42.820 --> 24:46.120] And I also for that put in 4 infrared emitters. [24:46.320 --> 24:47.180] So that it... [24:49.400 --> 24:50.700] Yeah, and the same battery. [24:50.820 --> 24:53.200] So it gets out, you know, 150 to 200 feet. [24:56.930 --> 24:58.470] Another thing that I did. [24:58.730 --> 24:59.910] Just because I thought it was cool. [25:00.290 --> 25:02.450] Was a Trippy RGB light. [25:03.170 --> 25:06.310] And each of these projects uses a different aspect of the microcontroller. [25:07.190 --> 25:10.430] To just try to show what microcontrollers can do. [25:10.950 --> 25:11.550] Oh yeah, one thing. [25:14.930 --> 25:16.450] This is a hat. [25:18.390 --> 25:20.030] With a TV-B-Gone kit. [25:20.590 --> 25:21.530] Glued to the brim. [25:22.510 --> 25:23.550] Here's the batteries. [25:23.930 --> 25:25.970] And here's an extra little activator switch. [25:28.530 --> 25:30.510] So you can look stylish and geeky. [25:30.750 --> 25:32.670] And all you gotta do is sort of scratch your head. [25:32.830 --> 25:33.470] And look at a TV. [25:33.750 --> 25:34.890] And it turns off. [25:43.280 --> 25:45.120] Yeah, so anyone can do that. [25:45.260 --> 25:45.900] It's very easy. [25:46.240 --> 25:48.540] I actually wrote a small article in Make Magazine. [25:48.540 --> 25:49.380] The last issue. [25:50.260 --> 25:51.380] About how to do that. [25:52.520 --> 25:55.300] The Trippy RGB light is just kind of a fun one. [25:55.720 --> 25:58.520] Rather than have all red lights. [25:58.520 --> 25:59.980] I only need three lights. [26:00.120 --> 26:00.700] One of them red. [26:00.840 --> 26:01.220] One green. [26:01.380 --> 26:01.720] One blue. [26:02.360 --> 26:04.380] And the cool thing with red, green and blue. [26:04.640 --> 26:07.140] Is you can mix them together in various intensities. [26:07.320 --> 26:10.420] And you can get any color that a computer monitor can have. [26:10.620 --> 26:12.740] Because that's exactly how computer monitors work. [26:13.100 --> 26:13.780] Or TVs. [26:13.980 --> 26:14.960] But we won't talk about them. [26:16.700 --> 26:19.200] And the way that I vary the brightness. [26:19.200 --> 26:22.180] Is with this thing called pulse width modulation. [26:23.380 --> 26:26.380] And that's sort of a more advanced topic. [26:26.580 --> 26:31.760] But what you do is you turn the LED on and off very quickly. [26:31.760 --> 26:35.280] So you can't tell that it's actually blinking. [26:35.620 --> 26:38.360] Because it's going faster than your eyes can see that. [26:39.460 --> 26:44.540] But if you have it on for half the time and off for half the time. [26:44.540 --> 26:45.780] Then it gets half the brightness. [26:45.980 --> 26:49.640] If you have it on for a lot and off for just a little. [26:50.200 --> 26:51.260] Then it's really bright. [26:51.420 --> 26:54.980] If you have it on for just a little and off for most of that time. [26:55.160 --> 26:55.840] Then it's really dim. [26:56.520 --> 26:57.540] Let me show you this. [27:00.960 --> 27:03.740] So here's a more powerful version. [27:04.420 --> 27:06.680] You know, if you can make a low power one. [27:06.760 --> 27:08.120] You can make a high power one. [27:08.240 --> 27:09.300] And high power is always cool. [27:09.540 --> 27:10.160] So anyways. [27:10.320 --> 27:12.880] Maybe you can see that these are actually. [27:13.600 --> 27:15.820] Look like they're kind of blinking now. [27:16.060 --> 27:16.520] Rather than. [27:16.820 --> 27:17.000] I don't know. [27:17.060 --> 27:17.640] Can you see that? [27:17.860 --> 27:18.800] Or is it too bright in here? [27:19.360 --> 27:19.520] Yeah. [27:19.580 --> 27:19.880] Anyways. [27:20.140 --> 27:21.340] It's using pulse width. [27:21.560 --> 27:21.780] Oh yeah. [27:21.940 --> 27:22.380] That helps. [27:23.960 --> 27:26.020] It won't make a pattern in the air. [27:26.060 --> 27:28.280] Because it's just doing pulse width modulation. [27:28.480 --> 27:30.500] Rather than trying to make words and pictures. [27:30.720 --> 27:31.740] But that's it. [27:31.740 --> 27:37.220] But if you then put this in a diffusing chamber. [27:39.840 --> 27:42.180] Like this Parmesan cheese shaker. [27:46.560 --> 27:47.900] If you turn on the lights. [27:48.080 --> 27:49.480] Maybe we can make that work. [27:50.780 --> 27:54.760] Maybe you can see there's more than just red, green, and blue happening here. [27:54.920 --> 27:55.880] Maybe there's some yellow. [27:56.500 --> 27:56.900] And... [27:58.280 --> 27:58.680] Yeah. [27:58.880 --> 27:59.360] I don't know. [28:00.180 --> 28:02.720] It's not part of the sequence where it's making too many colors. [28:02.940 --> 28:03.020] Yeah. [28:03.100 --> 28:04.200] Maybe some lime green. [28:04.500 --> 28:04.880] And aquamarine. [28:05.660 --> 28:05.980] Yeah. [28:06.040 --> 28:06.220] Whatever. [28:06.500 --> 28:07.520] So it's just... [28:07.520 --> 28:08.700] It's just... [28:08.700 --> 28:09.700] It's what it is. [28:15.240 --> 28:17.780] This is totally silly. [28:17.960 --> 28:19.460] But this is a solar bug bot. [28:19.660 --> 28:21.680] So way overkill with a microcontroller. [28:21.840 --> 28:22.320] But what the hell. [28:22.640 --> 28:23.660] Microcontrollers are only a dollar. [28:23.860 --> 28:25.160] So why not put it to use? [28:25.740 --> 28:29.260] One of the things that's been sort of popular is a vibro bot. [28:29.760 --> 28:31.600] So if you take a motor. [28:31.980 --> 28:34.560] And put something off center. [28:35.180 --> 28:37.160] As it rotates then it vibrates. [28:37.340 --> 28:38.280] Like in your cell phone. [28:38.620 --> 28:43.380] And I did that by soldering a alligator clip to the rotor of a motor. [28:44.160 --> 28:47.200] This is basically the same as a mini-POV kit. [28:47.320 --> 28:50.120] Except that it has as one of its outputs hooked to a motor. [28:50.320 --> 28:52.060] So when that bit goes high the motor spins. [28:52.480 --> 28:54.480] I have another bit hooked to a speaker. [28:54.480 --> 28:56.440] So as the bit goes high and low and high and low. [28:56.740 --> 28:58.100] It makes sound through the speaker. [28:59.040 --> 29:02.780] And then I have two of the LEDs going to the antennae here. [29:03.500 --> 29:07.080] And I also have a solar cell going to an analog input. [29:07.660 --> 29:09.480] And you can program this microcontroller. [29:10.200 --> 29:12.820] So when it's less than a certain voltage. [29:13.040 --> 29:14.480] Or more than a certain voltage. [29:14.640 --> 29:15.520] You can do different things. [29:16.060 --> 29:16.600] So this one. [29:16.700 --> 29:17.560] If it's a low voltage. [29:17.780 --> 29:18.160] No light. [29:18.460 --> 29:19.980] It just sits there and he blinks. [29:20.880 --> 29:22.040] If it's a high voltage. [29:22.040 --> 29:23.160] He sings and dances. [29:23.160 --> 29:27.840] So vibrating the motor makes him wiggle around. [29:27.840 --> 29:30.480] And he moves forward on his pipe cleaner legs. [29:30.880 --> 29:34.320] And the speaker is set to chirp kind of like an insect. [29:34.500 --> 29:35.180] Vaguely. [29:35.740 --> 29:38.260] So that's that cute little guy. [29:39.400 --> 29:46.660] And the LED cube is actually the first project I helped with New York City NYC resistor. [29:47.060 --> 29:49.720] A new hacker space that just formed in New York City. [29:50.060 --> 29:57.920] And we got the idea for this from these really big cubes in Chaos Computer Congress in Berlin. [29:58.440 --> 29:59.380] These guys are crazy. [29:59.840 --> 30:05.160] In order to make these big ones, there's, you know, like outrageous number of solder connections you have to make. [30:05.340 --> 30:06.680] Well, we just had a half an afternoon. [30:06.740 --> 30:10.580] So we decided to make a cube of 27 LEDs shaped in a cube. [30:12.140 --> 30:14.400] And with that, it's kind of cute. [30:15.240 --> 30:16.220] It's maybe... [30:19.080 --> 30:19.600] It's maybe... [30:19.600 --> 30:22.600] Vaguely like a little art light sculpture. [30:22.960 --> 30:24.190] This one's just green. [30:24.540 --> 30:26.040] The one in Berlin though is really cool. [30:26.160 --> 30:28.620] Because each one has red, green, blue LEDs. [30:28.980 --> 30:30.620] So you can get any color in every node. [30:30.840 --> 30:32.190] And it's big and really bright. [30:33.000 --> 30:38.060] And they spent, you know, weeks of their lives programming that thing. [30:38.060 --> 30:40.020] And it's great. [30:42.660 --> 30:47.080] So, yeah, finally the last project that I'll talk about here is the brain machine. [30:47.580 --> 30:52.600] So, brain machine is basically the same as a mini-POV kit. [30:52.780 --> 30:54.760] Except two of the LEDs go in front of your eyes. [30:55.060 --> 30:57.880] Two of them go to a headphone jack which hooked to speakers for your ear. [30:57.980 --> 30:59.760] So it's sound instead of light. [31:00.210 --> 31:09.120] And then instead of programming it to do the timing for making a pattern in space, it's timed with brainwave frequencies. [31:10.640 --> 31:20.080] So, if you put in a sequence of brainwave frequencies for waking up, then maybe you don't have to do caffeine, although maybe you want to anyways. [31:20.360 --> 31:23.980] If you do it for going to sleep, if you're having trouble sleeping, maybe you can go to sleep. [31:24.360 --> 31:29.380] If you do it for meditation, which is what I put in here, then your brain synchronizes to it and you meditate. [31:29.660 --> 31:35.060] And the thing that makes this really fun is that you hallucinate colors and patterns from your subconscious mind along the way. [31:36.560 --> 31:39.120] A lot of people seem to like hallucinating. [31:40.020 --> 31:44.690] So, this makes it so you can do it with or without enhancements. [31:47.430 --> 31:50.930] Yeah, so I've got a bunch of these. [31:50.930 --> 32:02.640] If you haven't tried it or want to try it again, I've got chairs, because you don't want to really stand and worry about balance when you're doing it, for people to try them out at my workshop at the mezzanine. [32:02.640 --> 32:07.560] And I also have parts for those and all these other things at the mezzanine. [32:08.210 --> 32:11.710] So, oh yeah, these are really popular at parties. [32:12.240 --> 32:15.520] So, anti-hacker conferences. [32:16.020 --> 32:21.280] Everywhere I've been, including like family parties, little kids just go gaga over these things. [32:21.280 --> 32:25.320] I guess maybe that's because they like spinning around really fast and stuff. [32:25.500 --> 32:25.780] I don't know. [32:26.080 --> 32:26.840] Kids love it. [32:27.040 --> 32:34.040] So, yeah, whether the party is a bunch of urban hipsters or, you know, family members, whatever. [32:34.300 --> 32:34.960] Yeah, it's fun. [32:34.960 --> 32:35.560] So, [32:38.800 --> 32:43.080] we don't have sound, but... [32:43.080 --> 32:44.500] And here's the headphones. [32:46.120 --> 32:47.500] And then let's turn it on. [32:52.270 --> 32:52.950] So there you go. [32:53.070 --> 32:55.190] That's what you'll hear and see when you put these on. [32:55.630 --> 32:57.090] I'm Bre Pettis here with Mitch Altman. [32:57.470 --> 32:59.570] And this project is in Make Magazine Volume 10. [32:59.730 --> 33:00.290] Go ahead and get it. [33:00.390 --> 33:00.950] Get the parts. [33:01.310 --> 33:02.110] Make it on up. [33:02.190 --> 33:03.570] And have a great weekend. [33:03.570 --> 33:03.650] Thanks. [33:06.370 --> 33:12.550] So, that was a little video that Brie made when he was doing weekend projects for Makezine. [33:15.190 --> 33:18.070] And, yeah, that's basically all I had to say here. [33:18.170 --> 33:20.750] There's a lot more you can learn about microcontrollers. [33:20.890 --> 33:22.530] I just gave you a really brief overview. [33:23.590 --> 33:29.550] And you don't have to know most of the stuff I was talking about, but it's just cool to have a background for what you're playing with. [33:29.850 --> 33:31.690] And maybe that spawns more ideas. [33:32.130 --> 33:34.770] So, yeah, make cool things. [33:34.930 --> 33:36.530] Because if we don't, who will? [33:46.280 --> 33:48.540] Yeah, and I have the plans. [33:48.820 --> 33:51.190] These are all open source and free for the plans. [33:51.190 --> 33:53.400] And they're all on my website, Cornfield Electronics. [33:54.340 --> 33:56.800] So, yeah, if there's any questions, feel free. [33:57.060 --> 34:00.280] Otherwise, I'll see you all down at my workshop. [34:01.340 --> 34:05.080] How many different programs do you have available right now to the Brain Machine? [34:06.860 --> 34:11.160] The Brain Machine has one sequence that I have on my website. [34:12.020 --> 34:16.060] And, yeah, if you have any questions, use the microphones because they're recording all this. [34:16.380 --> 34:20.880] But I have a meditation sequence. [34:20.980 --> 34:22.700] Other people have come up with other sequences. [34:22.700 --> 34:25.600] And that's on the blog on the Make Magazine website. [34:25.820 --> 34:26.920] Makezine.com. [34:31.540 --> 34:33.060] The microphone, yeah. [34:39.740 --> 34:40.700] Well, maybe not. [34:48.030 --> 34:49.570] Is the microphone working? [34:49.690 --> 34:50.050] Oh, there we go. [34:50.050 --> 34:50.630] It's working now. [34:50.990 --> 34:51.430] Okay. [34:51.710 --> 34:57.670] My question is related to the code protection bits that are found in some microcontrollers. [34:58.290 --> 35:05.070] Some of the microcontrollers, you set a bit or a fuse, and all of a sudden you can no longer read the code back out of them. [35:05.430 --> 35:08.690] Has there been any effort to, like, hack that or get around that? [35:08.710 --> 35:16.650] Because it certainly would be nice to take some things apart and pull that firmware out of there, because it should be relatively easy to disassemble that stuff and read it. [35:16.650 --> 35:17.610] Yeah, it's very easy. [35:17.850 --> 35:22.450] If you have access to the program memory, it's very easy to disassemble it and figure out what's going on. [35:22.670 --> 35:27.850] But there is no way to get it out if they burn those fuses, unless you have an electron microscope. [35:28.390 --> 35:34.270] Then you can cut it open and look at the actual physical layout and see what's on and what's off. [35:34.910 --> 35:39.550] And in China and other places where they don't really respect... [35:39.550 --> 35:41.770] That's changing now in China a lot. [35:41.770 --> 35:46.950] But in places where they don't respect intellectual property, they do that. [35:47.130 --> 35:56.470] So if something's really popular, within three months they'll have their electron scanning microscope and they'll cut it open and look at what's inside and duplicate it and sell it. [35:56.610 --> 36:00.690] Because, you know, a scanning electron microscope you can do for, what, tens of thousands of dollars. [36:00.930 --> 36:03.190] And if they're going to make millions on it, it's well worth it. [36:03.370 --> 36:06.230] But us as hackers, there's no way we can do that. [36:08.150 --> 36:11.450] I'd like to provide an alternative answer to that question. [36:11.670 --> 36:16.110] So, yes, there are fuses and yes, there are burned in one way or another. [36:16.410 --> 36:19.790] But oftentimes they are burned in a reversible way. [36:19.950 --> 36:24.370] Where all you got to do is shine some UV light on specific parts of the chip. [36:24.510 --> 36:29.420] And a great place to start looking for pointers there is the FlyLogic block. [36:30.370 --> 36:31.370] FlyLogic.net. [36:31.370 --> 36:33.590] They do that on a very advanced level. [36:33.910 --> 36:35.390] But they, and Bunny, too. [36:35.790 --> 36:36.650] Bunnystudios.com. [36:36.670 --> 36:39.070] They'll tell you how to do it on your microcontroller. [36:39.270 --> 36:40.530] Oh, that's really cool. [36:40.790 --> 36:44.790] So, yeah, one thing, if you're going to use UV, you probably have to cut the chip open. [36:44.790 --> 36:48.070] And you've got to be sure you don't erase the program memory while you do it. [36:48.650 --> 36:50.350] We only do it once, right? [36:51.210 --> 36:52.090] Yeah, that's cool. [36:52.310 --> 36:52.490] Thanks. [36:52.710 --> 36:54.470] Another point you might be interested in. [36:54.630 --> 37:08.290] Some of those controllers, if you run them on reduced voltage, you could often get them to sort of have a temporary sort of breakdown in such a way that they will spit out data that you're not supposed to, which will often get you into them. [37:08.910 --> 37:09.710] It's been done. [37:09.850 --> 37:11.290] It's actually a professional technique. [37:11.450 --> 37:13.770] You have variable power supply. [37:13.870 --> 37:17.770] You often can make them do funny things that may let you get into them. [37:18.270 --> 37:20.490] That's the way hobbyists can sometimes do it. [37:20.510 --> 37:22.150] And it's been successfully done for years. [37:22.370 --> 37:22.770] Great. [37:23.190 --> 37:23.630] Yeah, cool. [37:23.750 --> 37:23.970] Thanks. [37:28.390 --> 37:29.470] Any other questions? [37:29.950 --> 37:30.470] Yeah. [37:32.710 --> 37:35.730] Have you tried turning off the TVs at Times Square? [37:37.190 --> 37:42.590] You know, the big, huge ones that are made out of lights, those are actually red, green, and blue lights. [37:42.810 --> 37:46.810] Those are not remotely controllable, which is very unfortunate. [37:47.070 --> 37:51.570] However, there are bazillions of TVs in Times Square that I have turned off personally. [37:51.850 --> 37:52.210] Nice. [37:52.490 --> 37:53.230] Good job. [37:57.020 --> 37:57.900] So is that it? [37:58.920 --> 37:59.640] Okay, cool. [37:59.920 --> 38:00.840] Have a great conference.