►
Description
From the Berlin Rust's October "Rust and Tell" Meetup (https://www.meetup.com/Rust-Berlin/)
"Rust and Tell“ is a monthly event to share ideas, and learn about new things in and about Rust. Meet fellow Rustaceans, share your learnings, get motivated and inspired. We’re open to any and all kinds of talks about any subjects that you think will be interesting to an audience interested in Rust. Whether you're an experienced Rust developer or just getting started, we strongly encourage you to share your learnings.
Tanks Transfield: https://twitter.com/Mirabellensaft
Hosted at Prisma: prisma.io
🎥 Filmed by iStream: http://www.istream.pl/
A
Hello,
everyone
yeah
I'm,
going
to
talk
to
you
about
building
as
carbon
dioxide
measuring
device
with
embedded
rest
and
since
I
like
to
dig
into
stuff
from
right
in
the
beginning
and
into
very
detail.
I
am
making
this
into
a
story
of
how
to
turn
an
amount
of
molecules
in
the
air
into
a
human
readable
number
Who
am
I
thanks
transferred
my
pronouns.
Are
they
them
I'm?
A
A
former
teacher
for
chemistry
and
art,
and
now
I
do
embed
the
development
and
teach
Russ
at
Ferris
systems,
and
you
can
find
me
on
Twitter
and
github
under
the
name
it
happens.
Left
I
am
also
an
organizer
organizer
of
wrasse
bridge
Berlin,
and
we
have
a
well
respite,
an
organization
that
helps
marginalize
people
to
learn
rust
and
we
have
a
workshop
on
November
23rd
and
we
still
need
coaches.
A
A
A
So
atoms
bond
together
to
form
molecules,
I,
have
two
examples:
one
is
carbon
dioxide,
we're
just
made
out
of
two
oxygen
atoms
and
one
carbon
atom
and
one
water
molecule
which
is
made
out
of
two
hydrogen
atoms
and
one
oxygen
atom,
and
the
important
part
here
is
that
molecules
have
geometry,
despite
both
obvious.
Having
are
made
of
I
mean
are
made
out
of
three
atoms.
A
A
Infrared
radiation
is
on
the
spectrum
of
elected,
so
electromagnetic
radiation,
pretty
much
right
outside
of
the
spectrum
of
visible
light,
so
oftentimes,
it's
referred
to
as
infrared
infrared
light
and
wavelength.
That
is
most
interesting
for
this
type
of
sensor
is
the
wavelength
at
1
micrometer,
which
is
indicated
with
the
arrow.
A
Yeah
infrared
interacts
with
molecules
the
molecules
absorb
energy
and
they
start
to
vibrate.
This
is
a
carbon
dioxide
molecule,
showing
the
different
kinds
of
vibrations
it
can
do
and
other
than
in
this
gif,
usually
more
than
one
type
of
vibration
can
appear
at
the
same
time
in
the
same
molecule
and
additionally,
to
that
molecule
spin.
So
molecules
are
a
very
wobbly
subject
and
not
static
at
all.
So
the
substances
increase
in
temperature
as
the
vibrations
of
the
single
molecules
dissipate
as
heat.
A
A
Carbon
dioxide
has
peaks
here
at
4.2,
micrometers
and
here
about
two
and
a
half
and
back
in
the
end,
between
14
and
16.
It
has
some
smaller
Peaks
too,
and
the
profiles
of
other
molecules
look
different,
but
these
profiles
are
not
completely
unique
and
for
us,
the
overlap
between
carbon
dioxide
and
water
is
very
important.
As
you
can
see,
this
carbon
dioxide
peak
almost
shares
the
same
peak
with
water
and,
as
the
height
of
the
peak
indicates,
the
amount
of
the
substance
detected.
A
A
A
After
the
bandpass
filter,
there
is
the
passive
infrared
sensor
which
converts
the
remaining
infrared
into
voltage.
It
consists
of
a
very
simple,
a
polarized
crystal
incoming,
remaining
infrared
is
absorbed
and
the
crystal
heats
up,
basically
with
the
same
mechanism
as
the
carbon
dioxide
molecule
does,
because
the
ions
and
the
crystal
will
start
vibrating.
A
A
The
next
step
is
the
sensor
firmware
which
converts
the
voltage
an
analog
signal
into
digital
signal.
The
carbon
dioxide
concentration
is
inversely
proportionate
to
voltage,
and
a
conversion
factor
is
previously
obtained
by
calibration,
but
there
are
two
things
that
have
to
be
factored
m1
is
a
temperature
offset
and
the
other
one
is
humidity
where
water
again
plays
a
role.
A
The
higher
temperature
leads
to
less
carbon
dioxide
molecules
being
detected
because
heat
leads
to
the
expansion
of
the
gas
in
the
sample
chamber
and
higher
pressure
inside
will
press
molecules
outside
of
the
chamber
and
the
water
content
in
the
air
is
extremely
variable,
especially
when
there's
a
lot
of
people
present
or
when
weather
is
changing.
When
it's
raining
outside
and
water
molecules
basically
dilute
the
sample
so
to
have
values
that
can
be
comparable
to
others.
We
always
need
to
have
basically
a
dry
sample,
so
the
humidity
is
subtracted
from
that.
A
Next
step
is,
we
need
to
talk,
the
board
needs
to
talk
to
the
center
and
it
does
so
through
a
protocol
and
the
one
I
use
is
I.
Squared
C
I
squared
C
consists
of
two
signal
lines.
One
is
the
serial
data
line,
and
one
is
this
your
clock
line-
and
this
is
on
a
very
abstract
level.
What
the
signal
looks
like
this
is
basically
voltage
high
and
low
for
each
line.
A
So
the
software
I
wrote
sends
these
signals
and
in
the
form
of
commands-
and
this
is
basically
what
a
command
looks
like
the
boxes
in
the
lighter
color.
We
don't
have
to
worry
about,
because
the
crate
that
is
used
for
this
protocol
does
that
for
us
and
the
other
ones
you
as
a
program
we
have
to
do
you
have
you
need
an
address
and
you
need
to
know
the
commands
which
are
usually
to
be
found
in
data
sheets
of
the
devices
you're
talking
to
and
oftentimes.
A
A
A
This
is
the
command
part.
This
is
the
address,
and
sometimes
arguments
are
used,
which
is
true
for
this
case
they're,
both
0
and
a
CRC
bit
right,
and
this
is
just
telling
the
sensor
to
start
doing
something,
but
sometimes
we
also
need
the
sensor
to
talk
back
to
us
like
in
this
case.
We.
This
is
a
command
to
ask
the
sensor.
If
data
is
ready,
so
there's
an
answer
to
be
expected.
This
time,
I
also
show
you
the
function
that
does
this.
A
In
this
case,
the
answer
can,
is
the
either
be
yes
or
no,
so
either
data
is
ready
or
not.
So
the
answer
can
be
0
or
1,
in
this
case
it's
1.
If
data
is
writing
and
when
data
is
ready,
we
can
tell
the
sensor
to
send
the
measurements,
the
data
and,
of
course,
here.
The
answer
is
not
just
yes
or
no,
but
a
lot
of
bytes
for
the
data.
A
So
I
will
guide
you
I
will
give
you
a
quick
overview
over
the
code
and
then
demonstrate
with
the
logic
analyzer
how
the
software
talks
to
the
sensor.
A
logic.
Analyzer
is
a
device
used
for
debugging
embedded
systems.
It
is
hooked
up
to
the
signal
lines
and
measures
the
voltage
and
basically
takes
a
snapshot
of
the
conversation
between
the
board
and
the
sensor.
A
A
A
A
A
A
A
A
It
was
kind
of
frustrating
because,
as
you
can
basically
see
through
this
talk,
embedded
systems
have
so
many
layers
and
the
rest
code
was
the
most
easy
thing
in
yeah.
That
was,
it
was
kind
of
treble.
The
rest
code
was
trivial,
but
getting
the
all
the
parts
working
together
with
resistors
and
all
the
yeah
small
details,
and
that
took
quite
a
long
time
to
figure
out.