Coding 101 41 (Transcript)
Netcasts you love, from people you trust. This is TWiT! Bandwidth for Coding 101 is provided by CacheFly. At cachefly.com.
This
episode of Coding 101 is brought to you by Mandrill. Mandrill is a scalable, reliable
and secure email infrastructure service trusted by more than 300,000 customers.
Sign up at mandrill.com, promo code Twit and you’ll receive 50,000 free email
sends per month for 6 months.
Father Robert Ballecer: Welcome to
Coding 101. It’s the TWIT show where we let you into the wonderful mysteries of
the code monkey. I’m father Robert Ballecer, the digital Jesuit and this is one
of our super special sports ball wild card episodes. The idea of course is that
as we change the format, as we start to move more towards looking at the tips
and the tricks and the methods and the secrets of coding gurus, that we
actually sit down and speak with them before they guide us through a module or
two. The man I have as a guest for this episode is someone that I met three years
ago at DefCon. He’s known as Smitty. You’ll know him if you ever go to DefCon
because he’s probably the only one in the hardware hacking village wearing a
kilt. It’s Mark “Smitty” Smith.
Mark Smith: No, no, no. very much not. Kilts are
very much common at DefCon, I am not the only one
there by any stretch.
Fr. Robert: Well, yes. But in the hardware hacking
village, you’re the only one there who wears an utila kilt, I believe.
Mark: No, I think there are about 3 or 4
others that are there commonly. I am probably the only one there with an utila
kilt and a floppy leather top hat thing.
Fr. Robert: Yes. Let’s talk a little bit about you.
You are a different kind of coder. We’ve had guests on this show who have done
many of the popular languages. So C Sharp, a little bit of Python, a little bit
of Perl, you don’t do those languages, you specialize in embedded devices. Can
you tell me a little bit about how you got to that?
Mark: To be clear, I do do those other things
as well, but I also do the embedded stuff. How I got started, I’ve always been
into electronics. You know, hooking up batteries to light bulbs when I was in
kindergarten and second grade and doing those kinds of projects and having a
lot of fun with that. When I got into college back in the early 90s, micro
controllers were just becoming a thing. Back then it was the 8051 and the
6080C11. The 8051 is an Intel micro controller and the 6080C11 was an early Motorola
micro controller. And a micro controller is basically a CPU with a bunch of the
memory controller and digital IO built into it. So it was a single chip that
you could use to do pretty much everything. You didn’t need a lot of peripherals.
You could control things directly from the output of the CPU instead of having
to go through some other chips that would take, like a memory mount from the
CPU and turn it into actionable things. Like pins that you could use to turn on
and off lights or open and close relays or whatever it is that you’re trying to
control with your micro controller. And I liked the micro controller because it
was something that you could use to actually make changes to the real world,
instead of just flipping bits and drawing some polygons on the screen. Or
whatever, it wasn’t just a virtual thing, you could
actually turn it into a physical thing. And that really appealed to me. Spent the vast majority of my childhood tinkering with Legos. And I would make a lot of robots with Legos. Robotic arms with the technic kits
and everything and with the gears and all that and the motors. And I made a
switch box with a bunch of switches on it that would control the motors and I
could use that to control the robotic arms to pick things up and move them
around and do all that kind of stuff. And so being able to merge my love of
computers with the love of physical things, with micro controllers, it just
seemed like a natural progression. And that’s how I got started and then the
base stamp came around, I went there next. And then Arduino. And the Arduino kind of broke the dam loose and I’ve been going hog wild with
--- and Arduino ever since.
Fr. Robert: You know Smitty, it’s fascinating
that you say that because I think I was in the same boat as you. I started off
with programming computers. In fact, I had a Timex Sinclair and then I upgraded
to a Nintari 5200. That thing was amazing. And then a TI994a. And I started with tinkering. I liked hooking up light bulbs, I’d take things apart to figure out how they worked. And then reconnect them in
different configurations.
Mark: Oh, you actually rebuilt them.
Fr. Robert: Yeah, that was always fun.
Mark: So your parents were lucky.
Fr. Robert: You just took them apart.
Mark: I just took them apart, yeah. My
parents have plenty of good stories.
Fr. Robert: we actually have someone here at the
TWIT brick house who may be your soul mate. But I
loved doing that. Then I went more the software engineering side. I kind of put
away the tinkering and I decided that the future was just going to be in code.
It was going to be in code that did things on servers and on networks. Not so
much in the real world. And if I did it in the real world it would be in
someone else’s module. I like the fact that you decided to stay with the
physical world. It’s a different kind of mindset. Now take me to that. Tell me
how you got to the decision to stay with embedded controllers. Micro controllers rather than going pure computer engineering. I know that you like to tinker, but did you ever have to make a decision like
getting into college or your training where you decided this is the route I
want to go as I move forward?
Mark: Not really. It was never a conscious
decision. I’ve always been more into the hardware than into the software
things. I can write code, but I’m not a software developer. Those are two
different skill sets. And I started out in college as an electronic engineer
major, and then I eventually switched to computer engineering, which was kind
of a cross between EE and computer science, which was all programming. EE was
all hardware, computer science was all programming and I kind of did the one
that was the merger of those two. It was never really a conscious decision of
gee, I don’t want to go all software, and I want to keep some hardware in
there. It’s just the way I went. My day job has primarily been as a network engineer
and system administrator. Not as a programmer. So that’s a lot of hardware,
making cables and that kind of stuff. Not component level soldering level
hardware, but you’re not writing a lot of deep applications. You might write
some scripts to automate some things but that’s kind of it.
Fr. Robert: I want to back track a little bit. You
said something, something I think our audience is going to want to hear more
about. That is that computer software, computer engineering, computer science, that kind of programming is different than the embedded programming.
But to the outside observer, they’re going to say wait a minute, it’s all just
code. Code is code right? Why do I have to make a choice between one? Shouldn’t
a computer scientist be able to pick up an embedded controller and just
program? What makes it different and what makes the mindset different?
Mark: So the point that I was trying to make
was that software development is a super set of writing code. Writing code is-
you know how to write a 4 loop. What does a 4 loop do? How do you write a wile
loop? How do you assemble these things into a program to get it to do what you
want it to do? Software development is more about the life cycle of your code.
How do you take requirements and how do you do the scrum or whatever you’re
doing for project management? How do you plan out how the larger project is
going to fit together and work? And then you write the code, you test the code,
you deploy the code, you find the bugs, you fix the bugs, you test the fixes,
you deploy that, lather, rinse, repeat. That whole software development life cycle is much more of what I
consider to be software development as opposed to just banging out code. For
micro controllers, you’re very limited on the amount of code space that you
have. You’ve only got a few kilo bites. There are actually things called kilo
bites. And sometimes there are limits and not just multiples to calculate how
many terabits you have right. To make the numbers smaller. The micro controllers that I work on, the big ones, have 32 kilobytes of flash. That’s the largest program I can write. Some of the
chips that I work on only have two or 8k of flash. And I’m working in ram. I
think the 8T tinys have like 256 bites of ram. That’s a quarter of a kilo bite
of ram. That’s very small systems. So when you’re working on a system of that
size, you can pretty easily keep it all in your head. You can remember how it
all fits together. You don’t have to compartmentalize things nearly as much.
And so a few hundred to a few thousand lines of code to bang something out
really quickly, because it is such a special purpose device, it doesn’t have to
do a lot of things. You can be a code monkey and just write code and make that
work. Whereas when you’re doing a software development project, like a website
or a back end server, you’re talking about tens of thousands, hundreds of thousands,
even millions of lines of code. You’re not going to be able to keep all of that
in your head. And it involves a lot more process and control and just
everything wrapped around it. That’s the part that I’m not very good at. Is the
point that I’m trying to make. And I’ve never really had formal training in it.
I’ve done it for my day job for about a year. Didn’t work out
very well. I wasn’t very good at it and I went back to network systems.
That’s really where I’m the happiest, where I’m the most effective. But micro
controllers, because you have such a limited space, you can get away with doing
just – banging away at code. And of course I’m going to get all kinds of hate
mail from embedded programmers saying no, there’s- software development life cycle
is very important when you’re doing embedded programming too. And that’s very
true. However, as a hobbyist, you can get away without all of that. And that’s
really where I’ve spent all of my time doing embedded programming, is as a hobbyist.
Fr. Robert: Smitty, I
want to drag you into that war right now. Because I know
people on both sides. I know people how have been doing nothing but
embedded programming. In fact, I know a couple of people who pretty much all
they do is program Scotty devices. And then I know
others who make their living in professional development working for companies
like Oracle and Microsoft. And any time we get together there’s always a
running joke of who is the more elegant programmer. And the software guys will
show you, oh my flow is so elegant and my logic tree is impeccable. And the
embedded guys will say I have to do all of that but I have to do it in 1000th of the space that you get. And I don’t want to say that either is better, but
which one is better?
Mark: They’re different. They both have their
advantages and disadvantages. A lot of the old school programmers who had to
deal with kilobytes of ram, will make fun of the new school for being so
inefficient. I mean, the fact that our operating systems, our freaking cornels,
require ten times, one hundred times more ram than my first computer had total,
right. That kind of thing, that’s before you even load any applications onto
it. To an old school programmer that’s just atrocious. It’s like oh, what an
amazing waste. Why are you guys so inefficient. We could go in there and write
this stuff so much better. But honestly, Dr. Moore predicted the solution to
that problem decades ago. It’s a hell of a lot cheaper to throw more ram at a
computer than it is to spend the time to tweak and optimize and really squeeze
every single last assembly instruction out of your algorithm and make things super-efficient.
Which one is better? It kind of depends on what you’re trying to do. I’m going
to decline to answer. You’re not going turn me into a sensationalist here.
Fr. Robert: Yeah, I wouldn’t answer either. It’s a
bad way to be. But that point is exactly what my software engineering friends
love to debate. And then of course, the embedded guys will always say exactly
that. Which is, you can be lazy because you have so much
processing power, because you have so much storage, because you have so much
memory, you don’t get bit if you’re a lazy programmer. As an embedded
programmer, you can’t be lazy, it just won’t fit. And if it doesn’t fit that
means you have to go back and optimize. And there is a
certain logic to that.
Mark: The one thing I will point out is that
if you get into an environment where you breed laziness in your coding, then
you might start ignoring things like complexity levels. You know, the big O notation,
don’t ask me to define the details. But things like big O constant, or big O van big O of M squared. In factorial. Those kinds of things. Given a problem of size N, how many
times do you have to iterate over N to be able to get the answer. And if you
get too lazy you might start ignoring those kinds of problems. And those kinds
of problems still matter. Because they grow very quickly. And I have seen a lot of programmers get lazy to the point of writing, not just
inefficient code as in oh, you could have combined these two lines into one
line and it would execute faster, but instead of maybe having to do 3 different
things on this particular text file, instead of looping over the text file once
and doing each of the 3 things on every line, you instead loop over it once, do
one thing. Then loop over it again, but for every line you loop over it for the
one time you did. You end up writing programs that just take way too long. And
as your data input gets bigger the complexity starts rising
so much faster and if you’re not thinking about optimization, if you’ve got the
mindset of I can be lazy, then those kinds of things tend to bite you.
So optimization is still important. I think it was W8SS Joe in the chat room
just mentioned optimization is still key. And I think he’s
right. And we need to pay attention to the inefficiencies of our code. We can
make conscious decisions and say yeah, I can spend a lot of time to optimize
this and maybe squeak 10% out of it, but that’s going to cost me X number of
dollars in time, verses Y number of dollars in savings of optimization. Compare
those two numbers and make the decision.
Fr. Robert: I want to take a little side trip. It’s
going to be a small tangent but I think it’ll be worth it because I’m seeing
this discussion going on in the chatroom. And I actually hear this a lot. Much to the ire of my embedded
programming friends. And that is when people say oh, well with Arduino
now people can actually program a --- processor. And they always kind of
bristle a little bit because they were doing this way back with Motorola
embedded processors, back when I was playing with my PCs. What’s your take on
this? Because of course Arduino really made it popular with the maker’s scene.
It made it possible to easily- and artists, right. you could be an artist,
someone with no knowledge of embedded programming whatsoever, and you could
pick up on Arduino, follow a couple of instructions, read some forums and
figure out how to make something work in the real world. What’s your take on
that? It’s got to be a good thing, but that the same time, I heard you at
DefCon grumble a little bit that well, Arduino is okay, but you can’t forget
all of this other stuff.
Mark: I don’t think it was me that was
grumbling about that. I think you might have- you’re probably talking about the
panel I was on two years ago. So that panel actually, I think I was the one who
defended Arduino. Because I was the only nonprofessional
embedded programmer up there. I was the only hobbyist. So here’s the
thing with Arduino. Arduino took a real,
honest to goodness micro controller, Atmega 328, I
think they started out with the 168. But they took a real honest to goodness
micro controller, it’s not a toy. And they took a real C compiler. This is
backed by GCC right. The most popular C compiler on the
planet. And they wrapped it with a pretty interface and made it very
easy to use and they removed all of the complexity of the build chain and all
of the optimization tools and the assembler and the linker and all of that
crap. And they just made a simple, easy to use IDE. And they didn’t say you
were programming, they said you were making a sketch. That appeals to an
artist. That’s not program. And they basically made it very non aggressive.
They made it very non computer-y. And I think a lot of the computer people got
turned off by that. But let me give you a hint. All you artists out there that
are doing things with Arduino, you’re writing C code. You might even be writing
C++ code. You might be doing object oriented programming and you don’t even
know it. That’s awesome. So we have made it so that it is so easy to do that
people who wouldn’t otherwise have gotten into the hobby are getting into the
hobby because we didn’t say- it’s like oh well you’ve got to go through all of
these arcane steps and you have to install this package and this other package
and then you’ve got to take the output of this program and feed it- we’ve
removed all of that. And it’s just you write these commands in this ID,
developer environment, and you click this button, and it will upload it to the
Arduino. Done. And that’s something that artists can
get behind. So they kind of took the Apple approach right. Apple originally-
the original Macintosh wasn’t targeted toward computer users, it was targeted
toward artists. They’re doing kind of the same thing. They removed all of the complexities, they hid it all underneath a good UI and
turned it into something that anyone can use. I think there’s nothing except
good to come out of Arduino. Everything that Arduino has done has been good for
the hobby. Because if you have an Arduino, you can still pull out your old
school development environment and do all of your same libraries, all of the
same compiler and everything else. It takes the same hex file output, and
upload it to an Arduino hardware and you get the nice hardware prototyping
platform with all of the shields and all of that kind of standardization that
someone makes a module that you want to plug into your micro controller to get
it to do something, whatever that shield does. So you get to benefit from all
of that for prototyping and still use your old tool chain. Or, this is what I
do, I use the Arduino IDE, and then I make my own embedded at mel based projects. And I think that’s what you eventually
want to talk to me about is the dark mel project, what
I did there with the dark net ID badge. That is all written with the Arduino
IDE. I just told it to build and I went into the temp directory, grabbed the
output file, and wrote my own AVR dude with lines to program it out to the
chips. The badge itself is Arduino compatible, you can
program it with the Arduino software if you’ve got the right FTDI cable, which
is a very standard, very common serial cable. Serial on one
side, USB on the other. And I think it’s fantastic. It’s not as powerful
as a lot of the commercial tools. And so a lot of the hardcore embedded
developers will say well, Arduino doesn’t do this feature or that feature or
whatever. If you don’t need those features, who cares? It really doesn’t
matter. And so if it gets more people into it and doing it, awesome. I see
nothing wrong with that.
Fr. Robert: I’m on the same page as you. I think
anything that gets people tinkering, I’m all for it. It’s great. I think it’s
fantastic. And if people don’t know that they’re programming, I think that’s
even better because then when they realize that what they’ve been doing is
actually writing code for a microprocessor, it is a little sense of accomplishment.
I want to take the other side though. The dark side that I’ve heard from some
of my embedded friends is Arduino is supposed to be a fast prototype, we know
that. That’s the whole idea of the shield. You get the hardware that you want,
you code it and then you’ve got your prototype. They would argue that many
people never get past that. They never get past the prototype stage. They throw
together a bunch of shields and they say okay, I’m done. And now it’s a
product, I’m going to sell it.
Mark: Oh, well okay. If you’re saying it’s a
product and you’re going to sell it, that’s a different thing right. If you’re
just doing a one off project that you need- for example in the other room I’ve
got a 55 gallon aquarium. 55 gallon fish tank and I made a lighting controller.
And it turns on and off LED lights and the C02 injection and various other
things. That is an Arduino with a shield, and I think another shield on top of
that. Connected to a bunch of different things. And I never went past that stage because I’m
making precisely one of these things. I don’t need to prototype it and turn it
in to a synchadedcated board and send it out to be efabed and assembled and
tested and realized I messed up and have to go have the board refabed and so
on. But if you are selling a product that is an Arduino with a shield stacked
on top of it, unless you are selling it as like a Lego kit that you’re allowing
people to be able to disassemble it and reassemble it and all of that fun
stuff, yeah, I think you’re doing it wrong.
Fr. Robert: Yeah. When we come back would you mind
talking a little bit about process? Because I do want to pick your brain about
when you see a project in the real world, how do you pick your parts,
components, figure out what your logic tree is going to be and then how do you
actually get to programming it? And then I also want to talk about the dark net
of course because we both experienced the dark net at DefCon. Does that sound
about right?
Mark: Sure.
Fr. Robert: But before that let me take some time
to thank the sponsor of this episode of Coding 101. It’s Mandrill. These days
the vast majority of our attention is given over to the latest in social
networking. To the greatest in messaging and to the trendiest
in collaboration apps. But for serious businesses and enterprises there
is still nothing more pervasive, more useful, and more important than email.
That’s why I’m glad this episode of Coding 101 is sponsored by Mandrill. A scalable, reliable and secure email infrastructure service
trusted by more than 300,000 customers. What is Mandrill? It’s the
easiest way to manage, integrate, deliver, track and analyze email. It sports
detailed delivery reports, advanced analytics and a friendly interface that
makes it easy for your entire team, from developers to marketers to monitor and
evaluate email performance across your entire business. You can use Mandrill to
send automated one to one emails, like password resets and welcome messages as
well as marketing emails or customized newsletters. Mandrill started as an idea
in 2010 and now they’re the largest email as a service platform on the market.
Because they’ve geo located their servers to maximize response times, Mandrill
can deliver your email in milliseconds and they’ve given you all the web hooks
and analytics that you need to check delivery rates. And the documentation to
make integration is a breeze. Speaking of integration, Mandrill is easy to set
up and integrate with your existing apps. So you don’t have to switch
everything over. It comes with a beautiful interface, flexible template
options, customized tagging and advanced tracking and reports. And they are the
only email infrastructure service with the mobile app that lets you monitor
delivery and troubleshooting from wherever you are. Mandrill is powerful,
scalable and affordable but you don’t have to take our word for it. Right now
Mandrill is offering a special deal to the members of the TWIT audience. Sign
up at mandrill.com, promo code TWIT and you’ll receive 50,000 free email sends
per month for your first 6 months of service. That’s mandrill.com promo code
TWIT. Mandrill.com promo code TWIT. We thank Mandrill for their support of
Coding 101. Smitty, let’s get back into it, so take me
through the chain of logic that you would use as an embedded programmer. Because we always do this. Every time we’ve gone through a
language we’ve taken our listeners and viewers through what the logic chain
might look like from breaking down a problem into your computer language. Let’s
take your aquarium. Let’s say you wanted to do something with an aquarium, how
would you decide what parts you’re going to need, what microprocessor you’re
going to use and how you’re going to code it?
Mark: Actually I’m going to request that we
not use the aquarium for reasons. Instead, I don’t know if I made too much
noise during the ad, but I ended up getting up getting out all of my dark net
boards from the very first prototype that I made up to the second prototype. This
is actually the first one that we gave out at DefCon, to the second year that
we did. And then all the way up to the one that we did last year. So I’ve got
this kind of history progression of this board. And they all basically do the
same thing with a few additional components and whatnot. But before we do, I
wanted to make one comment. Laquacious in the chat room mentioned that they
really enjoyed Jerry Ellsworth and what she has done. And I have to totally
agree. Jerry Ellsworth is an absolute inspiration. If you don’t know who that
is, for embedded, for just anything maker-y, she is amazing. She is incredibly
well spoken, she’s brilliant, totally self-educated, and she’s just an absolute
inspiration. She is fantastic. So if you ever get a chance to go see her talk
or see any of her projects or, I don’t know if she’s doing a podcast or
anything like that but I think she appears on TWIT every once in a while. If
you ever have a chance to go see her, please do. She’s amazing. Okay, so you
were asking what is the process I go through. You’ll
note that it’s got a clear purple LED, a red LED here, a little 8 pin socket
there, and then opaque black LED and a battery clip. What this is, is a small
tiny micro controller. And it has a couple of inputs and outputs that are
literally just driving little LEDs. The red LED is exactly what it looks like.
It blinks Morse code and its how you get information
out of the system is that you have to decode the Morse code on this thing. The
clear purple LED Is actually an infrared transmitter, and then the opaque black
LED is an infrared receiver. And if you have two of these things and you kind
of pare them back to back like this, they will talk to each other over the infrared
and perform a crypto exchange. And will do stuff that I’ll get into the details
of talking about later. But what I wanted was a simple circuit that I could
sell for inexpensive, for relatively cheap. That would give people an
opportunity on how to learn how to solder. I wanted something I could sell for
$5 or $10 at DefCon and give people an opportunity to learn how to solder. And
then when they were done, I wanted it to be something that was functional. Something that actually had a purpose. It wasn’t just a here’s
a blank micro controller that you can do anything you want on. Well what does
it do? You have to decide that. I didn’t want that. I didn’t want to put the onus
on the person who is just trying to get into this to figure out a project as
the first thing. I wanted their first experience with soldering to result in
something that was immediately functional. And I didn’t want it to just be a
Larson scanner or something that just blinked lights. I wanted it to actually
perform a function. So in this case, I wanted a device that would be able to communicate
with the other devices, so it needed an input and an output. We’re using the IR
for that. And I needed it to be able to communicate with the user and so we
have the red LED for that. So that’s only 3 inputs and outputs. And that’s not
a whole lot. And the code that I was going to write was going to be pretty
small. So I decided to use a tiny little chip. It’s an 8 pin micro controller
called the AT Tiny 85. And it can run on a coin. So a little
3 volt coin cell. So the whole thing was very small and very cheap. So
that was the selection criteria for this particular project. Then what I ran-
do you want me to get into the project right now or the whole dark net?
Fr. Robert: Yes, please. So the
dark net. Because it’s actually fascinating. It’s
not just programming, it’s not just hardware tinkering, you actually had a
vision into which all this hardware fit. And I just find that absolutely mind
boggling.
Mark: So let’s give credit where credit is
due. The vision belongs to Daniel Swartz. Any of you who have read the books
Freedom TM and Daemon by Daniel Swartz will get this right away. If you haven’t
read those books, get thee to your favorite book store and start buying them
now. I personally am an audio book person. I was kind of hoping that there
would be an Audible ad on today so that I could talk about these but, another
time. I’m an audiobook person, Jeff Gerner is the guy
who reads them. I actually was sitting in the chair earlier when Daniel Swartz
and Jeff Gerner were in the studio for triangulation. That was a very fun day.
I got to go to lunch with them afterwards, that was
cool. Anyway, in the book Daemon, there is a computer daemon, D-A-E-M-O-N, I’m not going to spoil it for you, takes over the world
to sum it up. That’s not a spoiler. And it’s kind of like an MMO. A massively
multiplier online game, where there is this computer daemon that’s running on
the internet somewhere and its communicating with its agents in real life and
having them do things for it on its behalf. But before it can have them do
those things, it has to teach them how to do those things, right? And so I
liked this idea of running a dark net at DefCon where we could teach people how
to do DefCon-y type skills and then send them on missions to go build things
and accomplish tasks. And so kind of the root goals for the
dark net are to teach people skills that they would not have otherwise learned. To get them to do things that they would not have otherwise done, and to meet
people that they would have not otherwise met. Those are the 3 kind of main
goals of the dark net. And the first year I did that- the thing we were going
to teach was how to solder. Because I’m a hardware guy, that’s what I do. And
that’s why we made these kits. And then the meet people idea was that if you built
one of these, and actually this was the board we ended up using for the first
year, if you built one of these- and it has a hole so you can hang it from a
lanyard. And if you saw someone walking through the hallways that had one of
these boards, you’d say “hey you, come over here, you’re another dark net
agent. Come over here.” And you meet up and you kind of piggyback the boards
together with the infrared, and it performs a crypto exchange. Each one of
these chips was programmed with a unique GU ID and a unique private key. And I
actually managed to program some very small crypto in here using the tiny
encryption algorithm, TEA, and it performs an exchange across the IR that
generates a code that is unique to the paring of those two devices. And if you
take that code and send it to the Daemon, then the daemon can verify that you
met the other player. And will grant you points for having done that. So you buy
the kit, you assemble it, and it spits out a code that is your GU ID, you send
that to the daemon and the daemon says “hey, I recognize that GU ID, that
belongs to one of the kits that we sold, this proves to me that you have
successfully assembled the kit” and it gives you points for learning how to solder.
And then you go pair it up with someone else and you get more points for that.
Also note that there are some pins up here, it’s kind of a 2x3 square and then
there is one pin kind of hanging off to the side over there. I will let you
guys figure out what those are all for. But there are some Easter eggs in there
that will grant you some extra points. This one is two-three years old now. So
I don’t think the points for this one will still be granted. But anyway, so
that was the whole point of the daemon. So the first year I literally just did
these and that was it. Because I was trying to remain anonymous because in the
books, the guy who wrote the daemon dies in the very first chapter, not a
spoiler, literally the first page is his obituary. But he dies and he’s not
there to watch the execution of his masterpiece. So I kind of wanted to run all
of this at DefCon anonymously. That was my original goal. And just to have it
all be there and have it all be a complete mystery as
to who was doing this and where it came from and just make it look like this
random daemon that was doing this thing at the event. I tried that the first
year, this was all I got out of it and it kind of worked, and it was kind of fun
but it didn’t really scale well. And I’m only one guy and I’ve got a family and
I can’t really do all of that stuff by myself. So the second year I came out of the closet as it were and approached some friends and had them
help me out. And this was the second board that we made. It’s functionally very
similar to the first board. You’ll notice the 3 LEDs down here at the bottom, I’ve
got the same micro controller over here and I’ve got the same programmer header
over there. But then all of the stuff on the bottom half is through hole components.
And so this was the learn how to solder through hole. And we sold a second kit
that was learn how to solder surface mount, for the
top half. And instead of having to get everything by reading the Morse code out
of the LED on the bottom, you could get serial data out of the USB connector at
the top. And it was just an FTDI chip. They were real. This was not going to
get bricked. And you can get serial data out of the top instead of having to
decode the Morse code out of the LED. So that was the second year. And then the
second year I also had a friend of mine who works for a major game studio help
me and re write the daemon back end. So we actually have a real honest to
goodness quest engine where you can program in whatever kind of quest you want
and interact with the players. And then just this past year we upgraded again.
We did away with all of the surface mount stuff because that ended up being a
very bad idea for the hardware hacking village. We put way too much load on
them. So we made the entire kit through hole. We upgraded to a bigger micro
controller, so this one is the AT Mega 32 8. But we still have the IR
transmitter and receiver down here and the USB port at the top that is useful
for connecting and getting serial data. Instead of emulating the serial port,
it now emulates a USB keyboard, so you don’t have to worry about any drivers or
anything like that. But otherwise, functionally, it’s very similar. It performs
the same function. And if you take this one and connect it up from this one
from last year, they will still work. It’s the same protocol. So we’ve retained
backward compatibility on all of these.
Fr. Robert: Yeah. Smitty when you were putting
together this project, can you give me a little bit of insight into how you specked
out the hardware? Because of course you started to think about how many agents
is this person going to meet and how much capability do I want to build it with
this badge? Do you run into feature creep? Like software developers do where
you get to a point where you realize you’ve got to cut it off, this is it for
this kit, maybe in a future upgrade ill change it, but this is where we’ve got
to be now?
Mark: Yeah, I did. The early ones I had an AT
Tiny 85 and so there wasn’t a whole lot of feature that I could fit in there. I
mean, just the basic functionality already took up, I think, 6.5 of the 8k of
flash I had available to me. So I didn’t bother trying to add anything else. I
had all kinds of great ideas, and yeah I did kind of think about that. And I
thought about doing wireless instead of IR, trying to make it a more multi node
mesh instead of just single point to point. All kinds of
things. And I have kind of had to cut myself on that. I tried to get the
TBG Gon working on this year’s badge, I had plenty of space, and it’s got 32k
of flash on here. But never got it working. I was
messing around with the timing on these things to use the pulse with modulators
for things that I wanted to do with it and I never got it quite working before
we went live. In fact, the USB also required special use of the timer on the
chip and I was doing all of my development on my desktop at home and it was
working great. I plugged it in, I was using it and I did all of the development
and it worked beautifully. And then I transferred the development environment
over to my laptop, the day before I left for DefCon in preparation. And tried
it out and it didn’t work. And the USB stuff wasn’t working. I was like, oh crap, I have not tested this on any other machines. And so I
put the call out to a bunch of my friends, I asked my friend to try it and he
said it didn’t work on any of his machines. So I put out a bug bounty to the
dark net agents and I said if anyone can find my bug, I will give you cool
stuff. I think I was a whole bunch of DefCon and one or two of these kits or
something. A lot of people spent time working on it but nobody could find it.
So the code that’s out there already still has bugs on here. It works on about
half of the host controllers that you plug it into and I haven’t figured out
what the commonality is between the host controllers that work and the ones
that don’t. So feature creep, I definitely put too much into this one, I
couldn’t make it all work. I feel kind of bad about that one.
Fr. Robert: Smitty,
unfortunately we’re running out of time. This is absolutely fascinating but here’s
the good thing. This is the rebooted Coding 101 we’re moving into the new
format. You’re actually going to be the first crossover guest that we’re going to
have. Because we do have you assembling the dark net badge. We’re going to be doing a special on Know How where we show people how you
actually assemble that. The components that you chose and the
technique that you use to attach the components to the board. And then
we’re bringing you back onto Coding 101 to show us how you actually programmed
this micro controller. So we have that to look forward to. We still have to set
up the date for you coming back on Know How but are you game?
Mark: Oh yeah. Absolutely. Fall is crazy busy. I’ve got a 7 year old daughter who is in a ballet and we’ve
got family visiting and all kinds of things. It might have to wait until
January, but yes, I’m absolutely game.
Fr. Robert: Fantastic. So we’re going to have this
whole hardware/software battle, will be set off here in the brick house. It’s going
to be--. Mark Smitty Smith. @smittyhalibut on twitter. I want to thank you so very much for being our special guest on Coding 101.
Mark: Absolutely, thank you very much.
Fr. Robert: We know your twitter address, but is
there anything else you want to tell the TWIT audience about you? Where they
can find you, where they can find your work? I know there’s a lot of stuff
you’ve got under NDA right now, so is there anything non NDA that you can tell
us about?
Mark: Yeah, I’m a little more active on
twitter than I should be. Follow me there. I’m one of the few non journalists
you have on the show. So I don’t really have anything to pimp there. Yeah.
Follow me on twitter, @smittyhalibut.
Fr. Robert: We’ll find something. And when we have
you back on Coding 101 and Know How, we’ll push it out. Smitty, I’ll see you next
time, thank you very much.
Mark: Cheers mate, thank you so much.
Fr. Robert: And you, don’t
forget that we’ve got every episode of Coding 101 available for you at our show
page. If you go to twit.tv/twitcoding101, you’ll be able to find all of our
episodes along with our show notes which become very important when we’re doing
a programming episode. Because we actually give you the link to download our
code or to get it off of our GitHub. That means that you can use the same
assets that we use in show when you’re programming on your own. And don’t
forget that we’ve also got a Know How crossover coming up so you’re going to
have to go to that show page at twit.tv/kh to find the episode on assembling
the dark net badge so that the assembly of the actual program will make sense.
If you are already subscribed and know where our show notes page is, don’t
forget that you can find out what I’m doing by going to my twitter page at
twitter.com/padresj. That’s @padresj. If you follow me you’ll find out what
we’re going to be doing for each episode of Coding 101 and you’ll also be able
to suggest fabulous guests for future episodes of Coding 101. In fact, 3 or our
future guests come specifically directly from you. Also don’t forget that you
can always find us live Thursdays at 1:30 pacific time. At live.twit.tv, you’ll
get to see the pre-show, post-show and everything in between. It’s a fun way to
enjoy what happens in the TWIT brick house. We show what happens as we make the
sausage. And as long as you’re watching live why not jump into the chat room?
And if you go to irc.twit.tv you’ll be able to talk to me during the show and
other members of the TWIT TV army. Thanks again to Smitty and everyone here who
makes the show possible. To Lisa, to Leo, to my wonderful TD,
a man by the name of Cranky Hippo, Brian Burnett. Brian can you tell the
folks where they can find you on the TWIT TV network?
Bryan: Yeah you can follow me at cranky hippo
and watch us on Know How. We have lots of fun doing that show.
Fr. Robert: Yes we do. Until next time, I’m Father
Robert Ballecer. This has been Coding 101. End of line!