Tumgik
#i2c vs uart performance
littleiv · 2 years
Link
I2C hakkındaki yazımızı okumak için https://bit.ly/3UJH2Ox tıkla.
0 notes
alex-mo-tech · 4 years
Text
SpotMicro Controller
Tumblr media
Between Amazon Prime and Netflix and Hulu and HBO Max and this new NBC dedicated channel and Qibi, I thought there was just too much media out there to possibly watch...and then quarantine happened...
My tops for quarantine so far have been
Tales from the Loop
Undone
Bojack Horseman
Infinity Train
to name a few.
But from that first series, Tales from the Loop, come these walky bois:
Tumblr media
Fig. 1 Still from Tales from the Loop
I instantly fell in love and it sent me on a trip looking for how the heck to make one of them...I mean, how in the world does a bipedal robot do what it does? From what I read, it’s basically an inverted pendulum problem where the legs are just in charge of catching the center of mass as it swings around. It’s really interesting to  boil it down that way, especially when you imagine it can sway side to side.
Instead of jumping straight into the toughest goal (as I usually do and then fail miserably with unfinished projects), I decided to start smallish. So say “Hi” to Spark-E (credit to my wife for the name), my quadruped starting point pal!
Tumblr media
Fig. 2 - Pic of my Spark-E (minus the bearings for the joints...was too impatient...)
I just opened up my Ender 3 (vanilla) for the quarantine which gave me a chance to find this project. The frame is 3D printed and takes quite a few days even if you’re going nonstop. I’ve done just the base frame because I have some ideas in mind for how I want to run it and there is a community working on AI around it.
In the meantime, I thought “Hey! I need some kind of a controller. So here is the layout of my dream controller and what I plan to do with it.
At it’s core, the controller will be a battery powered raspberry pi zero w. It will be game controller-ish so you can control the robot like a character.
That means it will have two analog sticks with push-in select buttons on each one. Since Pi’s don’t have ADCs built in, we’ll have to use one on the outside and attach it in. We usually have a choice of SPI or I2C to communicate with these guys, but which one should we use? More on that in a minute.
I want a d-pad for some on-screen menu selection, and some buttons to do neat functions (ugh am i just reinventing an xbox controller?). For that extra controller-like icing on the cake, I’ll stick on some L and R shoulder buttons.
I think it will be really handy to have a screen but I also want text input for the Linux terminal so I’m revisiting the xbox chatpad project from earlier. The chatpad will take up one of my UART lines, and the screen I have (from an earlier project) uses HDMI and is a touchscreen (based on SPI). That means my SPI port is taken up, so our ADC should use I2C.
My ideal controller will also have tilt control which I’ll measure through an IMU. I was already gonna stick one on the SpotMicro so I just bought two.
This is all possible thanks to 40 glorious pins, most of which are usable for signal (the rest are power). Here are how the pins work themselves out for now. If there are changes, I’ll make an updated post:
Tumblr media
Fig. 3 - Oof, never again with these trapezoids...Green for serial interfaces, Blue for GPIOs, and Red and Black for power
Everything is 3v3 powered with, of course, similar logic. In my memory, the chatpad was I2C but I was obviously wrong so I’m unfortunately stuck using two valuable pins. :(
So for part selection, here’s what I ended up with:
ADC: 4 single-ended channel ADS1115 IMU: HiLetGo BMX055 9-DOF sensor (I couldn’t discern it from the more expensive Adafruit kind in terms of specs besides that it spits out raw data instead of using an ARM M0 to collect the info into some abstracted numbers) Analog Sticks: DEVMO 5PC sticks XBOX Chatpad (the one I have has the Microsoft branded chip. Get from ebay if you’re cheap! I got mine a long time ago and this is apparently the Amazon listing I followed) Screen: UCTRONICS 3.5″ Touchscreen
I can’t really recommend them or not yet since I haven’t played with them enough yet.
Is it a lot? Yes. Absolutely. Is it even overkill? Are you kidding me? Of course it’s overkill.
On the interfacing side, I really want the controller to be flexible so I’m putting a switch for enabling and disabling bluetooth and wifi. Wifi will let Spark-E join the controller’s network and then we can use some IoT magic to send some commands between them. They’ll be over an encrypted channel but don’t let that throw you for a loop, it’s just the difference between drinking soda through a clear straw vs an opaque one - in the first one, you can see it’s a dark soda and can glean it’s coke, in the second one, you can’t tell, but they’re really similar form factors.
Why Bluetooth? Because I might not just use this with Spark-E. This is gonna be the Big Kahuna of controllers after all! Any new thing I make, I want to use whatever interface makes sense.
Alright, I think I’ve blathered long enough for an intro. Next up are prototyping each of the interfaces. I’m sorry but we’re going to be mixing languages. Sometimes it will be mostly in Python which I’ll throw up on the githubs and then the final program code will be C just because the structure makes sense to me and we can eek out some performance.
Alright! Signing off. More next weekend!
0 notes