I’ve kind of been meaning to put up another post about my third year project for a while now, however, I’ve kind of been a little too tied up with actually making it work to write anything much about it. Anyhow, an update on where things are with it:
Well, it’s moved several times. I think it was even kind of moving on the last post, but it’s moving properly now, in that I can give it a position to move to, and it’ll move there relatively reliably, with niceties like acceleration and deceleration curves smoothing out the motion; driving it off an Arduino & DRV8825 driver at the minute. I’ve gone through I think four different ways of shifting it around so far; I loose track. Started off with just a basic bash-about of the blink demo to test that it worked, which it did, but was far too slow to be useful. Second technique was a mashed-about version of this tone library; initially added a few functions to allow monitoring of the pulse count, then read and tweaked the frequency based on that, but that was ridiculously inaccurate, and I found that the duration bit just multiplied up and counted the pulses, so just re-used that to send out a fixed amount of pulses. It could rev the stepper up at a decent lick, but lacked accuracy, so I ditched that, and, annoyingly, found the accelStepper library; it’s a pretty easy, smooth and accurate setup, but just too slow; It was quick enough at full stepping, but too noisy at low speeds, and any microstepping level high enough to keep it quiet and smooth left it taking approximately three and a half months to traverse the length of the “neck”. It’d have been fine if I had more horsepower to throw at it, but I want to keep things fairly cheap on these slave strings, and simply don’t have the time to figure out swapping platform at the minute; I did have a play around with using the MSP430 launchpad, but couldn’t get I2C working properly. might look back there if I have time later on, but time is somewhat of a limited resource at the minute. I did try to figure out how to switch microstepping modes on fly to ease the processor usage, but couldn’t get that integrated in with the position handling in the accelStepper library, so that went out the window, too.
So, the third, and current, method is a bit more custom; still pretty basic, but it seems to work OK. I’m using one of the hardware timer to call a function to toggle the step pin, and judging acceleration etc. using a lookup table. Had to use port manipulation to get the speed out of it, but it seems to clock OK (think I’m getting about a 50khz maximum out of it, and it’s enough to overrun the top speed of the motor). I’ll probably have a poke about with switching the microstepping based on current velocity in a bit; the functions needed are largely there, I just haven’t hooked it all up. need to up the number of values in the lookup table for the acceleration/deceleration soon, too; at the minute it’s working of 10 values calculated via the very precise technique of blind guesswork, so I’ll have to break out my maths knowledge and clean off the rust to figure out a curve function; it’s based on distance rather than time, which confuses things a touch, too; might have to change that, as it leaves it notchy where it needs to be smooth. ramping up the number of entries should hide it OK, though.
It shows stuff!
Reckoning on probably running a pi zero w as the master processor for this; I kind of want USB host/device, networking (for OSC connectivity) and sd storage (for preset handling etc.), and the zero W was the cheapest board that had that sort of capability, so I picked one up. Embedded linux isn’t ideal for this sort of job, but it does have some advantages, like easy handling of midi devices, easy storage management etc. Downside of this way of working is that my python knowledge is barely existent, but I guess I should learn it sometime. So, anyhow, I’ve got that talking now, taking input from a USB midi keyboard using pygame and spitting it out to an SSD1306 i2c OLED, which is standing in for the modules for the minute. It’s not ideal, but seems to kind to work.
It makes noises!
Well, sort of. if you want more than just stepper noise, you kind of have to find a violin bow, and an arm to move it around; helpfully, since I’ve headed back home for a short while over Easter, I was able to steal both from my dad:
It’s just running a preset sequence of positions here; any similarity to actual note intervals, living or dead, is purely coincidental, as the values were yet again generated using blind guesswork.
Anyhow, in other news;
- Biomedical engineering; I’ve been swearing at an IMU. The accelerometer stopped working; it started working again when I gave it a whack (it’s easy to forget that they are mechanical devices) but I don’t really trust it, or the readings I’m pulling from it, so I’ll have to try and find something else I think
- The endless march of time and entropy continues; I’ve officially become 21 now, meaning that I can legally get a pilot’s licence, fly to to America, and get drunk. Oh, and apparently I could adopt a child. I doubt my student loan would stretch to doing either, though.
- Robot wars has been nominated for a Riley; It got nominated for best event in the union awards thingies at the university. So that’s cool.
- I took some photos; I got bored of work, so went to the park and took some photos till my camera went flat, which took about 13 seconds, since some moron forgot to charge it beforehand, or take any spare batteries. I then took photos with my phone, till that went flat too. As a photo-taking trip, I really didn’t think it out very well. there’s been a few other photography sessions since last post, too, I think; not sure. Anyhow, I’ve put the pick of the crop on flickr here; need to get into the habit of uploading more stuff there. And here; generally not all that great at this whole content generation thing.
- Things happened; I’m, like, fairly sure of this, although I can’t really remember all of what the things were, or if any of them were thing-ish enough to warrant mention here. Judging by the fact I can’t remember what they were, they probably weren’t, but if I remember any that were, I’ll probably edit this post and add them on.