Newbie circuit design help

WeeLittleMike

New Member
I am wanting to make a generic circuit that can be put on any I/O pin that would allow any pin to connect to any basic I/O device. The plan is to have screw terminals that you hook your I/O device into and that will go to a switch that selects whether the pin is input or output. This is what I have so far. Any suggestions as to what I should consider in this circuit or how to do it better? Thanks in advance.

Generic.jpg Generic1.jpg
 
Last edited:

Dippy

Moderator
Can you explain the flow of current when in 'Output' mode. It's been a long day and my brain is on a go-slow.

Let's say you I/O is set High. What happens next?
Maybe if your right-hand side terminals were marked 1,2 and 3 it would help/
 

WeeLittleMike

New Member
I added another image to the first. The screw terminals (right) are Voltage, I/O and ground. This way I can have the I/O tied to power or ground as needed.
 

WeeLittleMike

New Member
I had not seen PICAXE Create before I posted. It looks like it is designed for the 18M2 and I am wanting something I can use with any I/O on any picaxe. I'll look into it further. Thanks.
 

srnet

Senior Member
Well, Why ?

Its how the component at either end is configured that determines whether a pin is an input or output, a switch on a circuit board cannot turn a input pin into an output pin and vice versa.

Apart from protecting a 'pin' to prevent it being set to outputs at either end, which can be dealt with by a simple series resistor, what is it you are actually trying to do ???
 

WeeLittleMike

New Member
I run a small local haunting group (Halloween prop builders). I want to promote the picaxe chip to the members of the group. Many of them do not do much with circuitry and buy (at a great expense) professional prop controllers. I have used the Picaxe chips to run some of my props, but I want to make it easier for the others to get started making their own controllers. My plan is to make a generic circuit that I can put on any I/O pin that would allow the user to "plug in" an input or output and then be able to program the chip to act upon whatever is hooked up. I know that the switch does not make a pin an Input or output. In my limited circuitry skills, I thought that an output would need more components that might interfere with a simple input like a mat switch or break beam. If I am wrong, then that is exactly the type of information I would like to know. Most props only need one input and a couple outputs. The PICAXE Create seems to be too big for what my group will be using them for. I just want a small circuit that can handle inputs and outputs with the least amount of circuit building. I hope that explains everything a bit better.
 

geoff07

Senior Member
local haunting group
something new every day!

I think you are overcomplicating things. A Picaxe pin will be whatever the thing connected to it needs, and is automatically set by the command you use to access the thing. Better perhaps to start with a real example and see what that actually requires. I struggle to think what an example might be but perhaps you have one.
 

boriz

Senior Member
For outputs, this.

For inputs, who can tell? It all depends on the nature of the input. If it's a button or LDR, then you need two resistors (the protection resistor and a pullup/pulldown). You might also need a CR network to debounce the signal. What if it's changeover switch, or an optical encoder, or a thermistor bridge, or a phototransistor, or a Piezo vibration sensor, or a 1-wire device or I2C/SPI/RS232, etc...
 

boriz

Senior Member
Input protection could be as simple as a resistor, if you know that it will be driven by no more than VDD. But there's lot's of things you might connect that are 6v or 12v or 24v etc. Maybe 2 reverse biased diodes, one connected to VDD (and the input), the other to 0v (and the input). The top one only becomes forward biased when the incoming voltage exceeds VDD. The other only becomes forward biased when it goes below 0v. And the 1K resistor drops the incoming excess voltage across it. Something like that maybe.
 

westaust55

Moderator
I believe what Dippy was alluding to in post 2 is that the diode to the right of the transistor will block current flow when in output mode.

I can understand you want some universal Input and Output modules but might suggest that providing these as two separate circuits could be beneficial.
Your schematics only allow an input switch device to be between +5V and the input. What if your "trigger"/input device has an output switch that is to ground (0V)?

Would a module with a circuit as per the attached be more universal?
Then for your own schematic delete the switch and diode to left of the transistor and the pull down resistor and use it purely as an output module.
You could always have an IO module with say 2 inputs and 2 or 3 outputs on a single PCB where your club members can jumper across to which ever part they needed.
 

Attachments

WeeLittleMike

New Member
Thank you all for your responses.

First off, it was asked to demonstrate a scenario for the circuit. One example would be to have a mat switch working off of the 5v input power. When the mat switch closes, a program starts which will flash lights hooked up to an SSR, Pulse a fog machine through an SSR and start a sound chip either directly or through an SSR.

Another scenario would be to use multiple break beam switches to regulate the amount of action a prop has. If the beams are set vertically, then when a tall person (adult) goes through, a prop would move, scream, light up and produce fog. When a shorter person (child) passes the beams, perhaps the prop does not move, the sound is less scary, less intense lights come on and no fog. The outputs would be run through SSRs and the switches would run off of the main supply voltage (5V).

Right now, I2C is way beyond me and the people I'm trying to cater to usually make static props because they are scared to burn their houses down with electronics. Pretty much, I will be working with 5V -12V and it will be simple switches and generally SSRs or LEDs.

The circuit I made was an attempt to mash together the switch circuit and the relay circuit from the Picaxe manual.
 

WeeLittleMike

New Member
Thanks for the schematic westaust55! I think I have your schematic figured out, but is H3 needed or was that just a way to transition to the Picaxe circuit? I first looked at it and thought that everything was on the same board, but then I thought that perhaps you were making the resistor circuit with H1&H2 on one board and using a cable to connect that to the Picaxe board. If I am reading it right, then I would create a mini input circuit and then circuits for various output types and connect them all through a cable to the main board.?.?
 

westaust55

Moderator
Thanks for the schematic westaust55! I think I have your schematic figured out, but is H3 needed or was that just a way to transition to the Picaxe circuit? I first looked at it and thought that everything was on the same board, but then I thought that perhaps you were making the resistor circuit with H1&H2 on one board and using a cable to connect that to the Picaxe board. If I am reading it right, then I would create a mini input circuit and then circuits for various output types and connect them all through a cable to the main board.?.?
If you want a totally independent input module board then yes, H3 is the means of connection to your PICAXE board.
If the PICAXE, the two resistors and the header H2 are all on one board then H3 is not required as a physical header - then consider it just an interface point.
AT H2 you just use a standard header plug similar to those used on PC mother boards to bridge two pins (or not) as required to suit the incoming signal.
 

SAborn

Senior Member
As Westaust55 has suggested the best way would be to have the picaxe set up as a basic I/O mother board with all the I/O pins connected to header pins on the mother board along with 5v and ground (3 pin header for each I/O pin) then have all your add on circuits built on sister boards that simply plug/connect to the 3 pin headers as needed, this way if you want a mat switch you just add the sister board for that application, if a IR beam is required you add a IR beam sister board, etc, this way it becomes a plug and play system making it very simple for anyone to add or subtract different modules (sister boards) to create any effect that is required, it also keeps everything the same for each group member allowing them to teach each other.
This way much of the code needed for the sister boards will often be almost the same, and allow a lot of cut and paste of sections of code with a few tweaks to suit the application.

I done this method for a data logger system that allowed simple circuit changes to be made by just adding a sister board to suit the input requirement, it was far easier to just design several small circuit boards to suit each sister board requirement, than it was to redesign the whole main circuit board each time different application was needed.

One thing i do when making a general board design is to always reserve the I2C pins unless i absolutely need to use them, because there is often times later you can make use of I2C on a board and to simply have a connection point can save a lot of time redesigning a new board to suit, i know you said I2C was beyond your present skills, but you will soon find it easy once you need to use it.
Things like needing to add a RTC will need I2C, and huge range of other devices.
On the board below I2C is the 4 pin white headers in the middle.
I used double row headers for strength in mounting of the sister boards, and also a second header not connected to anything for extra support as they are only cost a few cents.


001 small.jpg003 small.jpg
 

hippy

Ex-Staff (retired)
the people I'm trying to cater to usually make static props because they are scared to burn their houses down with electronics.
For your target market it might be best to have separate inputs and outputs. Worrying about a house burning down is quite natural, so why add additional worry that they may have not configured the device correctly ?

If you want to appeal to those who are understandably cautious it is better to make things as simple and as easy as possible with no configuration needed or to be fretted over.
 

boriz

Senior Member
Yep. And it doesn't get much simpler and robust than this.

Even people with no electronics experience can figure out a relay.
 

WeeLittleMike

New Member
Thanks everyone. I think I will go with the modular design. I appreciate you taking the time to help me define exactly what I needed.
 
Top