🌈 ESP32-S3 Rainbow: ZX Spectrum Emulator Board! Get it on Crowd Supply →
View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

Hey everyone! In this video, I’m diving into testing the cool functionality of my new board that I designed, and demonstrating how to use both an accelerometer and gyroscope with my favorite little tool. The board is rocking an LSM 6DS3 sensor, which works like a charm, despite the tiny LED snafu from before (watch my 'ninja repair' in the previous video, haha). I walk through the different modes, including a fusion mode that magically blends sensor data for accuracy. Also, there's some cool 3D modeling in play where you can bring any model to life on my public website – yes, even a teapot! Plus, it's all open source on GitHub, ready for you to get hands-on and maybe even add your enhancements. Enjoy!

Related Content
Transcript

So, I’m testing out the rest of the
functionality on my board. Now, if you
are wondering about the little fix here,
which I think you can see, uh, go watch
the previous video where I did a ninja
repair on my LED, so it actually works.
And you can see it’s working here. We’ve
got a nice blue LED showing that we’re
connected over BLE to this nice website
I’ve made. So, in this video, we’re
testing out the accelerometer and the
gyroscope. So, I’m using the LSM 6DS3 on
this board. Um, it’s right here on the
board and as you can hopefully see it’s
working perfectly. Now, as always, the
boards came from PCB Way and they’ve
done a great job. So, apart from my
screw up with the LED, everything seems
to be working so far. So, check out a
link to PCB Way in the description, the
boards have come out really nicely. So,
you can see all this lovely silk screen
and uh you can see it in the 3D view as
well. It’s pretty cool. So, um,
obviously this is using the
accelerometer. So, I’ve got three
different modes. So, we’re currently in
accelerometer mode. Now, this does work
quite well. We can detect um I think
this is
pitch or is it roll? It’s one of those.
This must be roll. And then we have
pitch. So, we can flip the board up and
down. But there are some limits on this.
So, what we can’t detect is your. So, if
I rotate the board around the Z axis, we
don’t get any results. Now, this is
because Zed is pointing upwards and the
X is pointing that way and the Y is
pointing that way. So there’s no change
in the accelerometer when I rotate the
board. Um it doesn’t really do anything.
And when we flip the board up like this,
things do get slightly confused. So
because now Zed is almost zero, you
can’t really tell what the orientation
of the board is. Now if we rotate the
board, we do get very interesting
effects. So obviously also not quite
what we’d like. So not ideal if you just
use the accelerometer.
So what you can do is you can switch
over to using the gyroscope. So I’ll
just reset that to zero. So with
gyroscope what you get is the change in
angle around the um the axis. So it’s
the rate of change of angle. So now we
can spin the board around and our 3D
model updates nicely. And you can see
here we have the real-time Java numbers
coming in and we got the integrated
value. So, I’m doing the integration in
the actual web page here. So, as we
rotate around, we get nice updates and
it looks very sensible. We can flip the
board up and we can rotate it like that
as well. So, that’s pretty cool as well.
But the problem is if I put the board
back down flat again, you’ll see that um
we’ve gradually introduced quite a few
errors. So, that’s not ideal really. So,
if we reset the gyro, we can get back to
how we were. But um again, if we rotate
around eventually, it will slowly get
out of out of whack. So, it’s still
fairly accurate there, but spin a bit
more.
And you can see it’s really really gone
a bit wonky. So, the third mode is this
fusion mode. So, I’m using a um a little
library from these guys. It’s based on
the PhD of Magic. So, if you want to
learn about this, I’ll put a link in the
description. You can go off to this
guy’s thesis and read all about how this
works. Now, ideally, we would have a
magnetometer sensor as well, but I’ve
only got a gyro and accelerometer. So,
I’ll just reset the board to get
everything back to a known state. We’ll
reconnect
and I’ll switch into fusion mode. So,
you can now see we’re starting off
pretty flat. So, I can spin the board
around as you’d expect.
And that works well. But if we go back,
still flat, flip the board up, spit it
around,
and we don’t get that much error
creeping in. It goes back to pretty much
where it was before. So, this is
combining the accelerometer and the
gyroscope measurements. Um, you can see
in this graph here that it’s feeding us
through the various rotations. Here’s
the gyroscope and the accelerometer
graphs. So, so that works pretty well.
So, it goes back and it’s completely
flat again. If we go back to the
gyroscope, you’ll see as we move around,
it very quickly introduces errors. So,
it’s already gone slightly out of whack.
So, this fusion thing does work pretty
well. Um, it still has some errors. So,
it’s pretty flat there, but eventually
it will get out of sync. One thing I
have noticed that’s quite interesting is
um this temperature value here. It does
seem very sensitive to temperature. So,
as the temperature increases, as the
board warms up, we do get some drift of
the values, but the fusion stuff does
actually work pretty well. So, I’ve
wiggled around with it quite a lot and
it’s still flat. So, that’s pretty good.
Now, I might put a magnetometer on the
board because then you can get really
accurate um fusion values. There’s quite
a few algorithms for this. So, um I
think Adafruit has one as well. So, I’ll
put a link to their instructions in the
um description as well. So, it’s pretty
cool. So, do you want to use this
yourself? Well, this website is public.
Um, you can actually load up any 3D
model. So, I’ll show you how to get a 3D
model. But first, let’s just prove we
can load up 3D models. So, we’ll um go
and find a teapot, which I have
somewhere. So, there you go. I’ve loaded
a teapot model up. And now we can pour
some tea and spin our teapot around and
do all sorts of crazy stuff. So, let me
show you how to actually get one of
these GB files. So, you could use this
website yourself. Then, I’ll show you
how to use the firmware. Um, and it
should just work with this website. So,
let’s do a bit of um 3D modeling of our
PCBs. So, the first thing we’ll need is
the 3D model of our PCB. So, in Keycad,
you just go file and then you go to
export and you can export step. And I’ve
just noticed you can actually export a
GB directly. So, just go here and that
will give us a GB file. So, let’s export
that. I’ll put it somewhere where I can
find it. Um, somewhere easy. Let’s just
put it in my downloads folder.
Okay. So, that’s the GB file exported.
So, back on our website, choose our GB.
So that’s the one I’ve just exported
and then we can load it up.
So there’s our PCB. Now I can see
there’s no silt screen. So let’s get
that fixed.
So back to export.
So GB export silk screen. Nice. So let’s
export that again.
Okay. Exported. Let’s load it up.
There we go. Nice silk screen.
Not bad at all. Pretty cool. So, turn on
Fusion. We can do all the rotations, all
the magical stuff. It’s a pretty nice um
pretty nice thing to play with. So, I’ll
quickly show you the firmware so you can
edit this yourself as well. All this is
on GitHub. So, the only thing you’ll
need to do is change these three values.
So you need the SDA pin and the SCCL
pin. So the data and the clock pins for
your um for your board. And then you
need the address. So my board is on um
6B hex. Now most boards will use 6A hex.
So you may need to change that. And then
the only other things you need. I’ve got
some battery charging and some indicator
LEDs. So if you comment these out, then
the code will carry on working. It just
won’t use them. So then you just run
this firmware and then on the website
you can have a connect over web serial.
So if I plug in um USB so that’s USB
plugged in then I can disconnect from B
and I can connect over web serial. So
hopefully that will show up.
So there we go. Just have a power cycle.
So now I can connect over web serial as
well. So that works quite nicely. Uh all
it’s doing if I um open up the terminal
here then um just need to disconnect
here and then we can run the monitor
command and you can see we’re just
outputting a whole bunch of JSON. So
it’s pretty simple. We have the
accelerometer measurements, the gyro
measurements, the temperature and the ul
values are the values coming out of the
fusion algorithm. So, it should be
pretty easy to run this on your own
boards if you have a board with the
right um module on. So, the LSM 6DS3,
then um this should work for you as
well. Give it a go. Let me know how it
works out. It’s all on GitHub. So, if
you pop over to GitHub, then feel free
to uh raise PRs uh fix any bugs. If you
want to support your own hardware, then
go ahead and do it yourself. That’s why
it’s open source. Thanks for watching. I
will see you in the next


HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts