Speccy Control
May 6, 2007 5:32 PM   Subscribe

How can I control things with my Speccy?

I have a ZX Spectrum 48k.

I want to control two relays.

How? Can I do it with those edge connectors alone, or do I need extra hardware? What type of connections do I need? Can it be done in BASIC? Any good tutorials?

Can anyone point me in the right direction?

(...I know sod all about electronics.)
posted by popcassady to Computers & Internet (10 answers total) 1 user marked this as a favorite
 
OK, I am NOT anything like a programmer or electronics expert. But I had a Timex-Sinclair 1000, which was the the US version of the ZX-81 (I think) so your question caught my eye.

I did some Googling and found:

at http://www.davidbuckley.net/DB/webCV.htm
'Power Card' relay card construction project -- SP Dec 1982
(No instructions, but the site might lead you to where you can find more info.)

Also on: http://www.davidharrison.org/microbib.html (the page title of which is "zx-spectrum.com")
There is what appears to be a list of magazine articles. Maybe you can find something at your local library based on this info.
---------
[ART] Plant, Malcolm. "Power Control for Micros." Electronics and Computing Monthly Article: June 1983. pp.39-43; PCB foil patterns: July 1983. p.36.
Constructional article. Three control units: a relay driver unit for on-off control of power to an electrical load; a digital-to-analogue converter unit for smooth power control of lamps and DC motors; and a stepper motor controller unit.

---------
[ART] Walcot, Chris. "Relay Board & Optical Sensor." Electronics and Computing Monthly May 1985. pp.46-47.
Constructional article. Additional features for the I/O port published in the January issue (pp.25-27), above.

---------

Looks like what you want to do might be possible, but who knows what skills are needed.

And if it can be done, I'm sure it can be done in BASIC. Again... how much programming skill is needed?

Have fun. You are brave.,
posted by The Deej at 5:54 PM on May 6, 2007


Best answer: So what you need to do on the Spectrum is set on (x volts - probably 3.3 or 5, but I know nothing at all about that machine.) or off (0 volts) states on two edge connector pins. It's up to you or some other respondent to find out how to do that or if it's even easily possible.

So, each pin state will control the energization of a relay's coil.

However, there is almost zero chance it can do so directly, because a connector coming off a computer is unlikely to provide enough power to energize a relay coil. Even if there was sufficient current, it would be a very bad idea to hook a magnetic coil directly to a computer's circuitry. You need some sort of relay driver which is activated by the computer and in turn activates the relay.

Google "relay driver." You can either make one or buy a chip that is an all-in-one piece.

What load are you controlling, however? If it's 120V AC, you should probably be using a relay, but if it can be done with low voltage DC you'll make things much easier by just going solid state. In this case, you'd probably be able to just have the edge connector drive a transistor which drives your load.

If you go with a relay, you need to make sure your edge connector voltage is compatible with your relay driver input, your relay driver output is sufficient for your relay coil, and that your relay is rated for the load you will put on it. If you go with DC and a transistor, you'll need to ensure that your edge connector can drive the transistor and the transistor can drive the load. Depending on the type of transistor and the size of the load your edge connector might not be able to drive the transistor well enough to drive the load, and then you need more transistors.

There's also solid state relays, which are basically fancy combinations of transistors to do the job of a relay in a chip package, but I've no experience with them.

In any case, you'll also need to connect a ground pin on the edge connector to the ground of the circuit you use. (This is somewhat/sometimes different from the ground in your house's wiring.)

Overall, I think the simplest thing would be a premade relay driver and a relay or some packaged solid state relay/switch if you can get away with it.
posted by TheOnlyCoolTim at 6:46 PM on May 6, 2007


Best answer: According to this circuit diagram, there are no convenient general-purpose I/O pins on the edge connector you can just drive high or low with POKE etc; most of the signals on that connector go straight to the microprocessor. You're going to need to know slightly more than sod-all about electronics to finish this project.

Some small telephony-style relays can be driven straight from the outputs of 74AC or 74ACT series CMOS gates; these devices have ESD protection diodes wired back to their power supply rails from the output pins, and the current ratings on these are sufficient to absorb the inductive kickback from the relay coil. For any decent relay, though, you'd want to drive the coil via a transistor with a suitable current rating.

The cheapest and most straightforward way to get this done is probably going to involve doing it the Apple II way, with one 74ACT138 address decoder, one 74ACT259 octal addressable latch, and one resistor, transistor and diode per relay coil. If Spectrum BASIC has OUT statements for controlling Z80 I/O ports, you're laughing; if it only has POKE, you would probably want a bit more address decoding.

What is it that you want your relays to control? Because that will dictate the selection of relays, which will in turn dictate the selection of relay driver transistors.
posted by flabdablet at 5:41 AM on May 7, 2007


Response by poster: Damn, not as straight forward as I thought. Octal addressable latch?

I wanted to control two relays, have them trip at regular intervals -- one just before the other. I only thought of using the Spectrum because I thought it would be a lot easier than learning how to build a simple timer circuit from scratch. I remember that kind of stuff being a doddle on the Beeb, I assumed it would be the same with the Speccy.

Perhaps learning electronics would be a lot easier.

(Anyone know of any good online tutorials?)
posted by popcassady at 9:01 AM on May 7, 2007


Best answer: Someone already made a simple timer circuit for you, and they called it the 555 timer. You just need to hook up a few resistors and capacitors to set the timing and mode of operation. You still will probably need relay drivers between the output of the 555 and the relay coil.
posted by TheOnlyCoolTim at 10:48 AM on May 7, 2007


Response by poster: Ah! I was just looking at that. Cheap too!
posted by popcassady at 11:21 AM on May 7, 2007


I remember that kind of stuff being a doddle on the Beeb, I assumed it would be the same with the Speccy.

Ah. I see you're confusing a design whose main aim was to be useful with a design whose main aim was to be cheap.

Back in the days when 300 baud direct-connect modems were the bee's knees (because they were more reliable than the far more common acoustic couplers) I built a phone pulse-dialler for my Apple ][+. It consisted of two little relays connected straight to the game controller connector on the Apple motherboard, and it was easily driven from BASIC.

By comparison with the Apple ][, the Sinclair machines were cheap, underdesigned paperweights. None of Sinclair's design compromises ever had any degree of elegance.

The BBC Micro, on the other hand, was a pretty sweet machine. BBC BASIC in particular was streets ahead of Applesoft.

Sinclair's approach to "expandability", like its approach to just about everything else, was to leave most of it out. It cost them virtually nothing to make the entire Z80 microprocessor pinout, along with a few power supply and video signals, available to an edge connector on their PCB, so that's what they did. Any kind of expansion therefore needed its own circuitry to decode the Z80 address, data and control busses and provide the necessary buffering. This made the Spectrum cheaper and expansion boxes more expensive.

/derail

The question remains: what are you going to control with these relays? Have you already chosen the relays you're going to use? What's their rated coil operating voltage and coil resistance? With answers to those, I can give you a few quick guidelines on how to drive them.

If you'd rather bootstrap your own knowledge, though, Googling electronics tutorial will get you started.
posted by flabdablet at 8:25 PM on May 7, 2007


Response by poster:
The question remains: what are you going to control with these relays? Have you already chosen the relays you're going to use? What's their rated coil operating voltage and coil resistance? With answers to those, I can give you a few quick guidelines on how to drive them.
Ummm.... they're blue?

I started reading a tutorial today -- I really know next to nothing about electronics (though I did figure out the other day that sticking a diode to one of the relays made things work better). I've had a look at the 555 and it seems that -- once I know how things work -- I should be able to build what I want from a couple of them.

As for what I want to control: One relay is to complete a low power curcuit of a few volts, the other is to operate a projector motor that runs off the wall (it doesn't feel too good if you touch the bare wires).
posted by popcassady at 11:27 AM on May 8, 2007


Blue.

OK.

Where did these relays come from? Do they have anything stamped or printed on them, like a manufacturer's name and/or type number?

How good is your soldering technique?

What construction technique are you contemplating for this relay control circuit?

What kind of wire, plugs and fittings do you intend to use to connect to the projector motor?

You're in the UK, so you have the same potentially deadly 240V mains electricity that we do here in Australia. It's not generally reckoned to be a good idea for an electronics n00b to mess about unsupervised with mains wiring. Do you have a more experienced friend that you can get hold of to check your work?
posted by flabdablet at 1:43 PM on May 8, 2007


To elaborate on what flabdablet said, given that you don't have the skill or equipment to play with them, these relays are somewhat worthless to you if you can't find any datasheet/information on them. (And I, with some skill and equipment to play with, would only use them for trivial/hobby uses without a datasheet.) Search Google, Digikey.com, and any manufactures website for any numbers printed on the relay and try to find a datasheet, but relay datasheets have been hard to find for random relays when I've looked.

Not knowing anything about the relays, you'd probably get away running the few volts circuit without too many problems, if whatever you build doesn't under or over drive the coil, but I wouldn't hook any relays up to switch the house wiring without knowing that it's rated for that. There's a decent chance the thing would immediately blow up. (The physical size of the relay and contacts here would be a hint - if the contacts don't look to be on somewhat of the same magnitude of size as plugs you put into the wall, the relay probably isn't big enough.)

So you're very likely to be better off figuring out what you need for each load and buying relays you know are appropriate, although I don't think it would be likely to hurt to try the relays you have for the low voltage circuit.
posted by TheOnlyCoolTim at 4:38 PM on May 8, 2007


« Older Unlocking a cell phone that doesn't allow buttons...   |   Autism services in Florida Newer »
This thread is closed to new comments.