Embedded - 102: The Deadly Fluffy Bunny (With WiFi)
Episode Date: May 27, 2015Charles Lohr spoke with us about $5 WiFi (ESP8266), hacking as a hobby, arcade games, and music visualization. Updated 06/02/2015: A listener pointed out that the Arduino IDE can program the ESP8266,... probably an easier setup than Charles' original article. Also, the Linker post for this show is about getting started with BLE. Follow Charles on YouTube (or say hello on Google+ and Hackaday.io). To get you started, here are Elecia's favorites: High Res Wifi Signal Mapping (ESP8266) ColorChord 2 Wifi Cup (ESP8266) For more about the ESP8266: Charles' Hackaday write up (and github repository) Espressif site Electrodragon, Adafruit, and Sparkfun have modules ST 9 axis inertial measurement unit LSM9DSO
Transcript
Discussion (0)
Welcome to Embedded.
This is the show for people who love building gadgets.
I'm Elysia White.
My co-host is Christopher White.
And today we are going to talk with Charles Lohr about $5 Wi-Fi, putting Minecraft servers
in improbable places, arcade games, and making PCBs at home.
Before we get started, Planet Labs asked that I read out an announcement, and they're going
to reward you for listening, so keep listening.
Planet Labs is a new kind of space company, space company, based out of San Francisco
and building satellites to photograph the entire Earth every day.
They're ditching the old stuffy space mindset
in favor of developing a new approach they're calling Agile Aerospace.
They've already put over 80 imaging satellites
across seven major hardware generations.
They're in orbit.
Right now, Planet is on the hunt for embedded and electrical engineers,
especially intermediate to senior level people.
If you want to work on space gadgets, reach out to them. They made our own email address for us,
embeddedfm at planet.com. There are 40 positions opened at planet.com slash careers from intern to
director in all areas of the company. Now to reward you for listening to that, which I thought
was sort of cool, they're going to give you some stuff, two copies of my book and a copy of Kerbal
Space Program. To enter, send me your idea for a satellite. What would you put in it? A camera
seems too normal. A thermal imager? Okay. A picture of your grandma? Why? I will read and be amused by the answers, but the winners will be randomly selected.
Get your answer in by June 12th, and I will remind you next week.
So now, our guest.
Hi, Charles. Welcome to the show.
Hello.
Could you tell us a little about yourself?
So, I'm Charles Lohr. I have, I mean, I guess maybe in the last couple years really started hunkering down and hacking much more as a serious hobby.
I guess borderlining on almost a mental disorder by the degree in which I am focusing my time and getting better and better and being able to be quicker and quicker at designing these things I want to build
and being able to get them all the way to something that I can use as quickly as possible.
And along the way, I've run into a number of interesting things all the way to now I'm using some of the same techniques.
I'm able to act as primarily an electrical engineer for Unity, making an arcade game called Neon FM.
And most recently, I've really stumbled into this processor called the ESP8266,
which has embedded Wi-Fi hardware. And it's something, it's kind of always been in the
back of my head. I love all these devices. I love, love AVRs. I love anything that has, you know, you got a processor and some ADCs
and stuff like that. And I always wanted Wi-Fi. Didn't really care about Bluetooth. Didn't really
care about all that. I started chasing after it. And when this processor came out, for me,
it was a game changer as far as any of my hacking and my designs go.
A listener pointed us to a Hackaday article.
Listener was Stu Taylor, aka HSIboy.
I'm sure there's a story there.
But he pointed us to a Hackaday article about how to directly program the ESP8266.
This $5 Wi-Fi module actually can be even cheaper. And so it's not just
sending serial over Wi-Fi using the old AT commands. The article talks about how to
rip out its guts and actually reprogram it and make it do things.
Yes. For me, even being able to just have a serial connection
would have been mind-blowing because I already use AVRs and I'm sure people use anything from
arms to microchip to whatever. And to be able to add Wi-Fi to that, even if it's a little kludgy
through a serial port, that's awesome.
But as soon as people started getting information about this chip and realizing that it could be customized and could be specifically programmed to be the MCU and the Wi-Fi modem and everything
in between, that's when the rubber hit the road and things got really cool.
So tell us a little bit about how you program for it.
So like many other processors, it does have its own instruction core.
It's got on-chip RAM.
It's got on-chip ROM.
And I guess the ROM is a little bit weird because what's really going on is
when you program for it, you're not flashing the chip.
On the chip itself,
there is no flash. It's got tons of other hardware, but it's got no flash. So it does
have an external flash. And when it wakes up, every single time it wakes up, it starts talking
to that external flash, downloads a program into its internal instruction RAM, iRAM, and then
starts executing from there. So when you write a program for it,
you're actually writing a program that resides on a little tiny external flash
and is loaded by the chip whenever it boots. That's a little uncommon now, but that was how
most of the processors I worked with before 2010, that's how they functioned.
The whole internal flash thing seems new to me.
External makes a lot of sense.
But it makes it a lot easier to hack, which is sort of what you've done.
Yeah.
I mean, I certainly wasn't the first person to figure out that this was possible.
And I was long from the first person to really start
programming them. But it is kind of for me a natural thing too because I grew up in the days
of Z80 and okay I didn't really grow but that was a little bit before my time although I loved it.
It is certainly something that I really latched to because, okay, it gets it from external flash.
This actually buys you some things,
even though it might not appear that way.
So when you have internal flash,
you're pretty much limited to that.
And any external, like if your program gets too big,
well, too bad, you can't run it.
If you're in a modified Harvard architecture,
like an AVR or a PIC.
But the ESP is a little different.
It can actually even still
execute things from that internal external flash. And you can cache certain functions, you can put
certain functions inside of the RAM, you can put and then just have the rest of it execute straight
from the flash. And so when you are programming it, you just program the external ROM and boot it up and it does what you say.
But how do you know?
Expressive, is that the name of the company?
Did they release an API?
Initially, no.
However, they did after they realized just how interested people were in hacking this chip.
Which really surprised, as far as I can tell, surprised everyone.
So initially what happened was people realized this was possible
and they started digging through it and they started finding through other channels
information about the internal core, which is actually an extensa core.
Until the expressive chip, I'd never even known it existed.
And really through these bizarre channels,
they started figuring out more and more
until an SDK was leaked.
And everybody kind of thought like,
well, crud, that's really scuzzy.
We can't use that really.
And then something amazing happened.
Espressif said, if you want to program for it, here's the SDK.
We can't give you the compiler, but that's okay
because there are some very smart people who are able to port GCC
in a very short time for it.
But yes, there is an API for it now that's sponsored by Espressif.
There is an open API, although I'm not a fan of it.
It really has come a long way in a very short time.
And there is GCC. And you don't have to unplug this external flash to go reprogram it or anything.
In fact, when it boots up, if GPIO zero is held low, it will enter into a self-programmed flash
mode. So you can just from a command line or from an interface,
when you say make,
you can take your program
that was written against their API,
compile it with GCC,
and you can set it to reset the chip,
hold GPIO zero low.
You can then flash it
through the same pins
that you ordinarily would.
It flashes, reboots,
and because you're already
hooked up to the serial pins now you have a debug console so it's even though it it feels like it
should be really janky in practice it's it's as easy to use is like the isp from an avr dude from
from the app mel tool chain so i don't know if that answers your question,
but that's kind of...
Well, I'm looking at your chart here,
which has the ESP8266,
which I'm going to stop saying
instead of just starting saying Wi-Fi module.
And then it hooks up to USB to serial
because we've all got like six of those on our desks.
And just a resistor, a little power converter and a button.
And suddenly you can program this thing from Windows or Linux.
And it's not even really very hard.
No, no, it really, so few components.
So with that diagram you're looking at there,
I simplified the module to these modules you can buy from a number of places.
I originally got all of mine from ElectroDragon.
The real reason was they were the only people that had it when I wanted to get it
because nobody knew what a success this thing would be amongst the hacker community. And I felt really nervous. I'd never done business with ElectroDragon,
but I figured, okay, I can risk 20 bucks on this. And I got it. And these modules have
basically everything you need to make it wake up and run. And to program it, you just need
the extra serial to USB adapter and a little switch to tell it
which boot mode to go so these things are really cheap and we know how to talk to them and we know
how to program them sounds great what what's the limitation here there must be some catch
are they are they slow is there is their throughput not really all that great?
I mean, for example, I could easily use this for telemetry to a robot, but could I put video over it or audio over Wi-Fi?
Is it that capable?
I would expect that you would be able to do very, very low-quality video.
And I would expect that you'd be able to do mono 8-bit audio
its processor is it honestly i was expecting it to be slow as molasses but when i started using it
the processor is actually pretty quick it's it's like and i mean i don't actually know if it is a
32-bit core i think it is but it certainly feels like a 32-bit core and it operates at 80 megahertz out of box and 160 megahertz, which I just recently found out maybe
a couple of weeks ago, if you put it just set one bit and okay, now it's twice as fast. So
it certainly has the speed. It doesn't, throughput isn't that great. I think I was getting, I just don't remember the speeds.
It was under a megabyte per second over TCP.
It wasn't a lot under from what I remember, but it was substantial.
Yeah, in your article, you have half a megabyte for your baud rate.
Oh, that's the baud rate to the serial, not over Wi-Fi communication.
Oh, that's programming speed, not Wi-Fi.
Yeah.
Okay.
And I guess the other really hard limitations with it are RAM.
It only has, I think it's something like 64 kilobytes of data RAM.
Oh, I'm sorry, 96 kilobytes of data RAM. And that's, I guess, kind of the biggest limiting factor
because you can get access to the external flash fairly easily.
That makes sense.
You mentioned getting it from ElectroDragon.
And I see it's also on Adafruit.
And I'm pretty sure SparkFun came up in my search as well.
And at ElectroDragon, I think it's $3.50
now and Adafruit it's $7.00
and
when I went to go search for other
RF transceivers
the lowest
I came up with was like $8.00
and that wasn't on a board, that was just
the chip.
What magic are they brewing to make this possible?
Or did I just not search for the right stuff?
No, I think you search for the right stuff.
And what I'm gathering and what I understand is that,
have you ever looked for little tiny USB cheap Wi-Fi modules?
Just USB adapters you can plug into Raspberry Pi and get at Wi-Fi?
Yeah.
They're really cheap.
They're cheaper than buying a Broadcom chip, yeah.
Yeah.
And I think that that's kind of what's going on.
Because the neat thing there, somebody actually decapped one of these ESP8266s.
And inside, the die was stamped with ESP8089, which is a, I think it's SPI.
I don't remember exactly what its interface was, but it was intended to be another one of these Wi-Fi adapter chips.
I think that Espressif did something really magical when they said, you know what?
We can just turn this into a general purpose thing and let people have fun i'm i'm amazed and i'm
amazed they made it uh open api because that's another broadcom is another is a good place to
compare because you have to sign a lot of papers before they give you their api and
it's you know it's not that much fun you certainly can't make an open source device with it. And I'm just happy and flabbergasted
that this cheap thing is going to work like that. But for working, one of the things I have been
crusading about with Wi-Fi and Internet of Things is setting it up as a pan-the-neck.
How do you put in your password and Wi-Fi? So you have to decide
if you want to use this in AT mode, which is how a lot of projects used it initially, because it
was the only way, or if you want to use it in the API mode. If you are going to use it in AT mode,
it's extremely simple. And I did a project, one of the first things i did with this when i got it
i i took one of my old busted lamps and made it wi-fi enabled and in order to connect all the
command is from an avr whatever you're sending to it is at plus cwjap equals essid comma then the
password and it does everything else it handles w WPA. It handles WEP. It just
knows how to do all of this. It handles all of the IEEE 802.11 beacons. It handles everything.
With that one simple command, it knows how to negotiate, it knows how to pull an IP address,
and it knows how to start talking. So from AT, it's extremely simple. Oh, and by the way,
when you do that, it actually goes back and writes the flash like,
hey, by the way, the default address I'm supposed to connect to is this thing over here.
When you use their API, it's actually the same.
When you use their API, once you initialize their system, you say,
I don't actually remember the command off the top of my head.
It is in the Hackaday article, I believe.
Once you tell it, article, I believe.
Once you tell it, hey, I'd like to connect to this access point,
okay, it handles everything else for you.
And their IP stack is ready to go.
What if I don't want it to handle everything for me?
I can think of scenarios where you'd want basically layer 2 access.
You don't want to do TCP IP, but you want to do raw frames over Wi-Fi Ethernet.
Do you have access at that low level or is everything through their TCP IP stack?
I have often wanted to do this myself, but there are a few example projects where people have hooked the really low level packet capture feature in it.
And I looked through it and supposedly you can even get Wi-Fi power of the specific packet that
you received and a couple other things, including the raw IEEE. I know it's at least the raw
Etherlink frame after that. They have a little header of stuff that their Mac puts on. I have
never personally used that,
but it's in some example projects, so I'm assuming that it works. So I don't see any
reason why you wouldn't be able to do that. So putting my black hat on, you could sprinkle
these things with a little battery and a flash drive in a coffee shop. Oh yeah, and Wireshark it all later.
If they're running an open unsecured Wi-Fi,
which a lot of them are still,
that's pretty scary.
Just stick it with some gum under a table
and come get it later.
I don't know if it does.
Actually, I do know that the example project I looked at,
they were just capturing the beacon packets or the probe packets.
I'm sorry, not beacon.
So they were just capturing, oh, I saw this person's device looking for Wi-Fi points.
Oh, I saw this person's device looking for Wi-Fi points.
So I know you can get that.
I don't know if it's truly promiscuous, but something like that, I could Google some more and try to figure out if that's possible.
But you can certainly get very close to that at the very least.
Well, that's exciting.
Although, back to my setup, all of what you've said involves typing at it, which is, you know, as a hacker maker, that's fine.
As somebody looking at this to make a consumer product...
That's up to you to figure out, I think.
You know, there's the method where you plug in via USB,
and there's the method where you serve a web page
and then make them type it in, and then you then store it,
and then you come up in the other mode.
Does it do both access point and client modes?
Yes.
That's amazing.
Yeah, it is pretty amazing.
And one of the projects that I'm doing, it's kind of gone by the wayside recently, but I intend to finish it someday.
I do have a recovery mode.
So if it can't successfully connect to the access point that you've pre-programmed with it, it turns into its own little access point. And then you can go connect to it at a known IP address and go configure it to
go connect to whichever access point you want from there. So exactly what I was saying with the,
the, how, how a lot of wifi devices make you hook up, you hook to them and then you program them.
I, I'm just, so what is the downside of this little guy?
All of your packets go to China.
I have often worried about that.
And I will say that when I first got it and I first connected to it, it put entries in
my ETC resolve file that I was not entirely comfortable with until I googled them and found out that the
default DNS servers that it sends out to you are actually like legitimate, which really kind of
surprised me. I thought it was going to go, oh, all of my DNS lookups until you know, my DNS gets
flushed is going over to China. But I have yet to actually find anything like that.
So I would say that the major drawbacks on it are,
I would have to say the RAM is probably a pretty major drawback for most people.
Well, that's if you're going to compile and run on the chip
instead of using it as a communication chip and run on something else.
Oh, if you're doing that,
I would not really use that for any serious project.
The AT command set, while very broad and useful,
I would hate to use it as that for the same reason
I absolutely despise what FTDI has done to engineers.
And it's just the wrong solution
for a commercial product to use one of these,
to use the existing AT firmware as a Wi-Fi bridge. I don't know how
to, it's just too kludgy.
I'm sure there are other engineers, the same engineers who put FTDI chips in
commercial products.
But it just feels, and I say FTDI, I mean any serial to USB adapter.
It just feels kludgy.
If you're not going to program it with your own firmware, that's, yeah.
I have so many questions now.
Okay. Okay, so FTDI chips, not everybody has serial cables.
I mean, I admit to having, wow, more than six of those serial to FTDI cables on my desk.
So serial to USB is not hard for me.
But most of the world runs on USB.
When I say FTDI, I mean along the lines of when you buy, say, a barcode scanner.
You should not have to install FTDI drivers in order to get your barcode scanner
to connect as whatever it should connect as
i strongly feel that we have made we're far enough along with this technology here that if you have a
device that's going to be a keyboard it should have a chip on it that can handle usb enough to
become a keyboard yeah and there's plenty of other profiles you can use and write your own yeah without going through ftdi you can do an hid profile and yes pretty easily yes and so yes i
think i agree well yeah but so many people are very lazy they just make their device speak serial
and they use the ftdi chip to be extraordinarily lazy i think that's the complaint okay yes well
then we're all on the same page. I can buy into that.
And I feel that trying to use
the ESP8266
as a Wi-Fi
serial bridge, in my
mind, is along the same... Yes.
And don't get me wrong. If you're just debugging,
or you're having fun, or whatever, or you're making
the dinky little thing turn on your light,
that's great.
But if you're trying to sell a commercial product,
you're already going to have to spend a boatload of money
to get your product FCC certified.
So you should put in a little bit of extra engineering
to make this a much nicer solution.
I agree, and yet I'm torn because it is so cheap
that it is tempting if you're trying to make a very inexpensive thing,
that this is not the worst solution you could come up with.
Of course, that argument can be used for the FTDI chip
and making it simpler for developers.
Well, it depends on your definition of product, too.
I mean, if you're selling a million of something
based on this, then yes, definitely you should
be spending the time to do it properly.
If you're selling a hundred things on Tindy...
No, okay, that's fine.
Or even a thousand on Kickstarter.
Okay, no, if you're selling a thousand on Kickstarter,
come on, just read my article
and spend 20 minutes.
Oh, that assumes that my program,
which we haven't, would fit.
I'm more in the boat of what happens
when you run out of RAM
and you need another chip.
Ah, okay.
Then what,
so there are other AT firmwares out there
that are better.
And those have really kind of answered
a lot of the problems
that were with the original AT firmware that came with Espressif.
So when you get these things, the default firmware is usually very close to or exactly the same firmware that came from Espressif by default, which is the AT firmware.
If you're looking for something a little bit more robust, then these other AT firmwares are probably a better solution.
So if you really need to use this as an external Wi-Fi modem, so to speak, then okay.
You should still probably be able to program this yourself to be able to handle
things in a more intelligent manner.
Like maybe it should know how to connect to the Wi-Fi point.
It should handle a lot of the TCP IP stuff to make the,
to run a TCP IP server through the AT firmware is janky.
And I tried running a Minecraft server through the AT firmware before I was able to program.
It was right when I bought it.
I was like, how hard could this possibly be?
And the answer was, it just doesn't really work that well.
And I don't really know how to explain why.
Versus when you run on the chip and you use their API,
it's very solid.
Okay.
So if I wanted to do this for some small project
or some medium-sized project,
it would make sense for me to write a little
bit of code over on that chip and then have it hook up to my processor over serial and
do something more extensive.
If I was doing a Kalman filter with inertial sensors, it's not going to fit.
But I could use this as my Wi-Fi interface.
I think it might fit, but, you know, it does not happen.
I don't think so.
It's a common filter.
I mean, okay.
Well, it's all this, I mean, you have the synchronous sampling of the sensors,
and it, I don't know.
I mean, for example.
It's the only case where I think floating point is a good idea.
Okay, I will admit floating point would be nice if it had an FPU,
but I do think that if it had an FPU,
then it would probably have a few other features,
and then the price would no longer be...
It's basically $3 a piece at this point.
So, okay.
I could believe that if you really want to do all of that,
use it as a Wi-Fi modem,
that is probably the best solution at that point.
But if I want to compile for it, what do I need?
I mean, GCC, but it's a cross-compiler.
Is it fussy? Do I have to compile the compiler myself?
No.
A little while ago.
And if you follow my tutorial, yeah, you do.
But there are more solutions out there.
I think I've seen a couple of virtual machines where people have already set up everything for you.
So if you have the virtual machine,
you can just start writing in there
and the entire environment from A to Z is completed for you.
When you try to use any of the bootstrap builds
or the way that I still do it,
even though it's kind of, I guess, slowly falling out of favor,
which is to use the...
I don't remember exactly what the name of the person was who did it,
but their port.
It is a cross-compiler where you have to compile the compiler
and a couple other things.
So it depends on how much experience you have with this sort of thing.
A lot of people commented saying, yeah, I got it to work just fine.
Some other people did have trouble.
There are forums, multiple forums.
Yeah, and if you do have trouble, you can try different methods.
And there's a couple ones out there.
And one of them is bound to be the one that's going to be your cup of tea.
You could probably take a new one and a brand new computer and make them talk to each other in an hour, 15 minutes?
You could probably get the AT firmware talking to it in 25 minutes.
If you got it out of box, you probably want to just start talking to it to make sure you can
talk to it. Yeah, make sure its bits are
okay and the electricity is on.
Yeah, and it does require 3.3
volts, although they kind of
sort of work at 5 volts.
Kind of sort of.
I had that problem yesterday.
It kind of sort of worked for a little while until the smoke went out.
Well, I took the five volts back off, put it on three, three, and it kept working.
But in general, if you're going to start actually coding for it,
I would imagine unless you have done this sort of thing a fair bit,
it could easily take about two hours
before you really get a good Hello World program going.
That's assuming you use one of the pre-built VMs
if you compile your own compiler for it.
And generally, that's actually the way you'd want to go
if you were using Linux,
because then everything is already in an environment
you're used to developing in.
I could believe that would take maybe three to four hours.
Okay, so solid project, but then you have a Wi-Fi chip you can do all sorts of things with,
and the next one won't take nearly as long.
No, now from project to project that I do with the ESP, it takes minutes to go,
oh, I want to make a new thing that does X.
Okay, done.
It's very quick once you have all that set up.
So your article at Hackaday, how did that come about?
In largely the same way that I'm on this radio program today. And in that, somebody contacted Hackaday. And actually,
I guess it was kind of a couple of their editors started talking. And they kind of knew that I did
a lot of stuff with the ESP8266. And they hadn't really had any big articles on it. And so I was
specifically asked, hey, can you write an article for it? And I hemmed and hawed and I felt really nervous.
And I was like, okay, I'll try. And I wrote it and I had a couple other people look at it and say,
no, you're getting way too much into the weeds here. No, you can't do that. Yeah, that's good
there. Expand on that. And I gave it to them and they edited it and turned my uncomfortably poor English article into what it is.
And that's really how it worked was I was just asked to do it.
And they were really supportive.
And they said, yeah, no, please just give it a shot.
Just give it a shot.
And I did.
And that's how it came to be.
Cool.
So is this what you do career-wise uh no not
really uh I mean I'm mostly like I guess project to project career-wise um so it's it's it's a
different world I don't really get excited about it that much I mean even with Neon FM it was
something where it's like oh this is cool because the the first thing with Neon FM, it was something where it's like, oh, this is cool,
because the first thing with Neon FM, it's the, just to recap, that's the arcade machine that
I'm working on basically commercially right now with some of my friends. All the circuit boards
in the first two Neon FMs were made right in my basement, and I got really excited over that,
and now it's not as much fun
because we're getting some of the boards
made with commercial PCA places.
And I'm still getting my friend
to make some of the boards for me.
And it doesn't really have the same luster
as this world of hacking.
Well, it sounds like they lost the dream
and went commercial.
I don't know if they lost the dream.
I have a very low threshold, though, for what I consider the dream.
And for me, it's pretty much, is this thing useful?
Yes.
Okay, it's not that cool anymore.
It's got to be useless.
Otherwise, you know.
So it's a lot like the assigned reading in high school.
Yeah.
This book may be great.
I may love it later, but I'm not going to read it because you told me to.
I think that's definitely where I reside.
But you do sort of have a day job.
Yeah, yeah, I do.
And it's really what finances all of my hacking.
And this is actually really where I spend a lot of my money is on the hacking. And this is actually really where I spend a lot of my money,
is on the hacking.
Not as much as most people seem to think,
because I pinch pennies like crazy.
But yeah, I wouldn't be able to make ends meet
by doing what I do.
Let me put it that way.
Outside of work.
It seems like what you do, it looks like work. I mean, you're making PCBs,
you're hacking hardware and software, and you're doing measurements on chips, and yet you're paying
for the privilege instead of being paid for it. That's crazy. There was no question there I'm sorry
I didn't mean to call you crazy
this is supposed to be a safe place
no judgment
and here you are
I'm doing that talk about makers
and pro and all of that
and I don't
I guess Charles is definitely
in the maker camp
and I don't really know guess Charles is definitely in the maker camp and I don't really know.
I admit that I do engineering because I like it, but also because it pays.
Yeah, no, I don't really even know if what I do is engineering and all my YouTube channels and all that.
Because if I get to engineering, it's not as much fun. Because that's when you're... Engineering is when you have a bunch of signals
that you got to get on this differential bus
and there's going to be a thousand.
You have to do all reviews.
No, no, no.
What I do is just throwing stuff together,
seeing if this works.
And especially, I think of it, I guess, more as exploring.
I have the itch for exploring.
So the same sort of thing that I'm sure some people who would go exploring way back when, for me, if I can do something nobody has
ever done, by whatever criteria, can I do X cheaper than anybody has ever done it? Can I do
X with a processor that nobody has ever done it with? Or better can i do something somebody told me was impossible
and and that's i guess that's really where i get a lot of joy and satisfaction is when i can do
what seems to be impossible i could see that yeah that would be cool i think uh i have some
similar feelings as you toward work as as elicia can probably attest but i generally enjoy the the
beginnings of projects and that's more along the lines of what you're talking about where
you're trying to figure out how to do something that somebody's either telling you is impossible
or you're telling him it's impossible but you want to prove it to yourself that it's not
there's moments like that at the early stages of projects but you're right when things get further
along and and things are in production uh it's you know, the excitement is kind of gone and you kind of have to find those little bits of excitement where you can make them.
And it's harder in that kind of thing, especially when you have to do something according to a process or carefully.
I mean, it's fun to not be careful.
Indeed.
Yeah. Yeah.
Well, and I guess it was leapfrogging and getting to see my things
on Target's shelves was a kick.
Enough of a kick that gets me through
even the things that I think
are not fun.
That joy of,
wow, I can go and
I made that was very cool.
But yes, I can see how just starting it and making sure it all works and then going out to play would be fun. But you aren't just stopping,
you are writing about it. You've been putting your projects on Hackaday and you've been making
lots of videos. I think a lot of that was incremental. So in college, I wrote a lot of software, and I got good at writing software.
I thought I was actually going to be a video game programmer.
That's what I assumed I was just going to be.
And I actually ended up doing some very large projects with other friends there for no other reason other than, I guess, testosterone, just trying to prove it to, to whoever. And, and I was actually, I think that I owe a lot of this
to something called the, uh, the game developers club at UMBC, because for them, there was a,
there was a room of 50 people that showed up to the first meeting who had no idea what the
heck they were getting into. And, and it was me and a couple other people like oh we can write a game engine everybody's like
no you can't and and the answer is yeah you can but i think that's kind of what started it so i
started just doing this programming and then i started getting into to more if you go back all
the way to the beginning of my youtube videos i i was one of the first people to kind of
take a lot of the stuff that people
figured out the PlayStation 3, the hypervisor and how to get around it and really turn into
sort of something you can actually draw things to the screen with and make 3D objects and all of
that. And then all the way to ray tracing on GPUs was something I had a lot of fun with. And that was back in the days of like the G46800.
And I started doing that and I put it up on YouTube and very few people watched any of my
videos. So I was like, okay, whatever, maybe I'll just keep posting it because I get some
enjoyment in it. And then Hackaday happened. And I don't really know, I didn't even know some of my stuff made Hackaday other than an enormous bump in the views on my videos.
And when I started seeing people actually talk about what I was doing from hackers, people in that sort of community, okay, that now gets to be its own kind of motivation. And I think that's kind of what sustained it
was the fact that I was able to make something,
be able to spend a couple hours editing a video for it,
and then talking to whoever,
making sure that everything's in place,
posting it to Reddit Electronics,
and maybe potentially telling Hackaday,
hey, don't report on this yet,
or hey, I just did this.
When people see it and people comment and people start a dialogue, that's really cool to me, especially when you can see somebody else using something you did in their project.
There's something deeply satisfying to me about that, and that's really enough to give me motivation.
I can see that.
It's a better feeling of accomplishment
because you feel like you own everything about it
and you've contributed something.
Whereas working for a company,
sometimes it's like,
well, I did this little bit of this thing
that somebody can take or leave
will be replaced by the next thing next year.
It's almost
the educator
versus the
the engineer
I guess
yeah
so
how bad
would it be
for you
and I'm not
I do not
have buckets
of cash
for you
but how bad
would it be
for you
if somebody
hired you
to do exactly
what you were
doing
because then
they would be
telling you
to do this
I ask for Christopher sometimes I wonder Somebody hired you to do exactly what you were doing, because then they would be telling you to do this.
I ask for Christopher.
Sometimes I wonder if somebody could pay him to do what he wanted,
would that mean that he didn't want to do it anymore?
I would have to have a... Oh, sorry.
Oh, to Christopher, I'm sorry.
No, no, no, Charles, it was a question for you, but it's one of those...
Yes, but I'm making noises because that's an awful question.
It's a terrible question, isn't it? It's an evil those making noises he's making terrible question isn't it
i'm really mean to him today i don't mean to be i i if i had the level of autonomy i had and i was
just there and somehow my things were somehow able to make money that i've been making this
whole time yeah sure whatever that'd be great i'd do that but as soon as people start saying oh well no it has to do
this when this happens and that
and then this has to happen when that happens
oh no
then I'm not happy anymore
and you know how these things go it would just turn into an
assassination laser like in real genius
you'd be happily working on your thing and you'd turn it in
and it'd turn out
to be a weapon no matter what you were working on
it could be a fluffy bunny with a esp8266 in it the deadly fluffy bunny with wi-fi big gnashy teeth
uh yeah but you could so you you can uh as i explore the whole maker pro community it seems
like there are a number of people who are making kits for what they do
and writing about what they do and getting paid for that.
You had an ad on one of your YouTube videos.
Ah, yes.
Can you make enough money doing that and getting sponsorships and free dev kits? I have just recently from the outpouring of,
which was very much a surprise to me
when I released the thing about the 3D mapping of Wi-Fi.
I actually was offered a dev kit,
which I don't really feel comfortable saying which company.
I don't know if they don't want me to say or whatever.
I ended up still kind of talking to him maybe about it. Um, I could believe that if you were a much bigger fish,
yes. Um, there are certainly channels that are the same sort of thing as me that are,
are much better produced, more regular and have proportionally larger viewers, I just, I can't imagine somebody making a living off of it.
And unfortunately, I also can't really answer that much about that anyway, because
everybody who gets ads on YouTube also agrees to never tell people how much they get from YouTube.
So, yeah.
That's fine.
Yeah, I know that makes sense.
But it is possible.
I mean, if that's what you want to do, you can start writing for different people, even Hackaday and Element 14.
If you're a regular contributor, there's usually a little bit of money.
I can believe it's enough.
It's certainly enough to supplement and make things more worthwhile,
whether it's enough for, I mean, I don't know.
I guess it depends on what you're willing to live,
your standard of living and everything else.
Definitely.
It may not be enough to live on,
but it might be enough to buy whatever the lasers that the bunny is going to
need to kill us all with.
Yes.
I certainly, I would certainly say that I'll admit my hobby is not self-financing yet,
but I could believe in time it could become.
So what else are you using the,
the ESP chip for?
So one project that almost became commercial,
but it didn't.
And unfortunately there,
that was also kind of,
once we started
looking at, okay, well, how many would we be able to sell? What does it really cost to get things
FCC certified and all that? It became not really financially viable. But for hobbyist projects
right now, there's two things that are kind of on my horizon. One, I've already made a circuit board for, and that's actually one thing I wanted to touch on with the ESP8266. It's really easy to
make your own circuit board design that uses some of the GPIOs for a software I'd squared C bus and
maybe an interface here, one output to a WS2812 LED, a little bit of this, that, and the other
for whatever you need. And use the ESP8266 as a
star processor without having a module. They are QFN 20 packages or 20, 20, 24, something like that.
They're actually surprisingly easy to solder and surprisingly easy to work with and they only require a crystal, three
capacitors, and the external flash. I think it's like two resistors or
something. So it's very few components and if you are into making your own
circuit boards or I guess it's harder to print the way that they route on the ESP
it's difficult to do on one layer. But if you're into buying circuit boards from places like Osh Park and whatnot, it's really easy to implement.
So going back, there's a quadcopter I'm working on right now.
And it's been on hold, but I'm able to get telemetry from it and over the network.
And I'm able to communicate with the motor controller, which I made out of an AVR and some other stuff and I'm also working on implementing color cord on the
ESP8266 so I know I've started a lot of things I don't really know where you want to go and what
questions you might have so go what is color cord colorord is a mapping from sound to light.
And the history behind that was I got a guitar that was clear and I put a bunch of LEDs in it.
And I said to myself, how cool would that be?
I'm sure somebody's come up with some really good algorithm for mapping what colors these LEDs should be.
And the answer was they didn't. And nobody has an algorithm that does really good mapping from tones
into colors for output on any kind of LED system or anything like that.
And so I had to make it myself.
And at the time, I worked very hard on it.
I probably spent a few hundred hours.
I had to learn a lot in order to do it.
Unfortunately, my algorithm required so much computational power,
I had to run it on the GPU.
And I was able to do it.
I was able to map within octaves, say E would be mapped to yellow,
and E in every octave would be mapped to yellow, and E in every octave would be mapped to yellow.
And as you go up the chromatic scale, the colors would change accordingly.
They would shift from yellow to reds to purples to blues to green, all the way back to yellow.
And it really provides something distinctly different than existing color organs that look more at mid-range high
or something like that. For this, when you hear the same parts of the song, you get the same sets
of colors. You also get a lot of color science neatness when you have chords because you'll see
combinations of colors that are complementary within, say, major chords. within minor chords it changes the feel uh and and it really kind of all went
together surprisingly well uh right now i had spent a while talking to my roommate who's a
mathematician and was able to to to kind of get it much much more optimized to the point where i
think i might be able to run it on the ESP8266, maybe,
and I'm hoping to run it there. I was able to do everything in integer math, which was a major
boon, and I was able to drop the size of some of the types and things like that. But I've done a
couple projects with it way back when using the old one, and I've posted a few videos to YouTube using the new one. Some of them
with strips of WS2812
LEDs, some with bunches of WS2812
LEDs. And I don't
think I have any videos, but I have also mapped
it to having four discrete LED
lights. That sounds awesome.
And can the
ESP chip control
the WS2812s
with their funky, weird timings?
Yes, and conveniently so.
Although, admittedly, the project that I have seems to have some sort of jankiness to it
that nobody has yet contributed a patch back to.
But there's somebody else who has forked my project on GitHub
that is much more robust as far as controlling the timings.
And it will, both in, I think, 80 MHz and 160 MHz mode,
be able to output to WS2812 LEDs, the whole string.
It turns off interrupts while it's outputting the WS2812s,
but that's okay because you don't really miss packets or anything.
They all end up coming in because there's dedicated hardware for that um so yeah if as long as you're not trying to output and be able to do a lot of
other processing concurrently and all that sure esp8266s will light up little ws2812 strips
has color chord made you a better musician or or made you more able to do perfect pitch?
No.
And the reason behind this is that your eyes... Is it because you spent hundreds of hours instead of practicing guitar?
Well, yeah, although this was...
This is mean to everybody today.
I'm sorry.
I am too.
I understand the principles of how to play a guitar now,
and that is something I did not at the beginning of the project. No, the reason is actually kind of an interesting one.
And it's that your ears, even for people who don't have perfect pitch or even remotely close to perfect pitch, your ears are much better at discerning changes in pitch than your eyes are at discerning changes in color.
And it is, it is significant. Uh, and people, it's a question a lot of people have,
and I never really thought about it until I was like, okay, I really have to come up with an
answer for this one. Cause I know people have asked that it really, if you look at it, the
difference between, and ah.
Okay, that's significant.
Ah and ah.
Your ears can pick it up.
I like it when the guests sing.
I really do.
But your eyes can't.
There's just no way.
If an octave is the rainbow, you're not going to be able to see something that insignificant.
Unless you greatly exaggerate the mapping so that an octave is like the entire color space or something. I could see that, but I'm not sure how useful that would end up being.
Yeah. And for all I know, maybe even mapping, say, around a specific letter so that you can
learn perfect pitch would be a neat way to do it. That's not an application I have really seeked out.
And then the other project you mentioned were Wi-Fi
helicopters, quadcopters? I don't know if it's going to work. I don't know if it's possible,
but this is definitely along the lines of why I engineer things. Yeah, I took an ESP8266.
Originally, it was a four-layer board because I'm trying to fit them into a Hubsan helicopter or
Hubsan shell. Hubsan makes really cheap quadcopters.
And eventually I was able to figure out how to put it on two layers, which, okay, that's great.
It's got the ESP8266.
It's got a little programming header on the side.
It's got four MOSFETs with the diodes protecting them with a little ATtiny441 to control the PWMs on the motors,
a little I2C bus with the barometer.
It's got the, I don't remember the exact number, but it's the new ST combination magnetometer, gyro, and accelerometer.
And surprisingly, you can actually use the pull-up resistors
built into the ESP8266
to be the pull-up resistors
on the I2C bus.
So all this stuff fits in,
I'm guessing it's maybe
about one square inch.
I can look it up.
But yeah, you can fit in.
It crammed it all in there,
printed it, ordered it, tested tested it wrote a lot of firmware so
far but i haven't really gotten to the point where i've hooked it up and started testing with flight
that that also scares me because i'm liable to break a lot of stuff but break stuff break stuff
i gotta do it someday um could you put that in tindy i have some things I'd like to use it for. Oh, the combination thing?
Yeah, the ESP8266 and the ST-IMU together in Wi-Fi.
Yes, please.
Sign me up for like 12.
Okay, well, I will talk to you a little bit more
to see if I can flesh my design out.
There are so many applications.
I have a Bluetooth widget connected to an IMU that isn't quite that ST one,
but I know which one you're talking about.
Yeah.
And it's super useful for explaining how inertial sensors work,
but Wi-Fi would be so much better.
And quadcopters, yes, that would certainly be a good place for it.
But there are lots of other gesture-based and prototype things that...
Yes, please sign me up for a few.
Now, for small devices, what's the power situation?
Well, both of those are super low power.
But ESP is not?
Well, yeah. Go ahead. Sorry.
Sorry. ESP, it does have a low power mode,
but it is not connected to Wi-Fi when it's in that low power mode.
The RX front end actually draws a fair bit of juice.
I believe it's on the order of,
you can get it down to around 200 milliamps,
but that's still a lot of juice on something that small.
But that's phenomenal for Wi-Fi.
Is it?
It's certainly not bad i don't know now i have to go look and see what the broadcom chip is which i can't say because i'm under nda
have you been looking at any of the 3g chips that i know Spark has a Kickstarter and they've renamed themselves, so it's all
very confusing. They're now Particle.
The Electron, I think
it is.
It's a little 3G.
And if I search for Electron Particle something,
this is not going to work for me.
It is a little bit generic.
I was just wondering if you were exploring any of the cellular stuff.
Not at all.
Because I am really cheap
and i am not going to be spending any money on a cellular plan for my hacking hobby yeah yeah well
that was one of the cool things about the electron was they actually provide a plan that's really
cheap but it was not high bandwidth so it'd be mostly for low rate telemetry kind of stuff
if it's cheap i'm interested'm going to write this down now.
It'll be in the show notes too.
Once I figure out.
I mean, because even electron particle spark still is... Oh, it's mostly there.
Oh, here it is.
$3 a month for one megabyte.
Which, yeah.
Okay.
That's within my range.
He's got so much Wi-Fi
I'm just trying to help him find new things to do
Uh, yeah
I don't know that he needs that sort of encouragement
We should be encouraging him to make the things we want
Because he seems to be doing all sorts of cool stuff
Well, I want a quadcopter with both cellular and Wi-Fi
So that it can hop from zone to zone
But you can still talk to it.
Oh, in case you lose it?
Yeah.
That would be good.
You also do have a standard electrical engineering sort of job.
Well, sort of standard.
You mentioned Neon FM.
Yes.
And I am definitely the electrical engineer on that team, all in all.
And honestly, that has kind of been one of the most. I am definitely the electrical engineer on that team, all in all.
And honestly, that has kind of been one of the most... So because I was able to see that project through all of its stages,
I have definitely learned an enormous amount about electrical engineering.
And it's something that, okay, I'll admit,
I have not been able to get from my hacking hobby.
But being able to go from, hey, it's going to have to have buttons, to designing and laying out the buttons, to getting them printed in my basement, to getting them printed overseas, to being able to use solder paste and dab the little solder paste on the pads using toothpicks to buying stencils to
eventually, okay, fine. I'll just go pay some company for a hundred of these. And then I had
no idea how much you have to know about connectors. I've always just soldered wires to boards.
You can't do that. It just doesn't work. I got really, I don't know.
I have had to learn so much about electrical interconnects and different ways of hooking things up.
And the mechanics of electrical engineering, the stuff that they just don't teach you in school.
That, I don't know.
I thought it was a lot of fun and a lot of learning.
And I'm really glad I was able to take it from every single step of the way.
And it's in production now?
Yes, it's in production.
We should also say what it is, because I don't think Neon FM is quite as...
Okay. Neon FM is an arcade game that's a rhythm-based arcade game. So if you've ever
seen something like DDR, where people will step on arrows on a pad with arrows scrolling up the
screen, when the arrows get to receptors, you hit it. The arrows are to music. The same sort of thing
goes with Neon FM. We have a wheel where these notes fall down it like a waterfall. And once the
notes get to receptors,
there's five buttons you have to press.
They're in an Olympic rings pattern.
And you hit the button when it gets to the bottom.
And when you hit it, depending on how well you do,
you either get more points or less points or lose life if you really get poor or you miss it
or gain life if you do well and you hit it.
And it's just a stand-up unit
it has a boatload of leds because i love leds and uh and the other engineer on the project was like
sure we'll just add however many leds you want it ended up i mean i don't know there's probably over 500, 600 LEDs on there. And right now it is in production.
We have maybe 10 units, 12 units out on test locations,
probably 10.
We have a backlog of several,
although we're getting closer to finishing the backlog
at this point.
We're stepping up production.
So before it would take us literally two weeks
to make a machine
when it was in the prototype phase to taking about three days uh now and hopefully that'll
keep speeding up and speeding up as the orders get more and more it seemed sort of like a guitar
hero crossed with dance dance revolution crossed with lots and lots of lights.
That's a really good example.
That's a really good description.
But it was a traditional arcade game.
I don't know that they used to have.
Pac-Man used to be a real arcade game and not just on my phone.
Who buys arcade games now?
Chuck E. Cheese.
That is a major purchaser.
I won't be able to say which companies were selling them to.
I guess Game Busters, too.
Again, I can't comment on which companies were selling them to.
Minigolf.
I think so.
They have not bought a new game in a long time.
It's surprising just how many ma and pa places are out there that are interested
when you go to these when you go to uh uh entertainment trade shows so many people are
there from so many different things that'll take a look and be like okay yeah i'm interested and
just straight up buy one and it's just wow so they really you would be surprised if you look
for arcades in your area i think you'd be hard pressed to to not like that you may i would be surprised if you were more than 10 minutes from the closest
set of arcade machines oh we're definitely not we just haven't gone because we're that's okay
uh so schooling you mentioned umbc that's university of maryland
yes baltimore county and uh i don't really know why I decided to go there other than I was really surprised they accepted me.
Because in high school, I really struggled.
And I had just an awful GPA.
And my SATs were not that great.
But they accepted me by some miracle.
And I went there for five years to study computer engineering.
Though I realized very quickly in
I was very interested in video game programming.
So I took all of the courses I could
and I ended up graduating with 160 credits
with an undergrad, which was ridiculous.
Took me five years.
And then I went right back
and went to grad school for computer science.
And yeah, it was a really good experience.
People are always like, oh, you don't learn any of this stuff in college.
And the funny thing was I'd been hacking hardware together since I was like five or eight or something.
I don't really know.
But I was surprised by, I thought it was some sort of hot shot when I got there.
And I was really surprised by, I did not know how much I didn't know until I started learning the things that I was learning.
And I absolutely loved that experience there.
They're a spectacular computer engineering program.
It's funny when you said you didn't do that well in high school I was sort of expecting you to say that college was just I don't know many of our
guests have said that college wasn't that good for them and it's kind of nice to hear you say
that it was although you then didn't go to a traditional engineering house afterwards.
No no I definitely didn't. College was, was it a spectacular experience? I think mostly
because, I mean, as stupid as it sounds, what I did in my free time there, which was get together
with other people and start engineering things. And I think that, and mostly software, admittedly, as an undergrad. I also didn't have any money for hardware. But college was definitely the time in which I finally started to understand the course material. I had a very hard time in high school. And I started to find people that were interested in learning and working on the same sorts of things I was. Yeah. And the people that I met in college were the ones that I still,
I still keep in touch with.
And,
and they're the ones that if they,
if they say,
do you have a job or do you want a job?
I'm like,
yeah,
tell me more.
And a lot of times I trust them to have good,
interesting things to work on too.
So yeah,
the people are very important.
We are almost out of time
and I'm sort of sad that I have a hard stop today
because I think we have a lot more we could talk about.
Christopher, do you have any last questions?
Yeah, so we've talked a lot about the ESP today.
I'm just wondering if he's got his eye
on anything else on the horizon
that he's excited about in a similar new device vein.
The answer can be no.
No.
Wrong.
I feel like the ESP is a treasure trove, gold mine, amazing.
I feel like we've just barely begun to scratch the surface of what we can do with it.
I need to get some because they are very cool and you've convinced me that it's not
going to be that hard to get started yeah i mean all that started because i wanted wi-fi and
something so i started trying to figure out how to do that with an avr using usb and master mode
with a cheap wi-fi device theP8266s are so,
they're exactly the right product for where we are today
and wanting to mess around with adding Wi-Fi to things.
It is the product that you want for that.
I'm more excited about the Internet of Things coming from Charles
than I am coming from the large companies
it seems to be pressing
down from.
I suspect his internet of things is going to be really cool.
I still don't understand quite what that term means.
Nobody does.
Nobody does.
So Charles,
do you have any last thoughts you'd like to leave us with?
No,
not really.
Okay.
Well then we will all get to our evening
activities. My guest
has been Charles Lohr, electrical
engineer at Unit E Technologies
and hardware software hacking
enthusiast. I suspect we'll
be hearing more from him in the future.
Thanks, Charles. Thank you very
much for having me. It's been wonderful.
And thank you also to Christopher White for co-hosting and producing.
Special thank you to listener Stu Taylor for suggesting we invite Charles on.
It was a good suggestion.
And thank you for listening.
Don't forget about the Planet Labs contest and their job openings.
It's planetlab.com slash careers.
Email them your resume at embeddedfm at planet.com. Email me your entry on show
at embedded.fm or hit the contact link on embedded.fm. I do have a final thought for you
from Nikolai Tesla, who really, I could just use him all the time. But he said,
if you want to find the secrets of the universe,
think in terms of energy, frequency, and vibration.