# PoV Yoyo Project Rebooted: CircuitPython, 3D Printed Yoyos, and Popsicle Sticks (WIP Post #1)

I decided IAP started, which means it’s time to give up on work and just do side projects. Thanks to my earlier blog post listing, I had a concrete set of projects to work through. And thanks to the largess of my roommate, we had a nice working 3d printer (ender 6). so finally i could 3d print the yoyo shell (as opposed to 2.008, getting a cnc mill to cut an aluminum mold for thermoforming and injection molding, 3d printing is much easier). in fact the entire yoyo is 3d printable apparently, so i didn’t even need to buy more things from the hardware store, removing almost all friction from re-starting this project. (additional friction removal supplied by stealing supplies from ee friends)

specifically this design: https://www.thingiverse.com/thing:1766385

that adafruit circuit playground pcb design is so close to what I want, i wanted to just buy the circuit directly and just build it. sadly what i want are radial LEDs, not ones arranged in a circle, for the PoV display.

## mechanical structure

what i finally understood after printing it (re: how to do it without any hardware, like most 3d prints ask you to get some nuts or bolts at least): you can print threads into plastic directly, which are enough to screw into one side of the yoyo., and the other side of the nut can be glued in, with a hex design to retain so it doesn’t unscrew itself. the nut itself can be hollow so you can pass a battery cable from one side to the other.

## circuitpython

ok so that was the mechanical structure. now for the electronics and programming. my friend supplied an rp2040 (adafruit version) to play with and convinced me to try circuit python.

it’s so great. admittedly at first it was very frustrating, as i accidentally sent one board into safe mode so it wouldn’t show up as a usb, and then i downloaded the wrong circuitpython (the naming is sooo confusing) so i would drag the file onto the “usb drive”, the usb drive would disappear, but never show up again as “circuitpython” drive. so i would have to hold down boot-select-whatever again to get it to show up as a drive again. and i tried nuking the flash too. eventually i realized that

is not the one i wanted but rather

which, what. =____= such confusing naming.

nicely enough the adafruit rp2040 board takes lipo input (has jst connector) directly, and programs over usb-c. whoooo

so to start with, a breadboard and some standard throughhole LEDs. i used quick clips directly on the rp2040, connected to some male-male headers, and put 5 LEDs on the breadboard (with some 1k resistors).

I used the code form the lucky cat PoV and it … just worked! Yay!

I did run into some confusion (i think syntax differences between micropython, which code I stole uses, vs circuitpython?), in the end I made the modifications like so:

import time
import board
import digitalio

p1 = digitalio.DigitalInOut(board.D13)
p2 = digitalio.DigitalInOut(board.D11)
p3 = digitalio.DigitalInOut(board.D10)
p4 = digitalio.DigitalInOut(board.D6)
p5 = digitalio.DigitalInOut(board.D5)

LEDS = [p1,p2,p3,p4,p5]

for LED in LEDS:
LED.switch_to_output()

[... most lines same as lucky cat pov code ... ]

def display(message, duration=150, duty=585, length=101):
#motor.duty(duty)
dispm = build_message_display(message, length)
for n in range(duration):
for line in dispm:
for p, v in zip(LEDS, line):
if v:
p.value = True
else:
p.value = False
#p.on() if v else p.off()
time.sleep(0.001)

#motor.duty(0)
while True:
display('dood')

## popsicle stick and smd

My original plan was to mimic the yoyo spin with one of those tiny brushed dc motors, however after this success i decided to move straight to the yoyo.

fortunately i had eaten some boba ice cream (thanks costco) and saved the popsicle stick just in case.

with the pressure of hacking together a demo, it removed all my normal thinking decision making issues (what headers to put on my micro? what will my cool friends think of the way i implemented this?) in favor of “what is the dumbest way i can get this done”. so … don’t question what i did too much lol

i snapped the popsicle stick, drilled the holes, stuck the SMD LEDs on with superglue, then put in resistors. i used hot glue to hold the throughhole resistors so that they wouldn’t move around and rip out the pads from the surface mount LEDs.

soldering was a small disaster.

rip

i had no lipo, so i went to microcenter (!) to get one in person (!) unfortunately the smallest size they had was still quite large.

apparently i managed to get some actual solder joints in there, and the code just worked

then i hot glued the battery in. the feather was kind of a “press-fit” already, and the popsicle stick rested on the resistor legs.

the heavy battery on one side made the yoyo spin pretty wildly, so it was not possible to see what was going on.

to try to see what was going on, i stuck it on a drill (with some nice double stick tape) and spun it around. this double stick tape is amazing, i keep finding uses for it, it can almost entirely replace hot glue and look better.

hmm. not very legible.

## thoughts on next steps

my conjecture is that normally on a rotating object the words go around the circle, such that the base of the letters is the center of the circle. but since i adapted the lucky cat code, the sides of the letters are actually facing the circle.

i’ll save for a future update, but since the code was in python, it was super easy to figure out what was going on with the data structures. the lucky cat code actually has extra logic to flip the letters sideways, so it was straightforward to just take out that logic. (will save for future post)

with a bit of simple python code YAY NOT ARDUINO C we can see what what’s going on. on the left is output from the original code, and then i did some minor mods to get the right.

def convert_to_stdout(list_onoffs):
result = []
for line in list_onoffs:
result.append(['▫ ' if c==0 else '▪ ' for c in line])
printout = [' '.join(line) for line in result]
for line in printout:
print(line)

the upshot of this though is that if i want to try the second method, i will need 7 LEDs, not 5 LEDs 0: because the letters are each 5×7, and now they’re rotated

i found some batteries. the mini drone batteries have … mini jst. fortunately i dug around a bit and found a jst connector, so now to solder. and not cut across both battery leads with a scissor and short circuit the battery.

so, next steps; smaller battery, more LEDs, (maybe one day RGB LEDs?), new code, and maybe new shell when i’m ready.

not bad for 2 days-ish of work, hopefully i can stick through with this and turn it into a nice looking/working project instead of the hackish state most of my project end in.

## other thoughts

A few questions arise, I did some back-of-envelope math while sitting on a plane (i did, in fact, fly despite the omicron). I don’t think I ever installed MathJax on this wordpress instance but eh for now.

Q: What rpm does a yoyo spin at?

If we think of it just as a falling object (don’t consider conservation of momentum etc.) just to get back of envelope, With no rotation, an object starts at 0 m/s, and after 1 second it has fallen 4.9 m.

>>> d = v0 t + (1/2)a*t^2
>>> where a = g = 9.8 m/s^2

Now for the yoyo, if a yoyo has a 1 cm diameter, it’s around 3 cm circumference.

>>> C = pi * d

Thus when yoyo falls 3cm, it’s made 1 revolution in order to unwind that much string. So to fall 4.9 m, it’s made ~100 revolutions.

>>> 4.9m * (1/0.03) rev/m ~= 100 revs

This took 1 second to fall 4.9m. So the yoyo has averaged ~100 revs / second. This is about 6000 rpm.

>>> 100 rev/sec * 60 sec/min = 6000 rev/min

I guess that if a human is throwing it will spin faster though.

Note: The other way is to measure it empirically. I have a Samsung Galaxy S9, which has a super-slow-mo mode which according to the internet runs at 960 fps. This should be fast enough, if we use the above calculations I should be able to get around 9 frames of the yoyo spinning before it completes a circle.

> Note: I started on this, it does appear the yoyo falls a lot slower than normal object, because it has to twirl around a large inertial mass in order to fall. TBD then, I’ll take a slo-mo video of a yoyo and another object falling side-by-side.

Q: Is an Arduino fast enough?

I had a friend work on a persistence-of-vision project and ended up needing to switch processors, which stalled out the project. Is an Arduino fast enough?!

The answer is yes, I’m driving like 6 LEDs, they were driving like a couple hundred RGB LEDs lol. I looked a bit into the individually addressable RGB LEDs & IMUs, which seem to run around 8 KHz for the LEDs, the normal IMU MPU-6050 can be sampled at 400 kHz, and the basic Atmega328 runs at 16 MHz. IDK why I was concerned when the v0.1 I wrote on an attiny. And for the yoyo itself, 5k rpm is only 83 Hz, so that should be plenty fine too.

here is some other notes of stuff i learned from my knowledgeable ee friends (who nicely don’t make fun of me for my basic questions):

so the ws2811 uses a 800khz clock, takes 24 bits for one led
so assuming naive bitbanging of the protocol without timers (not true with lib but conservative)
so 30us to address one led
150us for 5 leds
80hz refresh rate gives a time budget of 12,500us
so you have a very large margin even if you manually bitbang the protocol

somehow I had assumed that bitbanging was super fast, like in my head it felt like “let me drop from C to assembly to get max speed” but it’s not analogous at all

I’m assuming the most naive bitbanging implementation that looks like:
write(1)
sleep(high_time)
write(0)
sleep(low_time)
the sleeps can be interleaved with your code by using timers and such, but the sleep way is definitely slowest and easiest to analyze

# Pandemic Diary #71 & #72 – my first covid test, finding good mask sizing (10 Dec 2021), booster, omicron (17 Dec 2021)

covid test – didn’t realize it could be so quick and painless (have had three now). once 24 hrs before flight back to us – pharmacy two blocks away, 35 euro for certificate, just cotton swab around inside edge of nose and wait 10 minutes. (rapid antigen test). once home had a day 5 test (see cdc studies on time to test) via some portable machine from google (nucleic acid amplication test – apparently same idea as pcr), same deal, results in ~25 mins. finally a true pcr test day 7, self-collect via same method, ship in (foot was still sad) free from pixel. results the next day or two. all negative. (later found out apparently CDC doesn’t recommend self-isolation/quarantine for vaccinated travelers o.o)

mask sizing — actually, for kf94 have discovered via trial and error that normal/larges are too big — unintentionally bought medium and it fit so well (was bizarre feeling at first) / so much less air escaping to fog my glasses

p.s. heated vest is amazing, use it literally every day

booster – hard to book cvs/walgreens, stupid mass vax finder website says shots available and quantity per day including next, but when go to actually book only appointments are 2 weeks out. reddit boston and found a random clinic in chinatown. was actually very serious and professionally run clinic (food and allergy clinic). friend says there’s qr codes that go to google wallet for each vial, but dr said cvs is making up their own unofficial ones. i get a 2nd vax card ‘cos publix put huge hard to read print outs over my first one lol. pretty crazy i’m on third free shot, while most countries in world have barely vaxxed health professionals.

usa is depressingly vaxxed. ga is like high 50s fully vax, mass high 70s. canada is high 70s. malta was high 80s. even uk doing better than us

omicron – briefly was concerned about returning due to some fast flight bans but realized i’m a citizen so generally fine (minus australia etc.). impetus to get booster (heard dr. fauci on radio say we should). to think that we would actually be able to measure waning immunity… still relieved that protected well against severe disease. going home to see my folks and killing them sounds like a bad idea. would never dream of this kind of travel before vax… funny. airbnb host blamed illegal immigrants for spreading virus. meanwhile i’m an international traveler she’s hosting in her apartment.

# totally unrealistic plans, IAP edition

alright I’m feeling the lack of side projects

dec 17-24 pov yoyo

dec 24-31 animation robots doing tricks (in physics) – deepmimic (See getplan.co / 2020 unfinished / quadraped)

jan 1-7 redo inadvisable relationship chatbot with spatialtransformers / gpt3

jan 7-14 finish / deploy app for unconscious bias

jan 14-21 arm throw primitive

jan 21-28 bird/cat ml

jan28-feb 4 oceans openai gym if not complete yet (classes start)

feb4-11 ?? qipao? papersignal svggen? rosie book? make an actually nice inverted pendulum?

couchto5k, codewars, internship applications, stat110

other thoughts: why finish the PhD? my answer: the statistic that minorities earn lower income even with higher degree — to compensate / be taken seriously / take myself seriously and demand better for myself

# Pandemic Diary #71 – reflections on graduate school (20 Nov 2021)

all the ways grad school let me down (or i let myself down?)

• no five years of stability in income and health insurance
(which would have been way worth the pay downgrade to me — if i wanted my life to be so unstable, i could have just done contract work…)
• no traveling and eating on other people’s dime
• no making cool robotics friends around the world
• no being excited about teaching undergrads and inspiring them about robotics and making sure none of them fall through the cracks

good things to come of the last 5 years

• i’m no longer scared of equations, and i can understand why the precision is needed. bring on the set notation
• i learned what proofs are
• i got an A in a serious grad class & finished a cool controls project, no one can take that away from me
• i published a first-author paper! for a long time felt like it’d never happen. so, professors can’t just dismiss me outright
• i got a robot arm to throw a knife
• i met and talked to so many cool people ! so many people’s doors are open to me if only i have it in me to ask
• i got to present a paper, and people told me the presentation was really good 🙂

it’s weird that now as a “senior” grad student, in grad school i almost entirely hang out with people younger than me (and way more accomplished). i remember when i felt like i was turning a new leaf and maybe there was a chance to do well for myself

and all the while i’ve yet to review any papers etc.

if i was here two years ago – before the pandemic feels like it took over 1/3 of my grad time — i would be pretty excited actually to start this field (ai for social good). now i just feel in a rush to leave… but that leads to poor work. (i’ve never felt like i’ve had the time and stability to do good work, to really show what i’m capable of — but isn’t that true for everyone). in some sense i could still aim high, i know at least one person who published just one paper in five years, it was a really good paper and went on to postdoc at a good school. but i feel so tired

things i want to do within the next 1 year:

• newport bermuda or newport halifax races — do long ocean passages & learn safety at sea. maybe an all-female BVI or Mediterranean charter
• pass my quals, graduate ! (just make something up when profs ask you how this fits into overall field, like you did for your fellowships!)
• publish two first-author papers in AI for social good
• finish at least 4 of my side projects

next 2 years

• get a nice cushy job that isn’t too stressful
• make it to six figures in nominal savings (three fund portfolio) (i estimate this should be a year of industry-competitive salary) or live abroad for 3 months
• sail across the atlantic ocean
• idk do the life thing

i was just sitting on the floor of the cave resting due to my ankle and it walked up to me and started kneading my dress. could’ve sat there and enjoyed the view for hours. pretty grateful to semi-stranger (met at conference) for totally unplanned touristing, this cat will probably be the highlight of my trip. i feel accepted and appreciated now

# Pandemic Diary #70 – solo injured travel internationally T^T (20 Nov 2021)

so i sorta set my mind for a workcation / solo travel / living abroad

then two days in i sprained my ankle T__T first time spraining it. at least it’s not such a bad sprain, i can put weight on it without hurting. my foot is definitely swollen though even now three days later

this caused a strange set of events, like getting pushed on a luggage trolley by a world renowned robotics prof in order to catch the tour ferry, getting piggy back rides from people i met three days ago, and getting accosted by like every other person on the street asking if i need help

i’m not certain if i’m overplaying it, i move like snail speed right now. i think i can probably trust my foot more but i’m scared to since i remember that pain

hopping around and also hobbling around on a cane is so much effort

mostly i’m a bit sad i can’t do work and then take a walk around the seaside ! and i’ve been so exhausted just from every day things that i haven’t been able to get much work done 🙁 🙁 🙁 🙁 and motivation is low when sitting is tiring since i’m trying to keep my foot elevated, and the chair at the airbnb is totally the wrong height.

still, so far so good in terms of travelling logistics. smartphones and the internet make it sooo easy. i set up google fi (which did require chatting with the agent once in malta to fix my connection issues T__T) and so i could comfortably book airbnbs, and also scooter and cab rides through my phone (they required text verification so another +1 for google fi, free texting)

Malta is surprisingly like LA, 90% the signs are all in english, and almost everyone I’ve encountered also speaks almost perfect english

ths ankle sprain really drove home how much simpler in some ways it is to travel as a two-person group. of course there’s more possibilities of drama esp. if not on the same wavelength, and logistically can be time-consuming to agree on schedules etc. But it would have been really nice to have someone be able to handle luggage and get groceries and things. Still, everyone i’ve met has been so nice…

I feel quite silly babying my ankle so much, and attracting so much attention, when it doesn’t even really hurt most of the time. (more like growing pains than anything acute). but also like i really want it to heal in two weeks and not two months. and, since i got the injury from rushing (legit some stranger on the street told me to take it easy, and i was like eh i’m okay… SUCH KARMA), i figure it’s not a bad idea to take it slow.

compression socks are so expensive bought in a random pharmacies! and also they have sizes >__>; a pharmacist was insistent i was size small, later i measured, def. medium, and probably not good to over-compress my foot lol. and, people here don’t say canes, they say “walking stick”. the first pharmacy didn’t have one and suggested i look in a tourist shop for a wooden one LOL fortunately the one two doors down had a cane

at first being injured made me feel quite far from home and a little lonely even. still, overall i am feeling pretty okay

i have been sleeping a lot. this new room is on the 5th floor but the sun is filtered through a canopy and a terrace so it feels a bit like a basement room.

i guess that i still feel quite weird about international travel, so no pics for now, except for this cat which appeared at the conference

ok just kidding, here are some more pics. halloumi dog — delicious fried cheese

i went grocery shopping while hungry — everything is in english o.o these are quite tasty — a lot less sweet than i’d expect in america, which i really like

accessibility tools: on-demand car services and scooters, via smartphone app

(i paid a sweet $70 for a google fi unlimited plan because I didn’t want to mess around with missing work, and i dislike the mental energy consumed by rationing data. it’s been great for using the scooter, rideshare, whatsapp etc. apps) i got copies of the book our paper is in! i’m putting them to good use as a laptop stand on the desktop you can see my timezone reminders — in the bottom right, I used shell clock, which replaces clock with output of a shell command. also google calendar allows you to have two time zones, so i screenshotted and annotated that with the 9-5pm of my work mates. see https://extensions.gnome.org/extension/1507/shell-clock/ where a comment has the command for timezones, and https://github.com/murat-cileli/gnome-shell-extension-shell-clock . one-click browser install, so handly. then go to gnome-tweaks and extension settings. i used “””bash -c “echo$(date +’%b %d %H:%M’) $$EST (TZ=America/New_York date +’%H:%M’)$$”””

(the codes are at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)

anyway

it was so good to hang out with roboticists, i don’t feel like i got to know them that well. i wish that i could go again but i doubt that i’d ever have the spare cash to just throw $1k at a conference registration without including the travel and accomodation fees (this time around it was covered by NSF). it felt really awkward to hang out with people talking about$150 per diem meals and \$3k flights while i had paid my way on the cheapest flights i found and staying in airbnbs. but my roommate put a positive spin on it that it was neat that i yeeted myself into another country for a few weeks.

also a bit strange to remember when i was so enthusiastic about this new world of academia i was discovering, and excited to contribute to society and talk about cool things with cool people

hopefully this resolves some of my urge to live abroad? (probably i just made it worse, i was expecting to have much more difficulty getting around — in some ways montreal felt a bit more foreign as there the signs are also in french o.o). and even more hopefully i get enough work done to feel confident about taking my qualifier exams. (it was interesting hearing about how all the different phd systems are set up in different countries ! i guess that’s how people end up applying to postdocs in other countries). then i’d consider it a good trip and good monetary investment (?) regardless of how much i get to trave/not travel (due to my sprained ankle)

the afternoons and evenings of the conference were guided tours of malta, so i did at least get to see the main tourist sites and the different scenic views of malta 🙂 and now, time to work