Big project for a novice. Many questions :/

Hi Guys!

I am kinda new to arduino programming, soldering, electronics and stuff.
I have knowledge in PC programming and I have taken classes for basic electronics, binary logic and had some practice with ICs and simple circuits on a breadboard. My native language is not English.

I am planning to work on a project for university that will involve lots of arduino programming and a ton of inputs and outputs.
However I need to know if the project is doable first before signing up for it. It will be a kind of proof of concept project and won't be used in a real life situation.
I need around 40 inputs and 20 outputs and the ability to add more inputs and outputs if needed without big changes to the code. I have read some examples from the arduino site and I plan on using shift registers by daisy chaining them. Since I will need to show that the number of inputs and outputs can be expanded I am thinking of creating some boards that contain 2 chained shift registers and some headers to allow the boards to be chained with one another (like modules). I plan on using perfboard.

What I have:
I have a soldering iron, a small and a medium sized breadboards, an arduino and some jumper cables.
I have also purchased a second atmega323p-pu chip and additional components to assemble an arduino-like device (without the usb interface). I have 6 CD4021BE parallel to serial shift registers and 6 74HC595 serial to parallel shift registers and have played around with them for a while on the breadboard. I also have a bunch of resistors and leds and can easily buy more from a nearby electronics store.

What I have done so far:
I have successfully assembled an arduino clone on a breadboard and uploaded the bootloader to the chip. I am able to program it with the other real arduino. I have also played around with the shift registers on a breadboard in order to understand the ShiftIn and ShiftOut examples and I am fairly confidant at this point that I understand them.

I have no experience or knowledge how to design circuits on a perfboard and in general. I played around with a free software named BlackBoard and have created 3 designs (with some adjustments in MS Paint) for the two modules with the registers and a design for an arduino on a perfboard. I am trying to make them as small as possible to lower the costs for solder and perfboard.

The headers will be female (but there was no female header image in the software).
The red lines will be solder on the bottom part of the perfboard,
The blue lines will be wires on the top side of the perfboard.
The right module is the one for output using the 74HC595 chips and the left module is for the input using the HC4021BE chips.
They have 8 header pins per chip for input or output, 2 sets of +5V and GND headers and 2 sets of 3 pin headers for the clock,data and latch signals. The idea is to create more than one of the modules and to chain the top 3 pins of one module to the bottom 3 pins of the second module and connect the top 3 pins of the second module to the arduino.

My concerns are:
Do I have some mistakes in the designs that will prevent them from working or create problems?
Can I power the modules with a different 5V power source?
Should I have resistors connected to ground on the input pins of the right module?
How fast can I reliably make the arduino read 40(ish) inputs from the registers and write 20(ish) to the other registers? (approximately in milliseconds. I am concerned that it will start to take way too much time if I expand the number of inputs and outputs so I need to know what are the limits).

Suggestions and criticism is well appreciated.
Thanks for reading my long topic

arduino_small_perfboard.png

modules.PNG

Welcome.

What are those inputs/outputs for?

fakebutt:
What I have done so far:
I have successfully assembled an arduino clone on a breadboard and uploaded the bootloader to the chip. I am able to program it with the other real arduino. I have also played around with the shift registers on a breadboard in order to understand the ShiftIn and ShiftOut examples and I am fairly confidant at this point that I understand them.

That's a great step for a novice.

fakebutt:
My concerns are:
Can I power the modules with a different 5V power source?

What do you mean, using for example a 5V battery? Or each module having its own 5V source?

fakebutt:
Should I have resistors connected to ground on the input pins of the right module?

Only if you want to pull-down the input, but if the received signal is digital 0-5 V pull-down is not neccesary (someone correct me if I'm wrong).

fakebutt:
How fast can I reliably make the arduino read 40(ish) inputs from the registers and write 20(ish) to the other registers? (approximately in milliseconds. I am concerned that it will start to take way too much time if I expand the number of inputs and outputs so I need to know what are the limits).

I don't know but taking a guess I'd say is much faster than you think. I'd to research how many time cycles do shiftIn and shiftOut take, but at 16mhz I doubt it takes millis, I'd say micros. They are very simple digital IC and can be switched really fast with no delays (look for datasheet for more details).

Hi mart256,

The project is to make an elevator controller. It won't be used in an actual real life situation and I am thinking of creating an elevator simulator that the controller can control. I have started working on a simulator in processing and can make it send the data via USB to my arduino (not the breadboard one) so I will probably use the same combination of shift registers to output the data from the simulator and to read the control signals from the controller. However this is not important now. The simulator is the easy part and I will work on it after I am confident that the controller part can be done.

About the power source. When I was playing around with motors and motor drivers I needed to use a different power source for driving the motors and I am wondering if I can hook the input/output modules directly to the +5V and GND of the arduino or if I should have a separate power source for the modules (one power source for all of them, not one for each one).

Thank you very much for the quick and informative answers!

fakebutt:
I am wondering if I can hook the input/output modules directly to the +5V and GND of the arduino or if I should have a separate power source for the modules (one power source for all of them, not one for each one).

As you have so many I/O lines I think you should use a separate power supply because overloading the Arduino 5v pin can cause some very-hard-to-debug problems - particularly if it is intermittent overloading

There is no reason for not having a separate power supply for each board - just make sure everything shares a common GND.

...R

Hi fakebutt,

Your perfboard designs need some improvements, I think, if they will be part of an assignment. I think your tutors will also expect you to create schematic diagrams and show these before the perfboard designs in the report.

Both schematic and perfboard diagrams should have each component labelled with its part number or value. ICs should have pin 1 labelled.

All connectors should also be given labels/names, and pin 1 should be indicated. Each pin within each connector should be numbered and described in a small table next to the picture.

The small perfboard may be too small. The components seem to overlap in the picture and I think they will not fit in reality either. The clock crystal image seems much too small. There will not be enough room, even with the correct tools, to insert or extract the mega328.

The large perfboard I cannot understand at all because nothing is labelled, and neither will your tutors!

You may get extra marks by designing some pcb layouts. The two most commonly used around here are Eagle and Fritzing, so you can get lots of help learning those. Both are free.

Another design approach for you to consider: you are not making use of many of the mega328's pins. These can of course be either input or output and there may be enough pins for a simple "elevator" design without expansion boards. For expansion, you could use pcf8754 chips. That way, the same design could be used for boards for either 8 inputs or 8 outputs or a mix of both. Also, only 2 connections (plus 5V and ground) would be needed, because these chips use the i2c bus. Each expansion board would need 3 links to allow an address to be set so that the mega328 can identify each board separately. Up to 8 of these expansion boards could be added, plus the other available mega328 pins.

Hope this helps.

Paul

Robin,

Thank you. That was mine concern. I will make sure that all the ground is shared.

Paul,

This was very helpful. I know there are some rules in designing pcbs and if I am going to use them in the project I will definitely learn how to use the proper software and label them. I fear you are also right about the crystal not fitting. The other elements overlap but I am not entirely sure that they are the same size on the pictures as in real life. I have ordered some perfboard online and will have to check with the actual components once it arrives.

I will put some labels on the designs and will reupload them when I have some free time.

Thanks!

While putting labels I found a mistake in one so I'll have to redo it.
Here is the input module with labels.

Tomorrow I will start reading some tutorials for Eagle and will watch some videos so hopefully I will be using it soon.

I have seen a site where they suggested an I2C chip for expanding inputs and outputs but I don't have any knowledge about I2C and also I was not able to find the chip from the example and this pcf8754 chip (which may be the same) in my local store for electronics. It may be possible to order it but the CD4021 and 74HC595 were already available there.

I am going to use the rest of the IO pins on chip. I have a rough sketch of the simulator and what it is going to simulate and I am basing my input/output number on that. Some of the signals will go directly to the chip. I have seen that you can use interrupts with Arduino and I may try that for some of the more important signals.

I am pretty sure that an arduino can be made to work as a elevator controller. A friend of mine made one with a twido which is I guess more capable (from looking at the price difference) but is a real pain to program with the ladder logic.

You might want to look at a free program called DIYLC for laying out components on perf board.

...R

Thanks Robin2 for the suggestion. I've used http://blackboard.serverpool.org/ for perfboard layouts in the past, and it seemed pretty good, but now I have another one to try. :slight_smile:

tylernt:
Thanks Robin2 for the suggestion. I've used http://blackboard.serverpool.org/ for perfboard layouts in the past, and it seemed pretty good, but now I have another one to try. :slight_smile:

From a very brief look at that link I suspect Blackboard is about 4 orders of magnitude more powerful. DIYLC is basically just a graphics package that makes it easier to plan a perfboard project than painting coloured lines on a spreadsheet. What I liked about DIYLC was that it had virtually zero learning curve.

...R