From Code to Hardware with Dan Johnson

Welcome to Countdown to Laravel Live I'm Mathias Hansen, your host.

And today I'm chatting with Dan Johnson.

Hey Dan how's it going?

Hiya, really good thanks, great to be here.

Thank you for being on and thank you for coming to speak at Laravel Live later this year.

Yeah, super excited to be there.

I loved my time last year at Laravel Live Denmark.

So yeah, really, really excited to be back.

Yeah, and we'll talk about later, but this year you're gonna have to talk about something
completely different from last year.

So that's gonna be fun.

the last talk.

Yeah, this one, I've been excited to talk about this for a while.

It's been a project that I've been working on for a couple of years now.

So really excited to show you what I've got.

So before we dig too much into that, I really want to start at the beginning.

I want to hear more about how you first got into programming or computers.

What are your earliest memories of technology, essentially?

Yeah, so I've always been a bit of a computer nerd.

I remember back when I was about five or six we got our first family computer and it lived
in the computer room and it was this giant computer with a big CRT screen and we had a

scanner and a printer and it was running Windows 95 and I just I loved using the computer
this was before we even had internet and when I was in primary school all the teachers

said to me well you're gonna grow up to be some computer superstar and then yeah I guess
when I was in

in secondary school.

I had an interest in programming.

I didn't know what I was doing, but I started to teach myself some things, watching
YouTube videos, reading documentation, playing around with bits.

And I didn't go to university.

I just taught myself.

I got lucky enough to be hired as a junior developer by a local company working on their
e-commerce website.

And then on the job, I learned all about different frameworks.

I learned Laravel.

I learned some

JavaScript and then just worked my way up there and yeah work my way up now to head of
engineering.

That's incredible, that's quite the journey.

So you just got hooked right away, right?

Yeah, yeah, just super passionate about, I think it was being able to build things and
being able to see it right there.

I just, I got hooked once I realized that could do that and I could just imagine things
and build them.

Yeah, I loved it.

I never looked back.

So back Windows 95 computer, what got you hooked there?

Did you play video games or what did you to your to start?

Yeah, it's a really good question actually.

I'm not sure.

I never was super into video games or anything like that.

To be honest, it was probably just browsing documentation for things.

So once we got our first AOL dial-up internet subscription, I would just read.

I would read encyclopedias, Wikipedia, yeah, just try and get an idea about how things
worked and how programming worked.

So just a fascination with the world really, starting with the computer.

That's really incredible.

And then, well, also there was the, when I first downloaded Microsoft Front Page.

Not sure if you ever used that.

Yeah, I love that.

I remember when I built my first website with Microsoft Front Page and tinkered around
with some HTML, CSS.

And I remember the first time when I touched JavaScript, when I managed to get an alert to
pop up.

And I must have been about 10 years old and I just thought it was incredible that I could
control what the message is that pops up.

on that alert.

So that was the big key really to entering into programming.

I absolutely resonate with that.

I share the feeling.

can feel it right in here.

The alert popping up on the screen.

um So did you start out with web development right away, HTML, CSS?

Was PHP the first server-side language you used?

Yeah, it was actually.

don't know how I got into PHP, think, but that was the first one that I started out and I
remember really clearly writing some HTML, CSS and I wanted to program some stuff.

So I Googled and I found PHP.

I probably used the W3 schools tutorials and I remember the first bit of PHP that I wrote
was connecting to an SQL database and it was doing the horrible procedural stuff.

But I remember connecting to that database

and reading some values in PHP.

And yeah, that was my first entry into that.

I remember building my first, like, little, I think was like a chat application or
something with SQL, and I sent it to a friend who was much more experienced with the

stuff.

like, look, I built this.

I'm so excited.

I'm so proud.

The first thing he did was he essentially hacked the app because I have a very clear SQL
injection flaw in there.

I think there was some issues with sanitizing the HTML as well, it went completely crazy
right away.

But it's very humbling.

Yeah.

lesson.

mean, yeah, that's how we learn just by making those mistakes in the past.

So now you're head of engineering at your company you at now, right?

Yeah, yeah, really exciting.

mean, still lots of imposter syndrome every day, but yeah, I love what I do.

There was a great talk about that at Laravel Live last year.

Mmm.

So moving on a little bit, I'd to hear more about your talk.

So you actually gave a similar talk at Laracon India just a few months ago, is that right?

Yeah, that's right.

The talk is about interacting with hardware from a Laravel application.

It's something that I've been working on for a couple of years and I think it's really
exciting because it just opens up this whole new avenue of hardware development, which is

something that's always been a bit out of reach to us PHP developers.

It's always been under the assumption that you can't control hardware with PHP.

Usually you would have to write in C or something like that.

And yeah, I've built this package that allows PHP

Laravel developers to do that and it's a really easy code base, really easy library to
control those components.

And it's really exciting as well because it means that us developers can just let our
imagination go wild.

Anything that you think of that you want to build as a physical project, well you now can,
you just need to get the components and write PHP.

Are we gonna see some really cool live demos on stage perhaps?

Yeah, so when I was in India, I really wanted to do the live demos and then there was just
so much that could have gone wrong.

I also actually got some of my equipment confiscated at passport at the security airport.

Yeah, because I had some circuit boards in my bag and the security officers looked at them
and they were like.

what are these and I explained it and they were like yeah they're not coming through.

yeah that was in India when I arrived in India and we did the passport check and another
security scan there they looked at it and they were like what is this.

So yeah I would like to do some live demos on stage but for India I decided to just opt
for the videos that worked really well so we'll see how it works out.

Yeah, either way it's gonna be really cool to see what you can do with Laravel or PHP with
hardware.

That's insane.

yeah, yeah, it's really exciting.

So um this is built for Raspberry Pis, right?

Yeah, so Pinout is designed to run your Laravel code on a Raspberry Pi, and you connect up
your hardware components to the GPIO pins on the Raspberry Pi.

So what that does is it allows us to programmatically turn the components on and off.

But...

Pinout has also got some drivers for controlling some more complicated bits of hardware
like this thing here.

This is an LCD screen and it receives its information in the form of binary.

So in order to send it binary, we turn these individual pins on and off in a given
sequence and that's what Pinout does.

It abstracts all of that.

So you run your code on a Raspberry Pi and you tell it, I want to display this on the
screen in simple px

and then it outputs it on the screen.

So you can show your package download count from packages on your display or something
like that.

Yeah, exactly.

That's a great idea.

I've built a couple of projects where one of them is a physical button that I can press
and it uses the Domino's Pizza API to order me a pizza.

did have one of them that was a counter that displayed how many X followers I had, but
they've made some changes around the API now and they're starting to introduce some

pricing tiers.

So I've scrapped that one.

Gotta try with Blue Sky instead then.

I yeah, to be honest, I made a Blue Sky account right at the start and I thought, yeah,
this is so good, I'm really gonna stick to this, I'm gonna make this my main social

network.

And it's never really caught on.

I'm not sure what I'm doing wrong, but yeah, it seems like X is still where everyone is.

But you're quite a big user of Blue Sky, right?

I'm going back and forth.

I feel like it's very fragmented now and I'm not really helping by being indecisive of
where to actually post things.

I guess it helps, I don't post things very often so...

me neither and it's something that I know that I need to get back into the habit of
regular posting but yeah, it's just so difficult thinking of things to post and also a lot

of the time I'll think of something to post and then that imposter syndrome will hit and
I'll think, nobody cares about this.

Yeah, yeah, I share that feeling too for sure Awesome, so I'm really looking forward to
your talk It's gonna be really exciting to to to hear more and see more I as you know,

I've used your library in the past I've really enjoyed using it.

So I'm happy to see what

you're the second contributor to Pinout next to me.

So thank you for your contribution.

Yeah.

That's hilarious.

Well, I'm happy to help.

And I think you had a pretty major update to library since last Tuesday too, so looking
forward to hearing more about that.

and yeah, that's just massively improved the performance of it.

So that's what paved the way to allow us to be able to interact with binary devices like
LCD screens.

Before that, the library was just too slow and we couldn't do anything with it.

So have you always been into messing with hardware as well, like Raspberry Pis and, you
know, digital?

the entry into hardware...

It started about two years ago or maybe a little bit more than that now I started
tinkering with like small micro controllers and The problem was with those they don't have

enough resources to run PHP So you have to write C but I loved that action of being able
to write some code and See it physically and I guess it kind of ties into my first love of

web development being able to type some code and see it on the screen This was like the
next step up from that

being able to type some code and see that physical project.

So yeah, I've really, really enjoyed that.

But again, it's something that I've just taught myself and there's probably lots of things
that I'm doing wrong.

But yeah, it's something that I'm really enjoying lately.

And it's great to merge that in with my other passion of Laravel.

Yeah, it sounds like awesome you get to play with both things and still write your
favorite programming language.

Yeah, exactly, yeah.

So Dan, we're almost running out of time, but I have one more question for you.

I know you were of course in Copenhagen last year for Laravel Live, you're coming back as
a speaker again.

But what is something you really want to see or eat or experience while you're in
Copenhagen this time?

Well, first off, the drink Faxacondy.

I can't wait to have another one of those.

I love that.

We don't have that back here, so every time when I'm back in Denmark, that's definitely
high up on the list.

One thing that I really wanted to do...

oh

listeners at home, Faxe de Cundi is kind of like a sprite, but it's a little bit better.

Yeah, yeah, I agree.

But another thing that I wanted to do, I didn't manage to get around to it last year.

They do a sea plane that takes you on a sightseeing tour of Denmark.

And well, not of Denmark, just of Copenhagen.

And I really wanted to do it last year, but they only have limited spaces available and
the dates didn't really match up.

So fingers crossed, maybe the dates might match up this year and I'll be able to go on the
sightseeing tour.

That sounds amazing and especially if the weather is good, which we promise is going to be
really good, that would be really lovely, especially with the ocean next door and

everything.

That sounds amazing.

I love just being able to see, I mean, even when I fly into Copenhagen and you can see
that bridge in the ocean and that's just such an amazing view.

So I'd love to see that from a sea plane as well.

Really exciting experience, I think that'd be.

Well you definitely gotta share some photos on X if you end up doing that.

100%.

Yeah.

Well then, thanks so much for talking to me today and looking forward to talking in just a
few months.

Yeah, great to speak to you and yeah, can't wait to see you in a couple of months.

Looking forward to it.

That was Dan Johnson sharing his journey to the head of engineering and the risk of
packing Raspberry Pi's in your suitcase.

Want to hear more from Dan?

He'll be presenting at Laravel Live Denmark August 21st and 22nd in Copenhagen.

Grab your tickets at LaravelLive.dk because his talk is going to be one you want to catch
in person.

uh

Thanks for tuning in to Countdown to Lave Live Make sure to subscribe so you don't miss
any of our speaker interviews leading up to the conference.

Until next time, keep coding and we'll see you at Laravel Live Denmark.

From Code to Hardware with Dan Johnson
Broadcast by