Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II » Controlling circuits with Apple II+
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Controlling circuits with Apple II+ [message #387186] Thu, 19 September 2019 19:42 Go to next message
Anonymous
Karma:
Originally posted by: Chris Tobar

Hi all,
I haven't posted in a long time. But I had a question maybe someone can help with. I have a vintage Apple II+ and one thing I've always wanted to experiment with is making a program that can control circuits in the "real world" using relays - to turn on motors, lights, etc. I've been doing a little bit of research. online and it seems like the easiest way would be to use the game port and use BASIC POKE commands to turn the "annunciators" on or off. The annunciator would then switch a relay on or off, to control external circuits.

If I understand it right, with an annunciator turned on with a POKE command, there would be 5 volts between the annunciator pin and the ground pin? Would it then stay on, or would I need to maybe use a loop to continuously supply 5 volts? Also, what is the maximum current that can be drawn without risking damage to the computer?

One other question, what would be the best way to protect the computer from kickback or voltage spikes from the relay? Maybe a resistor or a small choke?

I've always dreamed of making a computer program that could control real devices like this. Any suggestions would be greatly appreciated!

- Chris
Re: Controlling circuits with Apple II+ [message #387188 is a reply to message #387186] Thu, 19 September 2019 20:01 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Bobbi

On Thursday, 19 September 2019 19:42:55 UTC-4, Chris Tobar wrote:
> Hi all,
> I haven't posted in a long time. But I had a question maybe someone can help with. I have a vintage Apple II+ and one thing I've always wanted to experiment with is making a program that can control circuits in the "real world" using relays - to turn on motors, lights, etc. I've been doing a little bit of research. online and it seems like the easiest way would be to use the game port and use BASIC POKE commands to turn the "annunciators" on or off. The annunciator would then switch a relay on or off, to control external circuits.
>
> If I understand it right, with an annunciator turned on with a POKE command, there would be 5 volts between the annunciator pin and the ground pin? Would it then stay on, or would I need to maybe use a loop to continuously supply 5 volts? Also, what is the maximum current that can be drawn without risking damage to the computer?
>
> One other question, what would be the best way to protect the computer from kickback or voltage spikes from the relay? Maybe a resistor or a small choke?
>
> I've always dreamed of making a computer program that could control real devices like this. Any suggestions would be greatly appreciated!
>
> - Chris

It is basically one poke to turn on the annunciator and another poke to to turn it off. They can't really provide any significant current, so you would want to use them to drive some sort of solid state relay if you want to switch loads such as lamps or motors. Shouldn't be too hard to do using the game port and some simple breadboard electronics.
Re: Controlling circuits with Apple II+ [message #387190 is a reply to message #387188] Thu, 19 September 2019 20:40 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Chris Tobar

Awesome. Thanks, Bobbi! I've read about solid state relays before, but never actually used one. That would be good because then I wouldn't have to worry about inductive kickback from a coil, and I think SSRs can use a very small input voltage. Have you ever used them before? I'll have to see if the local electronics shop where I normally go has solid state relays.
Re: Controlling circuits with Apple II+ [message #387191 is a reply to message #387190] Thu, 19 September 2019 21:03 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Bobbi

On Thursday, 19 September 2019 20:40:40 UTC-4, Chris Tobar wrote:
> Awesome. Thanks, Bobbi! I've read about solid state relays before, but never actually used one. That would be good because then I wouldn't have to worry about inductive kickback from a coil, and I think SSRs can use a very small input voltage. Have you ever used them before? I'll have to see if the local electronics shop where I normally go has solid state relays.

I am more of a software person, but I expect someone with some hardware experience will chime in with some advice.
Re: Controlling circuits with Apple II+ [message #387194 is a reply to message #387186] Thu, 19 September 2019 22:18 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Frank M.

On Thursday, September 19, 2019 at 4:42:55 PM UTC-7, Chris Tobar wrote:
> Hi all,
> I haven't posted in a long time. But I had a question maybe someone can help with. I have a vintage Apple II+ and one thing I've always wanted to experiment with is making a program that can control circuits in the "real world" using relays - to turn on motors, lights, etc. I've been doing a little bit of research. online and it seems like the easiest way would be to use the game port and use BASIC POKE commands to turn the "annunciators" on or off. The annunciator would then switch a relay on or off, to control external circuits.
>
> If I understand it right, with an annunciator turned on with a POKE command, there would be 5 volts between the annunciator pin and the ground pin? Would it then stay on, or would I need to maybe use a loop to continuously supply 5 volts? Also, what is the maximum current that can be drawn without risking damage to the computer?
>
> One other question, what would be the best way to protect the computer from kickback or voltage spikes from the relay? Maybe a resistor or a small choke?
>
> I've always dreamed of making a computer program that could control real devices like this. Any suggestions would be greatly appreciated!
>
> - Chris

How many relays do you want to control? If you only want 3, you could just send the outputs into a MOSFET as outlined in this article. They also include a link to sparkfun which has all the parts you would need.

https://bildr.org/2012/03/rfp30n06le-arduino/

If you want more than 3, you would have to send the outputs into a multiplexer, or use individual lines with a shift register.

If you're using an inductive load like a relay, you'll want to use a snubber diode like the 1N4004 across the coil to block the back EMF.

Solid state relay is a good choice. Can control AC current as well. Would probably also include some circuitry so you don't destroy your machine.

f
Re: Controlling circuits with Apple II+ [message #387195 is a reply to message #387186] Thu, 19 September 2019 23:04 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: James Davis

There were plenty of electrical/computer/electronics magazine articles about how to do it back in the Apple II/II+ heyday (1977-1996); e.g., BYTE Magazine, Also lots of books: e.g., The RED Book and the other A2 Technical Reference Manuals.

You can increase the power of the relays in a chain until the last relay is sufficient (big enough) to control the power of whatever device you need to switch on/off; e.g., a 12KV, bookoo Watts, power station, if you so desire.

You could probably even find some A2 software to program with electrical ladder logic. Then you would have an A2 based Programmable Logic Controller (PLC).

You can also get Digital to Analog (DAC) peripheral cards for the A2 to control real-world devices.
Re: Controlling circuits with Apple II+ [message #387197 is a reply to message #387186] Fri, 20 September 2019 08:02 Go to previous messageGo to next message
Gordon Henderson is currently offline  Gordon Henderson
Messages: 73
Registered: April 2013
Karma: 0
Member
In article <c2f21f04-0c34-4f34-bc93-826c7e833d59@googlegroups.com>,
Chris Tobar <gatewaycityca@yahoo.com> wrote:
> Hi all,
> I haven't posted in a long time. But I had a question maybe someone can help with. I have a vintage Apple
> II+ and one thing I've always wanted to experiment with is making a program that can control circuits in the
> "real world" using relays - to turn on motors, lights, etc. I've been doing a little bit of research. online
> and it seems like the easiest way would be to use the game port and use BASIC POKE commands to turn the
> "annunciators" on or off. The annunciator would then switch a relay on or off, to control external circuits.
>
> If I understand it right, with an annunciator turned on with a POKE command, there would be 5 volts between
> the annunciator pin and the ground pin? Would it then stay on, or would I need to maybe use a loop to
> continuously supply 5 volts? Also, what is the maximum current that can be drawn without risking damage to
> the computer?
>
> One other question, what would be the best way to protect the computer from kickback or voltage spikes from
> the relay? Maybe a resistor or a small choke?
>
> I've always dreamed of making a computer program that could control real devices like this. Any suggestions
> would be greatly appreciated!

Without wanting to get away from the Apple II, this sort of this is done
all the time in the Arduino and Raspberry Pi world - so there are plenty
(millions) of examples to look at there.

However, the Apple II, being just a little bit older needs a little bit
more care than an Arduino.

What I'd do on the Apple though: Start with a breakout system - so get
a 16-pin header to some robbon cable to another 16-pin header that you
can plug into a solderless breadboard.

(Does anyone make these?)

Then you can start with 4 LEDs and 3 butons (only 3 inputs). You'll
need a resistor for each LED (560 ohms is fine) and a resistor (10K)
to connect each of the 3 button inputs to the 5v line - then connect
a button to the 0v/Gnd line. The inputs will read '1' when nothing is
pushed and read '0' when you push a button. (Note that reading a button
really gives >= 128 for '1' and < 128 for '0').

That ought to be able to get you started before thinking about relays
and so on.

(and one you can control an LED, moving to a solid state relay which
use opto-isolators is easy)

Gordon
Re: Controlling circuits with Apple II+ [message #387200 is a reply to message #387188] Fri, 20 September 2019 12:15 Go to previous messageGo to next message
scott is currently offline  scott
Messages: 4237
Registered: February 2012
Karma: 0
Senior Member
In article <fe180e44-ca7b-4046-822e-c1745128db12@googlegroups.com>,
Bobbi <bobbi.manners@gmail.com> wrote:
> On Thursday, 19 September 2019 19:42:55 UTC-4, Chris Tobar wrote:
>> If I understand it right, with an annunciator turned on with a POKE
> command, there would be 5 volts between the annunciator pin and the
> ground pin? Would it then stay on, or would I need to maybe use a loop
> to continuously supply 5 volts? Also, what is the maximum current that
> can be drawn without risking damage to the computer?
>
> It is basically one poke to turn on the annunciator and another poke to
> to turn it off. They can't really provide any significant current, so
> you would want to use them to drive some sort of solid state relay if
> you want to switch loads such as lamps or motors. Shouldn't be too hard
> to do using the game port and some simple breadboard electronics.

Depending on what you're trying to switch, an NPN transistor may be all you
need. Connect the base through a resistor (maybe 1K?) to the annunciator
output, connect the emitter to ground, and connect the collector to the
negative side of your load.

This also lets you drive stuff that needs something other than 5V to power
it.

>> One other question, what would be the best way to protect the computer
> from kickback or voltage spikes from the relay? Maybe a resistor or a
> small choke?

A diode connected in reverse across the relay coil is what you'd normally
use for back-EMF protection.

_/_
/ v \ Scott Alfter (remove the obvious to send mail)
(IIGS( https://alfter.us/ Top-posting!
\_^_/ >What's the most annoying thing on Usenet?
Re: Controlling circuits with Apple II+ [message #387201 is a reply to message #387200] Fri, 20 September 2019 12:20 Go to previous messageGo to next message
scott is currently offline  scott
Messages: 4237
Registered: February 2012
Karma: 0
Senior Member
Some additional clarification follows:

In article <qm2tvm$fi9$1@dont-email.me>,
Scott Alfter <scott@alfter.diespammersdie.us> wrote:
> In article <fe180e44-ca7b-4046-822e-c1745128db12@googlegroups.com>,
> Bobbi <bobbi.manners@gmail.com> wrote:
>>> One other question, what would be the best way to protect the computer
>> from kickback or voltage spikes from the relay? Maybe a resistor or a
>> small choke?
>
> A diode connected in reverse across the relay coil is what you'd normally
> use for back-EMF protection.

I assumed "relay" in this context meant an electromechanical relay, switched
by a transistor controlled by a signal from the computer. If you were to
use a solid-state relay, there's no coil to produce back-EMF, so no
protective diode is needed. It might still be advisable to switch the SSR
through a transistor, though, to keep from overloading the signal source.

_/_
/ v \ Scott Alfter (remove the obvious to send mail)
(IIGS( https://alfter.us/ Top-posting!
\_^_/ >What's the most annoying thing on Usenet?
Re: Controlling circuits with Apple II+ [message #387202 is a reply to message #387186] Fri, 20 September 2019 12:33 Go to previous messageGo to next message
mspangler is currently offline  mspangler
Messages: 14
Registered: October 2012
Karma: 0
Junior Member
Vernier's books "How to Build a Better Mousetrap and 13 other Apple II Projects" and "Chaos in the laboratory" are great if you can find them. Otherwise any circuit that can go from TTL to 12 V and 100 ma will do for most things.

The truly paranoid (which is a good thing in this context) will use an inverter (LS7404) or an optocoupler between the gameport and the base of the transistor which then drives the relay. If things go wrong, you want the magic smoke to depart from the cheap part, not the Apple.

A ULN 2803 can do it in one chip.
Re: Controlling circuits with Apple II+ [message #387203 is a reply to message #387202] Fri, 20 September 2019 13:43 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Bobbi

On Friday, 20 September 2019 12:33:17 UTC-4, mspa...@gemsi.com wrote:
> Vernier's books "How to Build a Better Mousetrap and 13 other Apple II Projects" and "Chaos in the laboratory" are great if you can find them. Otherwise any circuit that can go from TTL to 12 V and 100 ma will do for most things.
>
> The truly paranoid (which is a good thing in this context) will use an inverter (LS7404) or an optocoupler between the gameport and the base of the transistor which then drives the relay. If things go wrong, you want the magic smoke to depart from the cheap part, not the Apple.
>
> A ULN 2803 can do it in one chip.

At least in the case of the ][+ if you were to have magic smoke depart from some chip it would be some standard 74LS... part anyhow. But I agree, better safe than sorry.
Re: Controlling circuits with Apple II+ [message #387223 is a reply to message #387203] Fri, 20 September 2019 21:36 Go to previous message
Anonymous
Karma:
Originally posted by: Chris Tobar

A lot of great advice so far! Thanks everyone! I think I'm definitely going to go with using solid state relays. To be extra safe, I think I will drive the SSRs from the computer with transistors.

I've never really worked that much with solid state electronics (most of my experience has been in projects with heavier AC circuits, and restoring antique tube radios). So I think what I'll try first is just something simple like hooking up LEDs to the computer through transistors and then figuring out how to turn them on and off with BASIC poke commands.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Super Sketch Plotter
Next Topic: fastchip incompatibilities
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Apr 17 21:28:02 EDT 2024

Total time taken to generate the page: 0.02134 seconds