Thursday, 31 October 2019

Drinks display stand

This is another small part of a larger modular project.

The aim is to create a display for drinks bottles and miniatures, which will present them nicely, while at the same time securing them to protect against small amounts of movement. i.e. I'm not expecting them to be secured if the whole stand is tipped over, but they must be able to tolerate the stand being wobbled side-to-side without the bottles clinking or falling over.

There is also the need to balance the trade-off between the display aspect of the unit, and the amount of storage it provides.

After iterating over a number of designs I settled on the idea of having a central area which would display a number of larger bottles, with a frame/shelf element around the back and side edges to hold miniatures (the front would need to be left open to allow access to the bottles).







The base

The base is simple plywood, with foam to support the larger bottles. The foam is spray-glued to the plywood, with cut-outs to place the bottles, and is wrapped in fabric - also spray-glued and stapled.

The frame

The frame is oak, attached through the bottom of the plywood, and supported by the miniatures shelves and the top frame, which is mitred, and screwed to the uprights with dowels to cover the screw holes. The sides are left open, but the back is enclosed with iroko (there is a logic to this that will become apparent later). The mixture of woods creates a nice colour contrast and adds additional support. 
 

The miniatures shelves

The basic idea behind the miniature shelf is to use a forstner bit to cut out grooves for the bottles to stand in. But this alone raises a couple of problems
  • If they're just sat in holes, it won't be possible to see the labels and know easily what they are.
  • There's no definitive standard size/shape of the bottles.
The latter question has an easy answer, just pick the smallest forstner bit that covers the most bottles that I have to hand - this turned out to be 41mm.

The solution to the first point is to cut the groove off centre, so that it has an open front, allowing the label to be seen, but again, this raises the next question - if the groove is open-fronted, then what's to stop the bottle just falling out?

I'd already planned to line the bottle slots with leather to prevent rattling. By over-sizing the corners of the leather (see below illustration), the leather also acts like a clip to hold the bottles in place, with a sturdy leather disc glued in the bottom to provide extra support.




The finished display
 


Wednesday, 9 October 2019

Repair Cafe

I recently started volunteering at a local 'repair cafe'. It’s a community environmental initiative where people in the local community can bring in small broken consumer electronics, and the volunteers will see if it can be repaired, at no charge, in order to keep items out of the waste stream.

If items can’t be fixed on site, advice is given whether it’s worth repairing, and if so what parts, etc. might be required. If they can be fixed, they’re tested to ensure they’re safe, and weighed so that the organisation can monitor the amount of material kept from landfill.

The other volunteers have a wealth of experience in a number of technical and scientific fields, so I also see it as an opportunity to learn and improve my skill set.

I’m also going to keep a record of the repairs I do, and document them here in the hope that it provides a DIY reference for others who may need similar fixes but aren’t able to access a repair cafe in their area.

So, these are the repairs I was faced with on my first day:
  • An automatic cat feeder – a simple mechanical clock device turning cogs which in turn allowed a lid on a good tray to open after the set time. The mechanism was reported as being slow. Observation of the device over a couple of minutes didn’t really show any sign of being off, and a test over half hour showed some drift – about an extra minute. The device was far from being a precision instrument though, so suggested that they observe the amount of drift over the time period they’re after and adjust the time they set accordingly.
  • An electrical beard trimmer. The mains wire was disconnected. Soldered in place and fixed.
  • A DAB digital radio, on which the LCD display wasn’t functioning. Managed to disassemble and retrieve the faulty part, so that a replacement could be found.
  • A toaster. The lever to push the toast down was stiff. This seemed to be a design flaw in the toaster, where the lever being pushed down would effectively pivot on the rail where it’s mounted, causing it to bind.

    There wasn’t much that could be done to repair it, but was able to advise the user how to workaround it by keeping the lever flat whilst it was being pushed.












  • A halogen cooking lamp thing. The timer and the fan would run, but the halogen lamp wouldn’t turn on. Testing showed no power to the halogen connector.
    Tracing the problem back showed that a potentiometer device (pictured) which set the halogens temperature had broken part.

    Advised the user of the broken part so they can try and get a spare from the manufacturer to attempt a repair next time.





    Scorecard
    Score
    Wins1
    Draws
    (Workarounds and partial fixes)
    2
    Needs parts2

Sunday, 1 September 2019

Empty roll warning buzzer

This was a commissioned project that went nowhere, but could easily be re-purposed for many different use cases, so I thought I'd share it.

The aim is to create a range finder device that can be mounted and aimed at a roll of material on an assembly line, so that the range finder can be used to determine the amount of material left on the roll, and sound a buzzer when the supply falls below a set amount, informing the machines operator so that they can replace the roll and minimize downtime.

The sensor is a Sharp GP2Y0A21YK0F. The datasheet shows that the voltage drops as the distance increases. In our particular use case, this means that as the material runs out, the voltage will drop, so we want to flag a warning below a set voltage.

Initially I thought about using a low battery circuit similar to the one I modified to use in the Keyboard Pedal project. However, I later realised that would be over-complicating it, and that the same result can be achieved using a simple comparator circuit.

The chip used is the LM358 op-amp, and the circuit is similar to the one found on page 6 of this PDF.

The key differences being:
  • The voltage provided by the resistor and zener diode in their diagram is replaced by a potentiometer in mine, so that the 'trigger' value can be adjusted.
  • The potentiometer in their diagram is replaced by the IR sensor in mine.
  • The resistor and LED output in theirs, replaced by a buzzer.
  • The voltage of my circuit is 5V so it can run off a USB charger.
With all those changes taken into account, the resulting circuit looks like this.

Note that RV2 is the IR distance sensor - I didn't have the symbol for it in KiCad so used a potentiometer symbol as that's essentially the behaviour it exhibits.

The finished circuit, fit neatly into it's enclosure.

The case

The circuit needed to be neatly enclosed for it's purpose. Often for electronics projects I'll end up re-purposing existing containers and boxes as enclosures, but as it was a commissioned project something more professional was in order.
The whole enclosure is 3D printed, based off a simple lidded box design with cut outs for controls and the IR sensor itself.

I also took the opportunity to turn the box into a simple parametric template so I can recycle it for other projects. the SCAD source code can be found on GitHub.

All that's needed is to supply the internal dimensions that are required and it'll create a thin-walled box meeting those criteria, using only stock OpenSCAD commands - no other modules required.

The lid fits snug - on my (admittedly by this point quite old) 3D printer, a nice unintended side effect of the rough resolution is that the ridges create a nice friction fit, allowing the box to be closed tight, but also popped back open with relative ease should maintenance be required.

The controls and buzzer

The sensor - the glue-filled part was to allow flexibility in angling the sensor, but was later found to be not required


The test

As I didn't have access to the factory where this was intended to be used, I whipped up a quick test rig using kitchen roll as the stunt double for the actual material.



The short buzzing before the alarm fully triggers is driven by the 'wobble' of the roll on the holder. In production use the material rolls are much more securely held, and so this effect would be minimised.

Saturday, 3 August 2019

Powerful car jack linear actuator

Creating a powerful linear actuator by attaching a car jack to a motor is nothing new, but a lot of the demonstrations that I've seen neglect the fact that the point where the motor needs to mount to the jack (at the end of the threaded rod), will have movement both vertically and horizontally towards/from the middle of the jack. This makes it difficult to mount the motor in a fixed position.


So while this isn't a project in itself - it's a small part of a bigger project I'm currently working on, I thought I'd share my solution to this problem in case it is of use other others attempting something similar.


I found the best method is to focus on mounting the motor in relation to the threaded rod, rather than the jack, or the other frame/other parts of the project, as this is the only bit where the position remains relative.

The frame supporting the motor in line with the jack
(Jack body not illustrated)
This frame (yellow) goes around the middle of the jack, and hooks at the end over the threaded rod (green).

At the other end, the motor (red) is attached to the rod in order to turn it and mounted securely to the frame, allowing it to move with the rise and fall of the jack.


The downside to this mechanism is that the torque of the motor will cause the whole frame to rotate. This can be overcome by building the frame as close to the jack body as possible, to minimise the amount of rotation.


In addition, springs are mounted from the underside of the elevated surface to the frame, to add additional support and reduce vibration.

Electronically, the motor is driven by a H-bridge controller. Reed switches are mounted to the base - one on the base itself, another positioned in an elevated position to line up with the frame at it's highest point. Corresponding magnets are mounted on the frame, which line up with the reed switches to create a high level limit and low limit.

Control is currently provided by an Arduino with a single button input - each button press will either raise or lower the platform.

Code is below:

#define R_EN 13
#define L_EN 12
#define R_PWM 11
#define L_PWM 10

#define MAIN_SWITCH 4
#define LIMIT_LOW 7
#define LIMIT_HIGH 8


void setup() {
  pinMode(R_EN, OUTPUT);
  pinMode(L_EN, OUTPUT);
  digitalWrite(R_EN, HIGH);
  digitalWrite(L_EN, HIGH);

  pinMode(MAIN_SWITCH, INPUT);
  pinMode(LIMIT_LOW, INPUT);
  pinMode(LIMIT_HIGH, INPUT);


}

void loop() {
  if (digitalRead(MAIN_SWITCH)==HIGH) {
    runProcess();
    
  } 

}
void runProcess() {
  if (digitalRead(LIMIT_LOW) == HIGH) {
    while (digitalRead(LIMIT_HIGH) != HIGH) {
      lift();
    }
    freeze();
    return;
  }
  if (digitalRead(LIMIT_HIGH) == HIGH) {
    while (digitalRead(LIMIT_LOW) != HIGH) {
      lower();
    }
    freeze();
    return;
  }
}
void freeze() {
  analogWrite(L_PWM,0);
  analogWrite(R_PWM,0);
}
void lower() {
  if (digitalRead(LIMIT_LOW) == HIGH) {
    freeze();
  } else {
    analogWrite(R_PWM,0);
    analogWrite(L_PWM,255);
  }
}
void lift() {
  if (digitalRead(LIMIT_HIGH) == HIGH) {
    freeze();
  } else {
    analogWrite(L_PWM,0);
    analogWrite(R_PWM,255);
  }
}


Demo Video 

Friday, 28 June 2019

Leather-bound notebook

Following on from the pen and pencil projects I figured I'd continue on with the stationery theme.

Like most people who've ever taken notes, I have a lot of half-used notebooks gathering dust, leaving a large stockpile of perfectly good paper not getting used simply because it's bound to some other paper that did.

I'd been thinking about trying a book-binding type project anyway, so figured why not save a few steps and do some up-cycling in the process.

The candidate books are some school-exercise-book style notebooks.

These are great candidates because they are only bound by 2 staples and each book is a single stack of folded paper.

There's a detailed Instructable for this, which I used heavily for this project, so rather than reinvent the wheel, I'm only going to detail the areas where my process differed from theirs.

To start with, I removed the covers from 4 of the blue books.

To get the fabric for the binding, an old t-shirt was sacrificed.

I oversized the measurements for this bit, so that I could pin the fabric to a scrap backing board, to hold it taut while I mounted the folios.


I put clips each end of the stack of paper, painted some PVA glue onto the fabric, and then added the spines of the paper. Doing it this way around prevents the glue leaking between the pages and fixing them together.



The resulting object was surprisingly stable enough to move somewhere safe to dry.


In the meantime I started preparing the cover as per the instructables instructions. However the leather that I had for the cover was slightly too narrow to have the one inch border that it instructs, but still have enough material to wrap around, so I'd be working with narrower margins.


In addition, in order to be able to fold the leather over to create a neat edge, it needs to be thinned. I did this using a combination of skiving tool and sanding, to thin the material around the border.

After that it was just a case of following the rest of the instructable. For the lining paper I used some of the card I had left over from the Picture Frame that I did a while back.

To finish it off I added some brass corners, and that was it. Not perfect by any means, but very happy with it as a first attempt.

Saturday, 1 June 2019

Mechanical Pencil

About a year ago, at Makers Central, I did a wood-turning tutorial and made my first pen.

Since then, I've added a mini-lathe to the workshop (purely because I lack the room for a full size one).

Just before heading back to Makers Central this year I thought it'd be good to have another go and see my progress.

Being me, I'm not really a fan of just constructing kits, and I always like to try and incorporate elements of upcycling and reclaiming into my projects.
 

I've had this ballpoint and mechanical pencil set for as long as I can remember - it's old to the point where you can see how faded the plastic has become. So there's the upcycling bit of the project sorted, this time I'm going to make a mechanical pencil to re-house the innards of this one.


The pencil is walnut and chrome - I wanted to try and keep the same shape as the pen I made last year, but use contrasting colours to the maple and brass that I used last time.
The metal bits came from a clicky pen kit, but were a good enough fit to work with the pencil mechanism.

So there we go. Making pens is enjoyable, but doesn't make much of a project, and I generally don't make more than one of the same item, so I don't see myself becoming a full-time pen turner any time soon, but I do have some variations of the theme that I might pursue.

Friday, 10 May 2019

Pen Plotter Part 2 - Electronics and Software


This is the second part of my pen plotter build - part 1, covering the physical structure of the build, is here.

Printing Hello World!


Electronics and Software 

The stepper motors are driven by EasyDriver controllers which were recycled from an old, abandoned project.

Everything else is pulled together and controlled using an Arduino Duemilamove which provide the G-Code interpretation using the GRBL library.

Because GRBL is designed with 3-axis CNC machines in mind, it requires some alterations to work with the servo pen-plotter mechanism.

Thankfully I'm not the first person in the world to have attempted this, and this instructable provided a good head start on how to do this.

The main takeaways are to download the regular GRBL library, but swap out the spindle_control.c file with the one from the instructable. In that file there are two lines:

#define PEN_SERVO_DOWN 
#define PEN_SERVO_UP

Change the servo values if necessary - after experimenting with changing them, I found that I got the best results setting the down value to 255 and the up value to zero.

Inkscape GCode Conversion
The GCode plugins for Inkscape seem to be included with a standard installation - I didn't have to do anything special for them to appear.

Whatever your source image is (in the video below it was a text object), it needs to be converted to paths.

If you're using objects within Inkscape, such as text, use Path, Object to Path.


If you're starting with a bitmap image then use Path, Trace Bitmap, and use the Edge Detection method.


Post-processing
 
The next step is to run the generated GCode through a post-processor to add the instructions to raise/lower the servo. The post-processor linked in the Instructable didn't work for me, so I ended up making my own - the code is on GitHub.



To run the machine, I use the Universal G-Code Sender.

Troubleshooting

There were a few issues homing the plotter as near the extremities of the carriages travel it would struggle to move smoothly, and would not reach close enough for the limit switches to be triggered, resulting in it stalling. To overcome this I added screws to the structure in such a way that the limit switches would be triggered when stalling began to occur.


The pen holder that I designed in the previous post did work, but there were a few issues with the overly simplistic design:
  • The fact it rotated the marker off the page created 'flick' marks where the pen was raised/lowered.
  • As it was secured entirely on the servo, it had too much flexibility which resulted in it being dragged incorrectly on the page.


To fix this I redesigned the pen mount, factoring in what had already been created so as to make use of what was already created as much as possible.


The new design relies on supporting rails mounted to the existing carriage, which would allow the servo to push the pen mount directly down onto the paper. When lifting the servo returns to its initial position, letting springs added to the rails lift the pen back up.

This new nozzle is on github here.












Wednesday, 3 April 2019

Pen Plotter Part 1 - The Structure

I had two new years resolutions this year - start posting here on a more regular schedule, and to start whittling down the pile of electronic junk that I'd accumulated over the years.

I've obviously failed the first one already, but to aid the second one I've set myself the challenge of using as much of the junk pile into projects as possible.

A pen plotter works kind of like a printer, but allows for any flat material to be printed on, and uses vectors to draw images - like a person drawing by hand, instead of rasters like a traditional printer.

The principle is simple, a basic 2-axis structure with a tool-end that allows for a marker/pen/pencil to be simply placed on or lifted off the paper.

The stepper motors, gears and drive belts, along with the steel structural rods and bushing were taken from a variety of old ink-jet printers and scanners. The limit switches and servo were either just in my components library or salvaged from old projects.

The supporting structure was 3D printed, having been designed in OpenSCAD - the SCAD source code can be found on GitHub. I'm not putting the files on Thingiverse as they're created to fit the random motors that I scavenged, so anyone else using the design would most likely need to alter the dimensions for their own motors.

The chipboard base has been up-cycled from an old flat-pack desk.


The structure
The 4 main components of the first axis
(Rods not 3D printed)


The first axis consists of two end mounts - one being a simple shape to support the ends of the steel bars (a wheel for the pulley was added manually after printing.)
The other end is a larger mount which contains a mounting point to secure the first stepper motor - obviously this was created bespoke to the stepper that I salvaged, but could easily be adapted in the SCAD file.

In the middle are two pieces which will form the carriage for the second axis. - they're similar to the first end piece, but also contain mounting points to secure the pulley.

The second axis builds off of the first, fitting between the two runners created as part of the first axis:

The second axis
and how it fits with the first axis carriage.
The two holes are the front are for the steel guide rods. The gap in the middle is a space for the limit switches to be attached to the carriage and the cutaway at the top is for the second axis' motor.
The two runners and this carriage are fixed together by plastic friction welding.


The motor/gear assembly that I'll be using for the second axis lifts the belt over the top of the first axis' rods, so the height of the end piece is made to match. The notch at the top accommodates the spring-loaded tensioner for the belt.

The carriage for the second axis is a simple block which contains the two limit switches for the axis, a servo and a bracket to mount the pulley to.

The carriage on the second axis

The pen holder

The final structural piece is a simple pen holder which connects to the arm of the servo.

A post shared by Anthony (@darkmidnight_diy) on

The next part will cover the electronics and software.

Wednesday, 2 January 2019

Editing game saves with a Hex Editor

If it wasn't for videogames, I'd probably never have got into the career path I have, and a lot of that also comes from my other habit of taking stuff apart to see how it works.

Back in the days of the original Playstation, I had one of these Xplorer cheat cartridges.

This allowed the use of game cheats that weren't necessarily part of the actual game code.

In addition, the cartridge allowed the user to create new codes, by essentially searching for values in an existing game.

My understanding of it is that it effectively was a memory scanner, that would find values in the systems RAM, and allowed values to be rewritten (constantly rewriting the memory location of the health variable to read 100% would effectively be an infinite health cheat, for example).

Similar application shave been released for PC games, but to be honest, they went to involve running unchecked code and tend to have an air of shadiness about them.

Plus they tend to just be a very directed tool for a specific game title, so blinding running one might help you out with a game, but you're not getting anything useful from it.

This project is to demonstrate that similar results can be produced using standard tools, which have uses beyond games, so while cheating at the game won't make you any good at the game, you might instead learn something that is useful in the real world.

Tools
The tool being used is a Hex Editor (wikipedia). I'm using GHex, but the most commonly known editor is WinHex for windows.

Process

There are several approaches that can be taken, there are some who will painstakingly sit and work out the whole format of the file.

While this is probably the most technically sound approach, it's incredibly time consuming and laborious, particularly if you're only looking to change one or two values.

Another approach is to load a game, make a note of some key values in the game you'd like to amend - ammo, health, cash, etc. The more unique the value, then in theory the easier it will be to find in the file.

For this example we're using Saints Row 3, and in particular we're looking at ammo.

Note that there the process does involve a certain amount of trial and error, so for conciseness I'm not going to cover all of the missteps along the way, just what I did right. Of course it goes without saying making backups of the save before editing is worth doing just in case.

These are the ammo balances of the save I'm using:

The first thing to do is to convert some of these values to hexadecimal so that we know what to look for in the hex editor.

So starting with 265 - this converts to 109 in hex, or in the notation used with most hex editors, this will appear as "01 09", so use the find function in the hex editor to look for all instances of that. There are two likely outcomes, either:
  • You'll find multiple instances, so the next step becomes figuring out which one is the one you want to change.
  • You'll find nothing. In which case the endian ordering of the file could be an issue - this refers to the order in which the bytes are used to create the actual number. In layman's terms, you can think of it as reading from left-to-right or right-to-left. Simply reverse the order of the bytes above - e.g. "01 09" becomes "09 01" and search for that. If you continue to find nothing, it could well be there's some additional encoding or perhaps simple encryption on the file. There's ways around that but it's a bit of of scope for this project - I might do a follow up post later dealing with those things.
As it happened, with the pistol ammo amount I lucked out, there was only the one instance.:

The bytes representing the pistol ammo highlighted in red (click to enlarge)

So, let's change these two bytes to FF (the largest 2-character hexadecimal value - like 99 is in decimal), reload the game, and see what happens.

The pistol ammo is now 65535
(which is the decimal equivalent of hex value FFFF)

So, where to go from here? We can repeat the above exercise with the other values to find them, but we can help to deduce the whereabouts by adding some logic to what we already know - in this instance, we're looking for ammo values, we've found one, and we can reason that it's quite likely that these values will be grouped together.

For example, the SMG ammo value (70 00) was found nearby

The 2 values (pistol value in blue, SMG value in red). Click to enlarge.

From there we can deduce further - The pistol value starts at byte 19104. The SMG value starts at 19132 - 28 bytes apart.

So what if we look forward another 28 bytes at 19160? We find "30 00" - decimal value 48, the value of shotgun ammo. And again, another 28 bytes later we get hex "77 00" - decimal 119, the rifle ammo.


The other ammo values. Click to enlarge

So lets test it and change all of those to "FF FF"
So did it work?


Yes.

SR3 save file 'cheat flag'
Although it's not really in the spirit of this post, if you're here to just cheat at this one particular game, there's a byte in the save file that identifies if cheats were used in the game. It's the byte at 0x000000C8. You can play with cheats, then just change this flag to zero and it'll be as if you hadn't.


A final note on using cheats in games
Using cheats in games is obviously a polarising subject. I am very much opposed to using cheats in multiplayer games where doing so will affect the experience of others.
I am also generally opposed to using them in single player games - whether they're keycodes put in deliberately by the games developers or third party tools that you've just downloaded and ran.
In my opinion you should at least do a playthrough 'as the developers intended', however, they can be a good way of extending the re-playability of the game and getting more life out of your purchase afterwards, and by instead using techniques that I've covered in this post, you can learn and practise techniques that can be useful in the real world, and in my opinion the benefits of that outweigh the drawbacks.