The DCC Controller – Part 1 and 2.

So, the PCBs came. Only after I’d unpacked it to have a peek did I realise the sheer mountain I had to climb. Well, perhaps mountain is the wrong word, because mountains are big. The main microcontroller is tiny. It’s a quad flatpack, 100 pins, 25 a side, on a 0.5mm pitch. That’s tiny when soldering by hand!. I tried a tactic I learned as a student engineer at Seprol. Which basically boils down to coat everything in sight with solder, then wick off the excess with braid, and then gently touch each pin in turn to melt what’s left and ensure a proper bond. After I’d done all 100 pins, I left it for a while. A few nights later, I did all the support components, including the voltage monitor / supervisor, power supply, crystal and RS232 port. So far so good, and special thanks to Gill and Keith for letting me borrow a super duper magnifier to check out the QFP.

With that much soldering done, I decided it was time for a test run, so I hooked up the power supply, and connected it to my PC, and loaded the flash programmer. I was absolutely heartbroken when it didn’t connect, then realised I hadn’t set the PC serial port up in Memtool. After I’d done that, everything worked fine. I could connect to the bootloader on the chip, and erase the flash memory.

Woohoo!!!

~

Over the coming days, I soldered more bits and pieces down, including a couple of LEDs and a few MOSFETS. One of these, a tiny SOT23 device, is to drive a cooling fan. The idea was to use the CAPCOM unit on the XC164 to drive the MOSFET, so the fan is speed controlled. After writing a short test program, I managed to get the fan to spin at varying speeds. I’ve just tarted up the code a bit, and put upper and lower limits on the speed so that you can’t go past maximum or under minimum. The under minimum is important so that the fan doesn’t stall, but the maximum?

Well, the PWM works on two registers and a timer in the CAPCOM unit. The first register is a reload value and the second is a match value. When the timer overflows, it flips an output pin, and reloads from the reload register. This reload value is calculated to give a period of 1 millisecond. The second register is compared against the timer, but a match only flips the output pin, rather than reloading the timer. So it’s important to ensure that the flip register isn’t set past the flip and reset register, or it won’t work. You can use it to generate interrupts as well, but since I’m only bothered about the fan (and therefore the output pin), I switched the interrupts off.

The advantage of this method is that the modulation is all done in hardware. No software whatsoever, except to turn the fan on and off, and change the speed.

More tomorrow, but I have to go into work for an emergency lighting test, and it’s a 1 hour one… what a waste of time that will be. Might leave the car at the valet place.

Posted in Model Railway | Comments Off

The time is near

Well its been a while since the last post, and even longer since one on the railway. Reasons? Well mainly I ran out of money. However, things are improving, and I’ve ordered the parts remaining to build the new controller.

My first attempt at a multichannel analogue controller was successful, at least from a build point. It did what I wanted it to do. However, it relied on human thought to ensure that you didn’t set up a conflict and a resulting short circuit. After burning out a few transistors, I came to the decision that DCC would be a better bet, so I’ve been busy designing a DCC controller. Retail wise, on existing solutions, I would have to spend about £250 on control hardware, and about £15 per locomotive for the clever bit.

I did some quick checking on site, and found that I could get a 5 amp H bridge for under a £10. I had already anticipated microcontrollers when I was in the USA, and purchased 3 Infineon XC164 devices. With the heart of the design decided, I set about a circuit board. This is a custom designed board, and has everything I need on a 100 x 160 board, which will slot into a standard instrument case. In total, I’ve so far spent around £150, so we’re still way under budget.

I was, originally, going to design a nice handset based around another xc164, with capacitive keys, and a 4 x 40 LCD, however, I’ve decided that to test out the whole theory, I’ll use a computer. The link between the PC and the controller board is RS232, so it would be easy to move to a custom handset in the future. The computer program is written in Visual Basic. Whilst I’m really a c / c++ programmer, its not too difficult to pick up, so I should be able to make it work.

The parts are all here, and the PCB is due next week, so I’ll be building soon :-)

Posted in Uncategorized | Comments Off

I almost forgot..

image

Having completed the first week of NEBOSH, I was on my way home when I saw a signpost for Jodrell Bank. Well, me being me, I had to take a look. Photo attached. Unfortunately, the place was closed, so this was about as close as I could get without breaking and entering.

Posted in Uncategorized | Comments Off

New Job

Well, I’ve officially got the new job. Quality, Environmental and H&S Engineer.

Good points – A bit more money. Bad Points – A bit more responsibility.

All in all, a good balance. I’ve got several training courses to go on, one of which I had the first stint of last week – NEBOSH. All in all (and its a feeling common to the other 4 folks on the course) I think it’s rather over-intense. It’s spread over 2 one week sessions, but I think 4 one week sessions would be better. Maybe I’m worrying too much, and we’ll be fine, but there’s as much going out the over-flow as there is going into my head.

In other news, I’ve decided that there are four rooms in my house in need of decorating. The bathroom, the master bedroom, the stairwell and the lounge (in that order). I’ve been thinking of ways I can make more space in the bathroom, and the only way that’s going to happen is if I lose the bath, and install a shower. I’m not particularly bothered about losing the bath, and it would generate lots more space. Enough to put in some storage for toiletries, clean towels and so on. All in all, a better idea.

Posted in Uncategorized | Comments Off

Web browser for tablets

So, after getting an Asus Transformer, I thought about a decent browser for it. Free would be ideal, but a couple of quid is no major expense.

So far I’ve tried the standard browser. Its ok-ish, but seems to struggle with Facebook, which is one site I access quite frequently on the tablet.

Firefox is too slow, and apparently has issues with Flash, reloading libraries each start and won’t find bookmarks in the standard location.

Opera mobile is slightly better, as it’s much faster, and supports Flash. Their zoom function also works better too. Bookmarks are still an issue, but this could be fixed by their speed-dial feature, which I really love on my phone. Sadly, its designed for a phone screen, and therefore is limited to 9 squares about 2 inches square. Total waste of screen space on a tablet. You could easily fit 30+ decent sized buttons on there!

I also tried Dolphin, which looks to be Chrome based, but again, struggles with Facebook.  Bookmarks are not a problem (unsurprising, since Google  makes both Chrome and Android).

So, what would I like? Opera HD. Just like Opera mobile, but with a couple of UI tweaks to make the speed dial work better on a tablet, and use of standard bookmarks.

Is that too much to ask?

Lets wait and see…

Posted in Gear-grinder | Comments Off