We tried social media. It's not very sociable. This is just a corner of the internet where slightly nerdy stuff gets recorded, so we know it once happened.
It does feel very much like we're going back to basics on a lot of things. Like learning to drive stepper motors again using darlington arrays. A few years ago this was bread-and-butter do-it-in-your-sleep kind of stuff. But it's been a while. And lots has been learned. And lots has been forgotten. So we're having to get re-acquainted with the whole driving motors thing all over again.
We're also switching platforms.
For many years, I stuck steadfastly with my PIC microcontrollers. I still maintain they are far superior to the (often more fragile) AVR/ATMega microcontrollers. And when I first joined nerd club, Arduino was still very much in its infancy - and, coming from an industrial electronics background, I much favoured PICs over AVR for pretty much everything.
But the Arduino ecosystem is quite mature now. And lots of people are familiar with it, and its bootloader sequence, and just how easy it is for hobbyists to just buy some very basic equipment and get coding with it. Not so the (rather more specialised) PIC.
So, while I'm not giving up on PICs, for hobby projects and for sharing with others, I'll probably default to Arduino for microcontroller stuff. For you guys ;-)
We're got our closed loop belt system finally built and ready for testing
What we need to do now is make that little motor in the middle spin, and see if it can drive the belt around in a loop....
We're using a 28BYJ-48 stepper motor (they're plentiful and super cheap and can run on anything from 5V up to 12V - the higher voltages giving a little more "welly" and supplying a bit more torque).
Internally, the stepper motor is wired like this:
To get the motor to spin, we need to energise the coils in a specific sequence.
Each coil is connected at the mid point to a permanent, fixed power supply. So to energise coil one, we need to drive the pin connected to the end of coil one to ground. We then need to energise one of the other coils (probably coil 3) and we do this by disconnecting the first pin then driving the pin for coil 3 to ground.
By driving the pin for coil 2 to ground, we basically invert the electro-magnetic pole across the vertical coil, then lastly we drive the last pin to ground to complete the "step sequence".
That's a very basic explanation of how to make the stepper spin. The truth is, there are "inbetween steps". You can make the motor turn a "half-step" by energising two coils together (say one AND three). This will cause the motor to turn half-way between the positions between coil 1 and coil 3.
Because two coils are energised at the same time, this actually provides a little more power to the motor. So we'll make sure to use the half-step approach (energise two coils at once) but only ever power two coils at a time (so getting the speed/performance of full-step sequence, but the power/torque of half-stepping and energising two coils at a time).
To drive the coils to ground, we'll connect each end of the coil to a ULN2803A darlington array.
The common ground is connected to pin 8.
The "freewheeling diode" on pin 9 is to handle any "back-emf" generated by energising then disconnecting coils in the motor. We can connect this to our motor power supply to safely handle any "spikes" in the motor coils.
Now Arduino has a build in stepper motor library, but it's pretty crude and uses "blocking functions". That is to say, you wire everything up, tell the microcontroller how many steps you want it to move the motor by, and the code prevents any further code execution until all the steps have taken place. We basically want to set our motor spinning and keep it spinning until we interrupt it with some kind of input signal.
So we're going to write our own simple stepper motor driver than can be interrupted at any point.
To test our coil sequence, instead of connecting the motor (which requires its own dedicated power supply, because it draws so much current) we'll connect up some LEDs and watch them light up in sequence, to make sure our code is at least triggering the correct outputs in the right sequence.
int coil1_pin = 2;
int coil2_pin = 3;
int coil3_pin = 4;
int coil4_pin = 5;
int start_stop_pin = 10;
int current_step = 1;
int step_direction = 1;
void setup() {
// when a pin is made an output, it defaults to LOW
pinMode(coil1_pin, OUTPUT);
pinMode(coil2_pin, OUTPUT);
pinMode(coil3_pin, OUTPUT);
pinMode(coil4_pin, OUTPUT);
// this is just a test pin; pull low to make the motor spin
pinMode(start_stop_pin, INPUT_PULLUP);
}
void loop() {
// to be useful we'd probably set a flag to say if the motor
// should be running or not; here we'll just read a pin state
int i = digitalRead(start_stop_pin);
if(i == LOW) {
nextStep();
}
}
void disableCoils() {
// remember we're driving a ULN2803A darlington array
// we're not driving to motor directly, so a high
// signal energises the coil (drives the output of the
// array low) - to turn off all coils, all pins should be low
digitalWrite(coil1_pin, LOW);
digitalWrite(coil2_pin, LOW);
digitalWrite(coil3_pin, LOW);
digitalWrite(coil4_pin, LOW);
}
switch(current_step) {
case 1:
digitalWrite(coil4_pin, HIGH);
digitalWrite(coil2_pin, HIGH);
break;
case 2:
digitalWrite(coil2_pin, HIGH);
digitalWrite(coil3_pin, HIGH);
break;
case 3:
digitalWrite(coil3_pin, HIGH);
digitalWrite(coil1_pin, HIGH);
break;
case 4:
digitalWrite(coil1_pin, HIGH);
digitalWrite(coil4_pin, HIGH);
break;
}
// add a delay because if you try to drive
// the stepper motor too quickly it will chatter
// (if testing with LEDs, make this a longer delay)
delay(500);
}
Here's what the flashing LED sequence looks like:
Replacing the LEDs with our stepper motor, and the result (with a modified delay between steps) looks like this:
So we've got our motor spinning, albeit in a very crude way.
But it's a start - now to hook it up to our belt drive and see if we can't get the belt to move around the track....
At times, when we're unable to work on the hardware for our eletronically-enhanced, app-augmented version of Full Tilt, we're still able to make progress on the overall game, creating "digital assets".
The original rules suggesting using playing cards to represent various knightly virtues and jousting ploys. We thought it'd be fun to turn these into dedicated cards for the game (and maybe even add a simple RFID tag to each card, so it could be read by some device, when placed on the playing area.
The templates are super-easy to modify using GIMP and the templates provide for a (small) range of alternative modifications. We went with a pretty simple layout:
A summary of the rules and the "pips number" is all we need on each card. The different card types (ploys, virtues and favours) each have their own coloured back, and a corresponding colour for the card index number.
In the original game, each knight can approach the Royal Box and be awarded "favours". For each favour awarded to your knight, they get one re-roll (so any dice roll the player is not happy with can be re-rolled - the second result must be accepted, even if "worse" than the first).
We felt like we could do a little more with the favours - as well as awarding each knight a number of re-rolls, we created some "virtue cards" - each player draws the number of cards that their knight has been awarded favours.
Favours add a one-time "bonus" for players to play when choosing their ploy. For example, the player might play a favour card which gives them a +1 modifier to their dice roll when trying to hit their opponent. Or they might get +1 to their dice roll. Or they might be able to negate any bonuses claimed by their opponent for that round! (anyone familiar with the "nope" card in Exploding Kittens will appreciate how careful use of this tactic can be devastating!)
The plan is to have a number of RFID readers embedded into the playing surface, and add RFID stickers to each card - as a player places their card (face down) to indicate that it is in play, the reader will be able to determine the card played and send this information to the connected smart device, to apply the appropriate effects to the game.
It's the creation of ancillary things like cards that really bring a game idea to life - it makes it feel less "conceptual" and more like a real "thing" when you have actual, physical items to hold. We've a double-roll office laminator knocking about somewhere, so should be able to use a regular inkjet printer to create the cards.
Now, where did we leave that poker-card hand-punch....?
Ok, we're not sure yet how to even make a length of T2.5 timing belt into a closed loop yet. But when we do, we want the belt to run between a series of fixed bearings, to make a "track" for our miniature 3d printed horses to follow.
As with our previous designs, we're still working out how this is going to work - or even if it will at all! But we're going to need some uprights for the bearings to fit over. It's tempting to just drill some holes, pop an M4 bolt through and fix it in place with an appropriately sized nut.
But that will then add additional height to the bearings - they will effectively stand proud of the baseplate (and we're not sure if we want that just yet). So instead, we're going to cut the holes for them at 3.5mm then use a die tap to thread the holes out to M4 sized
This then allows the bolts to hold themselves locked into the baseplate without the need of fixing them in place with a nut on the other side
So now the bearings can just sit over the bolts and act as guides for the belt. Once we've worked out how to make a closed loop from the timing belt, we'll be able to add in bearings at each corner (note the slotted holes for the corner bearings, to allow us to more them in an out slightly, to add (or remove) tension in the belt, once the loop is complete.
Once the bearings are added to the corners, you should be able to see the path that the horses will take. We'll start with a horse on the track in the bottom left corner of the baseplate, and one in the topright. The stepper motor will rotate anti-clockwise, pulling the two horses towards each other on the track.
As they approach the middle, each will appear to approach the "bar" (the separator running along the middle of a jousting arena). Then, they will run past each other, before moving away from the bar in order to complete their turnaround and prepare for the next pass.
It's all looking quite hopeful at the minute. So long as we can reliably join the two ends of the belt, we should be ok. Then we get to wire everything up and see if it works!
As a fallback option, you can see the Nema17 type stepper motor waiting in the wings (complete with "proper" pulley for precise CNC operation) should it be necessary to use something a bit more "tried and tested". But let's hope it doesn't come to that.....
I've no idea how I didn't see it until it came off the laser cutter. But that first pulley (see previous post) was never going to be suitable to drive a T2.5 belt! The teeth are both enormous and really widely spaced.
So I tried the gear extension in Inkscape (menu - Extensions - Render - Gears - Gear ) to see if my laser cutter was up to the job of creating a pulley (cog) with enough definition to work with a T2.5 timing belt (the pitch between the teeth is just 2.5mm)
I found that 36 teeth with a pitch of 2.5mm created a cog without about the same outer diameter as the previous one, that I based the rest of my designs around. And while it was much better than the original (laser-cut) pulley, it wasn't quite right....
On a straight, linear section, the teeth appear to line up and mesh correctly. But as soon as there's any kind of bend in the belt....
While everything appears to line up at the 12, three, six and nine o'clock positions, it's clear that the tooth pitch doesn't quite match the pitch of the belt. Now, I'm pretty sure that the belt has a pitch of 2.5mm. It's labelled T2.5. It matches exactly the belts on my Tronxy 3d printer, which has a 2.5mm pitch (and has been correctly set up with this as the belt pitch and prints with an accuracy of +/- 0.1mm
So I tried a few different laser-cut pulleys - one with 38 teeth, with a pitch of 2.4mm, one with 40 teeth and a pitch of 2.3mm and one with 42 teeth and a pitch of 2.2mm. The first pulley was a better fit, but still not quite right....
With an increased number of teeth, with a smaller pitch (distance between them) the different pulleys all had roughly the same outer diameter. Next up, 40 teeth with a pitch of 2.3mm
The teeth and belt lined up pretty much perfectly! Just to be sure that this is the one we wanted to go with, I thought I'd at least try the next pulley down, with 42 teeth and a 2.2mm pitch:
It's pretty close. But not a better fit that the previous one. So it looks like the best fit is a pulley with 40 teeth and a 2.3mm pitch for our T2.5 timing belt. Seems a bit weird. Either the laser cutter is over/under shooting (tbh, it's been a while since it was last calibrated, so it might actually be cutting slightly too large/small) or the larger diameter means we need a tighter tooth pitch (usually the pulleys on a stepper motor have just 10-16 teeth in a much smaller radius).
But, for whatever reason, through trial and error we've managed to create a laser-cut pulley that matches our timing belt. That's good enough for now!
But it's a stepper motor with a closed loop belt running across both the top and the bottom of a connected pulley (created using the online gear designer at https://geargenerator.com/ )
Those little round things are miniature bearings (4mm inner diameter, 12mm outer diameter) and threading the belt around them will not only add a little bit of tension to stop the belt "flopping about" but also - almost be accident - means that as the miniatures "connected to it" above come towards each other in the middle, just at the most critical point of contact in the joust, they'll actually move closer to each other, as if attempting a strike.
After passing each other in the middle of the arena, the characters will then move away from the centre bar, as they prepare to turn around at each end (the tournee that gives rise to the word tournament ).
So the first task will be to create this set-up and see if we can get the belt moving freely using just a single stepper motor and pulley. Time to dust off the old laser cutter and get making cool stuff again!
Ok, let's go into this softly, softly. It's been a while. And some of us have slept since the last incarnation of the Nerd Club blog and we've forgotten an awful lot. But something that immediately springs to mind for a game that involves bringing two horse-mounted characters into the centre of a battle arena is stepper motors and timing belts. But unlike make "bed slinging" 3d printers or other CNC-based machinery, we're going to need a "closed loop" timing belt.
What if we had a complete loop of toothed belt under our jousting arena? And attached to it were to magnets at opposite sides of the loop? And placed above it, two horse-mounted characters with magnets in the based, pulled along as the belt rotates under the jousting arena?
That sounds like a pretty cool starting point for an animated diorama, let alone a tabletop game with built-in automation!
Many years ago we successfully used some cheap 28BYJ stepper motors and some ULN2803A darlington arrays without the need for rather more expensive Nema-type steppers and associated driver boards. So before we take this project any further, we're going to see if we can get a closed loop timing belt spinning around some fixed points.
We may yet replace the two steppers with a single drive point and make use of some miniature bearings like these from Amazon:
But before we get too carried away with laser-cutting terrain and making complicated enclosures, let's ease ourselves back into this nice and gently - by making a stepper motor spin, with a home-made pulley that can make a length of T2.5 timing belt rotate between two fixed points....
I've currently five or six half-baked projects on the go. Some fairly recent (like my Head over Heels tabletop remake) some have been hanging around for literally years (did that electronic gaming platform ever get finished? Well, enough to play some games over the 'net but not evolved into a full gaming platform as once planned).
As it's been a while since I've got the old soldering iron out, I figured this would be a great little project to see through to completion as the first project for this (new) blog. From start to finish. It will have everything - electronics, motors, magnetised playing pieces, tracking, a natty little bluetooth integrated app and RFID action cards, as well as cool looking miniatures and lots of customisation and personalisation options.
But should be "small enough" to serve as a project to cover all this from end-to-end.
A number of years ago I bought a resin 3d printer. I'm still not a massive fan of the FDM variety of 3d printers. Though that might be because I still have a relatively crude, early model XY affair and getting the initial layers printing consistently well feels like a full-time hobby in itself.
But resin printing is a whole other story. Yes, you've got to support and check and fix your build plate. But then you send it to the printer, hit "go" and after about 3 hours, you've a plateful (anywhere between eight and ten) brand-new, awesome miniatures for your chosen tabletop game.
Over the years, I've amassed a huge collection of STL files for printing tabletop miniatures. And every now and again, just print a few for the sake of keeping the printer from "seizing up" (or whatever other reason these things go wrong if left unused for any great length of time).
My first resin printer was an Anycubic Photon (which I loved) but a few years ago, I picked up a Mono 4K. It's an amazing little machine - cheap as chips and super-reliable.
So now I've quite a collection of little grey models. And since slap-chop and speed paints became "a thing" a while ago, sometimes I'll paint a few minis up for no other reason than to have some quality "down time" away from the computer screen.
Maybe fewer in number. And certainly older (though probably not much wiser) than before. And maybe with a few different hobbies and interests.
But it's time to get off unsociable, social media, stop trying to cram everything into 140 characters and actually share some useful, meaningful content again.
Some things on here you might recognise from long, long ago. Some stuff might be quite new to you (and us). But it's time the Nerd Club cool kids got back online. In an old-is-new kind of way.