Blog


OS Development

I’m working on a hobby OS to keep my C skills sharp, I’ll document stuff about it here when I remember

Progress

So far, I have a bootable kernel, with ISRs, IRQs, working, no memory manager yet, and no multitasking!

Grub on my bootable ISO

Grub on my bootable ISO




Useful LaTeX

Some snippets of LaTeX that I have used at some point or another, and may be useful to anyone else.

Package: hyperref

Simply including this package will make your table of contents have clickable links to pages in the document.

Package: todonotes

This package was an absolute life saver during my dissertation.

It provides the use of todo{} tags, which place a marker on the page with a virtual ‘sticky note’ showing your to-do item text, and also provides a listoftodos command, which creates a list of all your to-do notes.

Furthermore, with the hyperref package included in your document, the to-do item list will have links to their respective pages!

usepackage{todonotes}

% ========================= %
% ==== REMOVE ON FINAL ==== %
listoftodos
pagebreak
% ==== REMOVE ON FINAL ==== %
% ========================= %

Text text, texty text…
todo{This is a to-do note!}%
Stuff stuffs… list of stuff.

todo{This is another one!}%

Shorter List Style

The default list style in latex I found to be excessively spacious, and in any list heavy sections, the page numbers started to rack up!

To remedy this, I defined a new environment for a thinner list style

% This makes list spacing much better.
%
newenvironment{thinlist}{
begin{itemize
}
setlength{itemsep}{1pt}
setlength{parskip}{0pt}
setlength{parsep}{0pt}
}{
end{itemize
}
}

begin{thinlist}
item Item one
item Item two
item …
item Further items
end{thinlist}

Package: makerobust

During the course of writing my dissertation, I came across the problem of not being able to put url{} commands inside a footnote{} command, this is due to the way latex handles URLs, as the command is not considered to be ‘robust’.

Long story short, I searched around, and found the ‘makerobust’ package, which wraps non-robust commands in a robust frame, making them robust, as can be seen in the snippet below

usepackage{makerobust}

% Make the damn url command work in caption’s
%
MakeRobustCommandurl

Package: listings

I’m a computer scientist, so having code listings in a document is par for the course. To support this, I used the ‘listings’ package to nicely format my code.

usepackage{listings}

% Magic listing style!
%
lstset{basicstyle=tiny, tabsize=1, numbers=left}

The lstset{} command in the snippet above sets the basic style for code listings – I had a few large sections of code to include, so I set the font to tiny and a tab size of 1 space. You may wish to edit this to suit.

The full manual for the package can be found here: ctan.org’s copy of the listings manual

Package: pdflscape, pdfpages

My gantt charts for the dissertation were generated from Microsoft Project (The best I could get at the time! No hate mail plase!) in PDF format, so to include them in the Appendix, I used pdflscape.

This is nothing particularly spectacular, but I’m putting it here in case someone else stumbles upon it.

usepackage{pdfpages}
usepackage{pdflscape}

begin{landscape}
includepdf[pages={1,2},landscape=true]{gantt/gantt_chart.pdf}
end{landscape}

Note that you can include specific pages with the optional ‘pages’ argument.




SCMES Track Signals – Track Sensors

My intention is to use reed switches for the track sensors, as they fit the needs of ‘non contact’ and ‘cheap’ (ish).

This method only requires a magnet to be fitted to the riding trucks, leaving them electronics (and complication) free. Furthermore, should a guest driver wish to use the track, they can either use one of the club riding trucks, or simply attach a magnet to their own in the appropriate place.

The innards of a riding truck

The riding trucks have this central bracing, providing a nice mount point for our magnets on the underside!

On the subject of the club riding trucks, and the ‘appropriate place’ – mounting the magnets on the trucks should be fairly simple, as they are constructed mainly from mild steel (and thus, magnetic!) so magnets can be stuck anywhere flat on the underside of the truck giving great freedom with regards to fine tuning.

The track sensors themselves will be simple reed switches arranged in parallel such that any switch action will cause an input on the microcontroller to be pulled low.

These ‘sensor bars’ are to be mounted on the inside of the outermost rail (The left-most rail in the image here) as this is where the origonal sensors (microswitches) were mounted by means of bolts through said rail, thus we can re-use the mountings as they were left.

I’m going to write another post covering the design of the `sensor bar’s once I have drawn up the schematics.




SCMES Track Signals

I’m currently designing and building an electronic signalling system for the South Cheshire Model Engineering Society.

A view across the track site

The Track Site

This consists of a set of 10, 3 aspect (red, amber and green) signals to control and 10 track sensors (the nature of which is to be determined) as well as 3 other special-case sensors (two on traverser locking mechanisms, and one station master switch).

The original system was based around a control unit which worked on digital relays and used 36V lamps.
Unfortunately the designer was involved in a car accident and died, leaving the system unfinished, and futhermore, the method of detecting a locomotive passing a signal (microswitches on plates in the track) resulted a far-too-short pulse length to actually trigger the relays.

This left the system in an unfinished state for several years, during which I finished my degree, and now I have time to work on the project.

A development signal's internals

The three high-brightness LEDs inside the head of a signal

The first order of business would be to determine what the control unit is required to drive, in this case high brightness LEDs are used for each aspect, and, although my development unit had a dead red LED, the LEDs could easily be powered by a simple 6v source (in my case, AAA batteries, as can be seen in the larger image).

The LEDs are more than bright enough to be seen far away, so will be acceptable as lamp replacements.

A signal showing all lights on, except red is broken

They're bright (shot taken from an angle to see anything at all!) except for red, in this case!




WordPress

So I finally gave up on writing my own site by hand all the damn time, as I’m a combination of ‘too busy’ and ‘too bored’ to mess with it any more.

I’ll be moving the content from my older website (http://www.themoggie.co.uk) and the site that was here into this format whenever I get time, so expect a sporadic increase in pages/posts.

Until then, adieu.