e-techgarage.com — Larry's Workbench
Archive for the "Uncategorized" Category

Using the Small Single Board Computer (SBC) – Part 4

Implementation Project

When I showed my idea to my friend Kevin he immediately thought of an application in his home for the MiniSBC – control his sprinkler system.  His current controller has the following characteristics:

  1. Controls up to 12 zones
  2. Has one minute resolution
  3. Only one zone at a time may be activated
  4. No communication method
Using an embedded device to control a sprinkler.

Using an embedded device to control a sprinkler.

His home currently only uses eight of the 12 available zones so the MiniSBC is able to handle his requirements.  The programming is completely under our control so we can activate as many zones in parallel as we want – limited only by our power supply.  We can choose the RCM we want based on the communication technology we want to employ.  In this case he wanted to use Wi-Fi so we used the RCM5400W.

In order to allow for local control of the system an LCD is interfaced via one of the two RS232 ports.  The 4 x 20 character LCD we selected is from Matrix Orbital and is connected to the MiniSBC via one of its two RS232 ports.  In addition, a small printed circuit board was developed to allow for operator input.  This is a very simple board (see schematic 4) which has three LEDs (driven by LCD outputs), a five position joy stick switch and three push button switches.  A basic menu system was developed which enables the operator to enter and modify a watering schedule.  Some of the basic features of the Menu are:

  • Enter the current date and time
  • View the stored watering schedule
  • Create and modify the schedule
    • Resolution is 1 minute
    • Any combination of zones may be activated
    • Once the schedule for a day is entered it can be copied to other days
  • Store the schedule in flash

A Relay Board was initially developed to switch the control voltage to the sprinkler solenoids, see Schematic 5.  The board contains essentially only two circuits: 5V switching power supply and eight relays.  It is designed to use a “wall wart” (from a Rabbit product) which has two 24VAC secondaries at 800ma each.  The relays have 5VDC coils and are driven directly by the open drain outputs of the MiniSBC.

There are four connectors on the board:

  • 6 pin socket for power
  • 3 pin header to supply +5V to the MiniSBC
  • 10 pin socket which mates to the output header of the MiniSBC
  • 12 point screw terminal for connections to the sprinkler solenoids

The board is designed such that the output pin header of the MiniSBC can plug directly into the input socket of the relay board.  This allows for stacking the two boards without requiring a cable.  Since the RCM plugs directly onto the MiniSBC this yields a fairly small package with three stacked printed circuit boards.  The dimensions, in inches, are: 3.5 x 2.25 x 1.5.

Sprinkler_Chassis

The MiniSBC can be seen inside with a Wi-Fi RCM5400W inserted.

I decided to use a switching regulator on this board because I wanted higher efficiency than a series regulator would offer.  The RCM5400W draws about 600ma at 3.3V when transmitting.  That is almost two watts.  The LM2576 has about 85% efficiency which means that it will dissipate about 0.3 watts.  This means that no heatsink is required so I simply soldered the TO220 case to a copper pour.  If I had used a series regulator it would have had to dissipate over 14 watts (based on having a 24VAC input) between the regulator IC and a series resistor.  In this case the additional complexity is well worth the effort!

As it turned out, this board was not successful in switching the solenoids.  It took only a few on-off cycles to cause the relays contacts to fuse!  The relays are rated at 200VAC and 0.5 amps so I am a bit puzzled as to why they did not work.  I installed an R-C suppression network on each output to see if that would help but it did not.  All I can think of is that there must be quite a surge current when first applying the 24VAC to the solenoid through the relay contact.

I then decided to design a Triac based board, see schematic 6.  The Triacs I selected are the same ones as are in the original controller that Kevin has.  They are “Sensitive Gate” devices and work in all four quadrants.  They are rated at 600VAC and 4amps with a guaranteed maximum IGT of 5ma.

You can see from the schematic that the power supply is identical to that of the relay board as are the input and output connectors.  The 74HCT540 is needed to invert the signal coming from the MiniSBC board which has normally off, open drain outputs.  As such, the output voltage is normally high which would cause the Triacs to turn on.

The outputs of the Triac circuits switch essentially opposite to those of the Relay Board.  The Relay Board is a “high side” switch in that the solenoids are connected between the relay outputs and ground.  The relays connect 24VAC to one side of the solenoids which would turn them on.  The Triacs are a “low side” switches in that the solenoids are connected between 24VAC and the Triac which completes the circuit to ground when turned on.

The size of the Triac board is same as the Relay Board and the connectors are in exactly the same places.  This allows the MiniSBC to use either one interchangeably.  Even though the Relay board did not work out in this application there are many applications where it would be a better solution.  One of which is that it can switch both AC and DC while the Triac Board can only switch AC.

Creating a Small Single Board Computer (SBC) – Part 3

The Third Revision with A/D:

The third, and final, board in this series (see schematic 3 and Fig. 3) adds the ability to use the A/D convertor which is present on several of the Rabbit 4xxx Core Modules.  This board needed some more room for the analog input circuit and connector so it is a little bit wider than the RCM41xx.  However, it can still be implemented with a two sided board.

Much more going on here.

Much more going on here.

The A/D on the RCM4xxx devices is the ADS7870 from TI.  It has 11/12 bits of resolution, eight inputs and a Programmable Gain Amplifier.  The inputs can be used in a single ended configuration or they can be paired to measure differential voltages.  All the voltages applied to the input of the ADS7870 must be positive so if you need to measure negative voltages you will need to implement some external circuitry.

The input circuit is a voltage divider that allows for an input range of 0 to +10 volts.  This input range can very easily be changed by modifying either or both of the input divider resistors as required.  The ADS7870 allows you the choice of any of these three voltage reference values: 1.15, 2.048 or 2.5V.  The schematic shows the divider with 100K and 33.3K resistors.  This provides a voltage division of four, so with a reference of 2.5V you will get a 0 to 10V range.  These same resistors will also allow a full scale input of 4.60V if the 1.15V reference is selected.  You can customize these resistor values on a per input basis if your application has different ranges to measure.

Notice that the sequence of the inputs on the connector is not channel 0, 1, 2…  I did this in order to make routing the traces easier.  If having the connector pins and the channels sequence together is important to you then you will need to do some rerouting.  I basically made an engineering decision that it was not important enough to be concerned about.

Another “feature” of this particular implementation is that it can easily be built to make use of eight additional parallel I/O lines on those RCMs that do not have the A/D.  For those RCMs Parallel Port D is available on the pins that would otherwise have the A/D inputs on them.  You will have to exercise some additional caution if you decide to make use of this feature.

When using a pin as an input you have several options and one limitation.  The options deal with how you use the voltage divider circuit on each of the eight pins.  If you leave the resistors as they are defined on the schematic then you will be able to sense digital inputs of 13.2V (4 x 3.3V).  You can adjust the ratio of the resistors to meet whatever input voltage range you require – just remember that the trip point of the typical CMOS circuit is typically VDD/2.   Whatever you choose you should always have a resistor from the input pin of the Rabbit to ground (or power) so that the input is not left floating.

The limitation is, since there are no clamp diodes, you need to insure that the voltage applied to the Rabbit I/O pin does not exceed 3.3 volts.

To use a pin as an output you will probably want to use a zero ohm jumper in place of the series resistor if you are going to use the CMOS signal directly.  Or, if you want to drive a transistor, you may want to put in a current limiting resistor whose value is determined by the circuit it is driving.  You should be aware that the maximum current per output pin is 8ma sinking or sourcing.

Something to keep in mind if you decide to use this feature is that the Port D pins can be individually configured as either input or output.  This allows you to easily extend the functionality of the board without redesigning the PCB.

A Few Conclusions

  • It was fun finding out that it is not very difficult to develop a minimal function SBC
  • It did not take very long – the initial design and layout took about 4 hours
  • The result is a small, useful and inexpensive (two board) SBC.
Third Schematic (Click for high resolution)

Third Schematic (Click for high resolution)

Creating a Small Single Board Computer (SBC) – Part 2

layout_v2

Notice the RS232 chip added on the lower left side

Adding RS-232:

For many applications the board described in the previous article will be adequate.  If you need to communicate with the SBC you can easily use one of the Ethernet or RF enabled Rabbit Core Modules instead of the RCM41xx.

However, there are many cases where RS232 connectivity is required.  The second board design, see schematic 2 and Fig. 2, adds a dual RS232 to CMOS convertor.  This circuit can be used as two independent 3-wire circuits or a single 5-wire circuit.  The board is the same size as the board described above and can still be implemented with two layers.

There is one additional 5 pin header for the RS232 I/O.  There are quite a few dual channel convertors available so I just picked the one that is typically used by Rabbit.  It is relatively inexpensive and easy to implement.  All it needs are the four external 0.1uf capacitors.

Updated Schematic (Click for high resolution)

Updated Schematic (Click for high resolution)

Creating a Small Single Board Computer (SBC) – Part 1

One weekend afternoon I was wondering how much real estate a small SBC compatible with an RCM4xxx would take.  Since my main hobby is designing and building electronic circuits I sat down with my favorite schematic capture program (DipTrace) and proceeded to draw a minimal function SBC.  Now, I suppose the design I developed is not a “true” SBC since it uses a Rabbit Core Module but Rabbit has been doing the same thing for years.
The process of designing an SBC has to start with asking the questions “What should it do?” and “What are the constraints and/or design criteria?”  I wanted the board to be as small as the RCM41xx but still have a useful complement of I/O.  My initial decision has eight current sinking outputs and eight digital inputs.  The results are shown in schematic 1.  The picture below is very close to full size.  Notice that it is slightly larger than the RCM4100.  I was not able to quite make things fit the way I wanted and still keep it the same size as the RCM41xx.  The pull-down resistors on the input circuit caused me to exceed the size of the RCM by aboutOne weekend afternoon I was wondering how much real estate a small SBC compatible with an RCM4xxx would take.  Since my main hobby is designing and building electronic circuits I sat down with my favorite schematic capture program (DipTrace) and proceeded to draw a minimal function SBC.  Now, I suppose the design I developed is not a “true” SBC since it uses a Rabbit Core Module but Rabbit has been doing the same thing for years.
That is a pretty tiny computer!

That is a pretty tiny computer!

The process of designing an SBC has to start with asking the questions “What should it do?” and “What are the constraints and/or design criteria?”  I wanted the board to be as small as the RCM41xx but still have a useful complement of I/O.  My initial design has eight current sinking outputs and eight digital inputs.  The results are shown in schematic 1.  The picture below (the photograph is of my second version which allows the use of the A/D converter on the RCM4100) is very close to full size.  Notice that it is slightly larger than the RCM4100.  I was not able to quite make things fit the way I wanted and still keep it the same size as the RCM41xx.  The pull-down resistors on the input circuit caused me to exceed the size of the RCM by about 0.1”.

I elected to use FDV303 FETs for the open drain outputs.  These devices can sink up to 200ma, have a breakdown of 25V and an on resistance of 0.6 ohms at VGS=2.7V.  They provide adequate features for many real world applications.  Another possible FET is the 2N7002.  It has a higher breakdown voltage at 60V but has a higher “ON” resistance.  Both devices can be obtained for the same cost and in the same package.  If you do decide to use the 2N7002 because you need a higher voltage you will also have to change the clamp diodes since the BAT54 is rated at 30V.  Each FET has a pull down resistor (100K) on its gate to insure that it is never floating.  One of the features of the Rabbit processor is that when it comes out of reset any I/O bit which can be an input will be set as an input.  Without the presence of the resistor this condition would leave the gates floating.

Digital Output Circuit

One of the Digital Outputs

“Back EMF” is generated when an inductive load (such as a relay coil) is turned off.  This voltage will appear at the device doing the switching (the junction of Q1, D1 and K1 above) and can easily be double the voltage supplied to the inductor.  A diode on the output clamps the voltage to that of the power supply.  You can see in the schematics that the cathodes of all the clamp diodes are tied together.  This point should be connected to the highest voltage power supply that is used for the loads.
0.1”.
A small board layout for the Rabbit 4000 family

The Board Layout

The digital input circuits simply provide current limiting via the series resistors and the clamp diodes.  The diodes are needed because the Rabbit 4000 does not have internal clamps.  These two diodes prevent the voltage applied to the Rabbit from exceeding the maximum allowed input voltage and from going below ground.  I chose high speed diodes in order to prevent high frequency spikes from reaching the processor’s inputs.  The series resistor will limit the current to about 10ma with 50V applied.  The trip point of the circuit will still be close to VDD/2.  The resistors from each input to ground keep the inputs from floating when no signal is applied.

The layout of the board is fairly simple and can be done with two layers – see Fig. 1.  The circuit uses single row, right angle headers for all I/O connections.  I chose these for two reasons:

  1. Cost – they are quite inexpensive
  2. Low profile – required since the Core Module sits on top

I decided to use a linear regulator to minimize cost and board space.  A switching regulator would certainly be more efficient but would cost more and take up more room.  The power input connector is a three pin header of the same type as the I/O headers.  I added a series diode to protect against reverse voltage.  This adds a small cost but I feel is well worth it.  The same is true for the power indicating LED – not necessary but probably a good idea.

Ready to go in the palm of my hand.

Ready to go in the palm of my hand.

The total Bill of Materials cost, in high volume, I estimate to be about $5 – excluding the RCM4xxx.

Schematic 1

Schematic_1

Full Schematic

Pictures

Just in case some of you are interested I am posting a few pictures of my garage at home, most of which I have turned into my workshop.

Main operating location for my computer and Ham Radio

Main operating location for my computer and Ham Radio - an ICOM 728. I operate mostly PSK31.

Just to the right showing more stuff.  The radio is an ICOM R7000 and receives from 25 to 2000MHz.

Just to the right showing more stuff. The radio is an ICOM R7000 and receives from 25 to 2000MHz.

My workbench showing the Tek 465 'scope I repaired.

My workbench showing the Tek 465 'scope I repaired.

More of my workbench showing tools and, on the shelf, several of the projects which became magazine articles.

More of my workbench showing tools and, on the shelf, several of the projects which became magazine articles.