December 17, 2014

Getting power over 5kV isolation

Maybe you're asking why on Earth would I need to get power over a 5kV insulation, for Bob's sake. Well, there's a little bit of explanation: I got bored once again, so I started working on an open-source multimeter design based on Dave's idea on EEVblog #184 (in case you don't know the EEVblog channel, I do highly recommend it as I've watched nearly all of the episodes already, and I think it was worth it. Also, the EEVblog forum is really nice and helpful).
Since the meter does actually have no less than four different isolated channels and I kind of want to shoot for a decent CAT rating, I thought it might be a pretty nice idea to put the ADC and all the front-end stuff at the isolated side, since I'll only have to deal with getting the data over, and the ADC (I'm using an MCP355x, it's a nice differential delta sigma ADC with a nice 22bit resolution and mains frequency rejection) itself is fairly low-power - only about ~110 µA plus some other stuff, so I'm looking for about roughly 150-200 µA of current at a steady voltage between 5-2.7V.

I'll write about the multimeter design itself in some additional length later once I advance a bit further in the design stage.

My first thought was to build my own DC-DC converter for getting power over to the other side and using optocouplers to get the data through.
It probably would work, but after I saw the prices of those transformers and how slow the opto's usually are - not as if I really needed any high speed there anyway - I realized these things simply aren't cheap nor small. I don't think anyone would exactly want to carry around a massive brick, no matter what could it do. Also, there's a little bit of a disadvantage of using a DC-DC converter there - it's the noise. Filtering it out to something that won't exactly cut the ENOB of the 22bit ADC there to something ridiculously low would be a bit of a challenge, although a couple of good ferrite beads and caps should do the trick.

The other approach I've tried is to use one of those Analog Devices iCouplers - these things are pretty much chips with integrated transformers, they have multiple channels and they come in isolation ratings up to 5kV and 25kV transient immunity. That's about exactly what I need here - yay!
Some of them even come with an integrated DC-DC converter and some even have the transformer built in - but their efficiency gets pretty horrible, somewhere around 30%. The ones with just the built-in controllers aren't too bad, they can reach efficiencies at up to 80% or something, but I need a high voltage transformer there once again, ugh.

I came up with yet another idea - what about using high voltage capacitors to get the power over through capacitive coupling? That should do the trick I thought. I've then looked up the prices and properties of such devices, and they can be obtained for a reasonable price only in very low capacitance variants, usually in the order of tens of pF. On a second thought I realized the transients could easily pass through and blow the heck out of the circuitry on the other side. That won't be exactly plausible. Argh.

So what did we learn?

  • Doing this kind of stuff on a low power device is madness.
  • Doing this kind of stuff while one needs a fairly low noise output is nearly mad.
  • Doing this with caps is bananas, because transients can pass through and they'd need to be driven at fairly significant frequencies anyway

In case you wonder what have I ended up with so far, there you go:
I'm pondering about using an ethernet isolation transformer since those can be fairly cheap even for 5kV versions, but they aren't exactly the smallest and I might be forced to do double-sided component load to fit everything in, which isn't exactly what I want to do. But the chip of choice ended up being an ADUM4471. I'll have to do some further testing and number crunching about that still, but I guess I'm mostly set. The major problem making me a bit worried would be the massive power requirement of about 10 mA per isolator, and since there will be four of them... Nope, that isn't any much good for battery life I suppose.
I've actually ended up using button cell batteries on the input side and using ADUM144x instead afterall... This solution ended up being much cheaper and should just work, no need to care that much about filtering the supply rails then and yeah, that should just do.
Whew. Electronics engineering is fun at times.

October 31, 2014

Transistor - 1: A 16-bit madness designed right out of discrete transistors

Hi there again,

I've decided to go a little crazy and design a whole 16-bit processor out of individual discrete transistors.  Why?  Well, why not?
A nice full adder with just 9 transistors.
Let me know if you can do better.
I actually had this idea for quite some time now and I'm kinda taking a CPU arch design as a kind of a hobby...  I just find it fun for some reason. But now I actually sorta got to it and I have designed a couple of basic building blocks.  Not just logic gates.  Designing stuff just out of logic gates is pretty lame, trust me.  I have actually done a few transistor-level optimizations already, and well, I kinda find making a 3-transistor XOR kinda impressive. :P

Anyway, there's a couple of various schematics of those blocks on the side. Sorry if they're ugly or unclear, but yeah, it seems to work, so I'm happy.

A full, 1-bit ALU slice. In case you wonder,
bit-shifting is done in a separate bit shift unit.
I've also missed those ZX and ZY bits,
but that should be rather easy to implement
- just don't read an input from a register. Easy.
I've managed to squeeze a full 1bit ALU slice down to 20 transistors, but I bet I could still do better than that, hopefully.

I figured the thing taking the largest amount of transistors would probably be the register file.

I'm having about 8 general purpose registers there as well as a couple of 'special' ones, and each of them being at least 4 transistors worth per bit, and well... that doesn't really make a smiley face, does it?  I'm thinking about using 'dynamic' registers in the actual physical version of this thing instead, but refreshing the actual registers all the time... not really sure. But I guess that might not be a problem since I might use some nice MOS transistors to read that out and some massive electrolytics caps to hold the charge...  I'll see, it's all still in quite an early phaseof design as you can see.

I'm designing the logic using a combination of RTL and DTL by the looks of things, but I don't know really.  I'm just really whacking it up the way I try to get to the lowest possible transistor count.  I've set myself a limit of roughly 1000 transistors pretty much for no reason whatsoever.  I'm quite doubtful about that, but I'll see.  I'll probably actually end up making the ALU just 8 bit and pass stuff through twice - that actually saves a whole bunch of transistors, but it makes it quite a bit slower.  But I don't mind that really, I guess.

I think I should describe the whole architecture a bit more. I'd be making a softcore version of it in VHDL soon, so in case you'd like it, just ask me for that somewhere or write your own if you're so inclined.

So there you go.  I will hopefully finish the design sometime and possibly even make it someday...
In case I'll be REALLY building this, I'd go oldschool wire-wrapping style, I guess.  Let's face it - soldering wires to all those 3500+ joints?  No thanks.  That would just take ages.  So I'll just quickly solder the leads of all of those things to a board and then wrap it, test it, blow it up, fix it, blow it up again, fix it again, give up, get back to it, fix it again like a pro, make sure it works, pot it up and be done with it.  I guess.  I bet it's not gonna be so easy, so expect a couple of more entries about this thing since I'm actually fairly excited about it.

October 3, 2014

ST Nucleo Development Board Review

So I got my wage once again and wondered what to spend it on, so I thought I might get one of those ST Nucleo devboards, because they're pretty cheap, I might wanna learn how to program those nice ARM micros, and they come with a fairly decent support and hardware resources as well, so I got one. Yay.

I've ran for the L152RE one for a number of reasons:

  • Amount of flash memory. It's got whopping 512KiB of it. Freaking half a meg. Suck that, Arduino!
  • Amount of SRAM. I almost went jawdrop mode when I saw it's got 80KiB of it. Why'd I ever need so much memory anyway? More about that later.
  • It's also got a pretty much standalone ST-Link V2 on it, which could be used to program other micros and hack random other stuff, and seems to be supported by the OpenOCD too! Yay!
    This thing alone's worth a nice buck.
  • Triple SPI and double I2C, not bad.
  • No less than 5 USARTs. Neat.
  • It also supports USB somehow, too.
  • It has arduinous headers on it too, in case one might wanna use any of those ubiquitous shields
  • They claim it's also got 11 timers and up to 34 capacitive sensing channels and it can drive up to 8x40 segment LCD. Yeah, not bad. also a 1MSPS ADC - cool.
  • It's also got two 12bit DACs. Yup. THIS was the main reason why I bought it.
There it is.

When I got it (I even was late for school just to pick it up at a local post office, because I thought I could play with it at school, but alas, I didn't have the goddamn miniUSB cable it needs that day, damnit), I was actually fairly surprised when I discovered it acts like a flash drive after plugging it in! It comes with a little html file on it which pretty much only redirects you to the mbed.org site and gives you their online compiler. That thing also comes with a whole range of examples, I haven't even tried a half of them, even though I might do so later, and I went straight to playing around with that dual-channel DAC on the thing, because you know, I just love drawing stuff on the 'scope in XY mode. I dunno why, but that's one of the few things that kinda satisfy me.

And that turned out to be pretty nice.


Anyway, back to the review,
Both of those waveforms should display the same, but they don't.
The first one comes from the DAC on PA_4 (aka A2),
the second comes from the PA_4 (D13) crippled by the onboard LED.
One thing I found slightly disappointing, is the fact it's got an LED connected to one of the DAC outputs. I know why, the DAC just so happens to end up on Arduino pin D13, which is where a LED is typically attached to on most arduinous boards of this form factor. So what's the problem, dude? Well, it just so happens the LED cripples the wave coming out of the DAC in a pretty ugly fashion. So it basically doesn't let anything over about 2V out, which almost made me go mad. This can be solved by removing a little jumper resistor at the bottom, but since I'm lazy, I've just downscaled the output in the code to be always under that value in the linear range. Nailed it.

But apart from that, I can't really complain much about this thing. I think I'd even recommend you getting one - they have a very wide range of them, each sporting a different processor with a different set of features that might be handy for something else. Anyway, it costs less than a half of the price of the Arduino Uno, and it has the same headers too, so in case you happen to be running low on money and actually think going with something slightly nicer than just a simple 8bit micro, I guess this might be the choice for you. I also really like the fact it's got that ST Link debugger on it ready to be broken out and being used standalone, so that might really come in handy too later, once you actually make your own little board or something.


August 20, 2014

Woo, got a new phone!

Just a quickie - I've got a new phone now, which seems to have a somewhat decent camera on it.
That means I'll be able to take pics one could actually make heads and tails of and generally document stuff a little bit better, I hope.

For those who are interested, it's a GIGABYTE Gsmart Aku 1 Quad, not a bad one, and it was really cheap too!

June 11, 2014

Pong on a 'scope: Dicking around with XY mode

I'll start this entry like this:
The 'problem' with me is, that when I figure out how to do something, I keep expanding that, until it goes completely mad. What I'm talking about now is dicking around with the XY mode of a scope with a DAC.

Pong-o-scope.
After some more dicking around with drawing stuff with the XY mode, I rumbled upon my parts bin again, and found a pot. That made me think the junk I make appear on the screen is just a little bit too uninteractive, and after an hour or so, I wrote this Pong game. I know it sucks, it's buggy and glitchy at times, it looks awful, but that's just something I made once again, so I thought about slapping it onto my blog. Why not, right?

How not to breadboard 101
On the right you can see a couple of photos of my current setup. If you are any sane, you're probably looking for something to puke into now, because that's pretty much how NOT to breadboard 101, but it works, right?

So, in case you're as crazy as I am and you'd like to slap one together as well, here's a quick howto:

What you need:


  • an Arduino or something like that
  • an MCP4822 DAC
  • a couple of pots of a reasonable value (anything between 2k2-100k should be right)
  • a breadboard
  • and obviously a dual channel analog oscilloscope - it has to be analog, because the XY mode on digital ones doesn't really work for this stuff well.

How to slap it together:

Here's a fritzing sketch for ya:
And HERE's the arduino source code.

Here's a video of it in action:


Conclusion:

I've slapped this thing together in just about an hour or so, so don't expect anything very much polished as always, but that means there's a ton of space for improvement - I'll probably add at least one thing into this project later - sound. It's completely silent now, which kinda sucks.
Also, I'm using a pixel approach - which kinda sucks as well! I'll probably switch to vectors once I figure out how to draw these properly (facepalm)...

I hope you like this project.
Also, don't forget to leave a comment!

June 8, 2014

Nixie Clock: First Sparks

It probably wouldn't be a proper today's self-made electronics blog if I hadn't built myself a nixie clock, so I gave it a shot.

So this is the result:
It looks rather ugly IMO, but that's hopefully subjective. I'm using a couple of ZM1080T tubes there, because I just got those two and couldn't be assed getting something else, driven by a couple of classic 74141 driver chips I've salvaged somewhere. It's all powered from a 9V power supply connected to those two screw terminals. I don't have any schematic for this, built it off-hand pretty much with a help of some pinouts I found on the net.

The microcontroller there is the everpopular ATMega8, and I've even got an LM335 temperature sensor, so it shows temperature too!

How the hell can I show time on just two nixies? What kind of sorcery is that? Well, the sorcery's called decimal points, and each of those tubes has two. I'm actually using just one in each tube to indicate what's it showing. If the left one's on, it shows hours, if the right one's on, it shows minutes, if both are on, it shows seconds, if none is on, it shows temperature (Celsius!).

I have yet to figure out how to make the time properly user-settable, I even thought about making it radio-controlled, but I can't be assed either buying or brewing my own DCF77 receiver or something of that sort, so yeah.

Well, this is the project preview and I hope you like it!
Anyway, sorry for the picture and video quality, both was shot with my crap mobile phone.

I'm Not Scopeless Anymore!

Till now, all my measurement equipment consisted of a cheap sub $5 multimeter and a soundcard as a poor man's scope. That means, I were mostly blind for anything over say 20kHz, but mostly I were lazy enough not to set up the soundcardscope, so I were mostly limited to DC.

IT'S ALIVE!
But that has changed. I've got a new friend!

It's an old Philips PM3216 (good luck finding any info about that one!), a dual channel, analog oscilloscope which claims to go to whopping 35Megahurtz! Wowzers!

The seller actually claimed this scope was unable to turn on, so he sold it as broken. And if you try to google for a service manual for this scope, all you've got is a couple of ones in paper form on eBay, but I don't really know anyone who'd want to buy one. So, that meaned the scope's price went quite low - for about $20, instead of more typical $150+, which is what most scopes go for at a local auction site I bought this on.
The seller happened to live in the same city as I do, so I just went and picked it up, which means no postage and instant delivery, so I were quite happy about that.

When I went home by tram, I started to look at the scope a bit more in detail. The buttons looked ok, knobs felt great, and everything looked pretty darn nice, apart from a bit of a dust on the front panel, which is really nothing to worry about. The first thing that struck me was the lack of any power button!
So I started to look at the front panel a bit more - and then realized the ILLUM pot, right over the POWER LED has a marked position saying OFF, which other pots don't. It was in the same color as the 'power', and when I turned the pot, it felt like there's a switch attached to it! What a fool, that seller...

When I came home, I plugged it in. Turned the Illum knob, and it worked! I felt really happy, which is something that doesn't happen very often.
So I sat and started playing around with it. I realized I have no probes nor any BNC connectors, so what I did is I took a piece of copper wire, bent it 180 degrees, and slapped it into the middle of a BNC connector. It fits perfectly. So I'm using those as temporary probes. Where's the ground lead there I hear you ask. Well, there's a banana/wirescrew groundpoint on the front as well, so I just screwed a wire into that, and put it into a breadboard. Good enough for now. I'll make myself a pair of probes once I have the money for that.

What do you get when you combine me,
and Arduino, a DAC and an analog scope?
So then I wondered what to do with it. I rumbled for a while in my parts bin and found an MCP4822, which is an SPI, 12-bit dual channel DAC with a built-in reference. It also turned out there's an Arduino library for it out there, so I slammed it into my breadboard, whacked a couple of wires to it to the arduino and connected 'probes' to the outputs. Made the scope go XY-mode, and started playing around.

That ended up with writing myself a 'library' to draw some text on the screen! It's a pixel-based font, 7x5. You can see an example of it on the right. I ran into a little problem though - the arduino can't push much more than that to the DAC quickly enough, so anything more and you'd see some flickering on it, which doesn't really please the eye. I wanted to do some vectory stuff as well, but I couldn't really be bothered. The next thing I did was writing a basic Pong! game for it, but I don't have any pictures of that yet, maybe that would make for a next blog entry, check it out, it's the next blog entry.

If you managed to read this all, you deserve a cookie.

Hello world!

Hi there!


My name's Richard Kutina, I also call myself kutis at times (lowercase k) and I am, as you might've noticed, a (somewhat) lonely mad (wannabe) engineer. Not really mad, but most people find me odd in some way, and not really an engineer, because I'm still a highschool student. (But I'll hopefully become one anyway!)

I'm mostly into computers (all sorts of - including retrocomputing, embedded computers and so on) and digital electronics, microcontrollers and that sort of jazz, and I generally try to stay away from RF or power stuff.

Designing electronics is probably the major one of mine current hobbies, I think. The other one I used to have was programming, and I still write some stuff in C (or so, but I can write a ton of other langs as well, and read even more) time to time, but that's nothing compared to the 'good ol' times'.

I've decided to start writing this blog, because I just wanted to have some place to dump my ideas into. And you know, a place where someone could actually see them might be nicer than just a chunk of paper, right?

So what should you expect to find here?

I kinda plan to post there progress reports of some of my random projects, random rants and crying sessions, maybe some reviews and all sorts of other stuff I hope you find at least a little bit interesting and/or worth the read, at least.
It would be mostly just me dicking around and writing some shit that doesn't even make sense, I guess... Who knows...