Starter Shields for Arduino

Have you ever wanted to create your own shield in EAGLE?

Sure, there are lots of tutorials about doing a schematic and layout in EAGLE,

But what about placing the connectors to mate with the Arduino?

Those connectors need to be place precisely, perhaps more stress than you want?

 

Fear no more!

The Circuitsville Shield Starters answer the problem.

 

Find out more here:  Arduino Starter Shields at Circuitsville

Presently there are Starter Shields packs for Arduino Uno and Arduino Mega.

More will be coming soon.

Do you have any suggestions which shield to do next?

 

Posted in Technology | 1 Comment

An Idea for Arduino – Shield Starters

I have done many Arduino projects for customers, most often as shields for Arduino Mega,  Arduino Due, Arduino Yun or Arduino Duemilanove.  I always make a file with just the basic circuit, the connectors and a few necessary parts, and the layout.

Schematic for Arduino Mega Shield Starter

Schematic for Arduino Mega Shield Starter

The layout is the most serious because I have to get the connector positions correct.  Usually I put a mechanical Drawing as a schematic page,  this can give you an idea of the complexity of doing the initial layout.

Arduino Mega Shield Mechanical Drawing

Arduino Mega Shield Mechanical Drawing

The real challenge is mating the shield to the Arduino.  Not only do the connectors have to line up but you also have to be careful not to place parts on the back of the board that could be shorted out. Any movement in the connector position will cause the shield will not mate with the Arduino.  In addition the mounting holes need to line up with the mounting holes on the Arduino.  You might want to tie all of the boards together even if you are not putting a bolt through a wall to hang the system on.

Once everything is positioned on the layout it looks like this:

Arduino Mega Shield Layout Starter

Arduino Mega Shield Layout Starter

This layout is done in EAGLE 6.4, it should be compatible with newer versions of EAGLE. I change the colors to make the layers more visible for myself.  Typically the green is the top silkscreen layer and the yellow is the bottom silkscreen. That is why the yellow text is backwards, on the finished board it would be correct if you turned the board over.  The purple is the “Dimension” layer which is the board edge or mounting hole edge.

The bluish area notes a bottom layer keepout area. A keepout area will generate a Design Rule Check (DRC) error if you place a part on the back in that space. Traces can be run through this space because there is enough clearance between the connector and the board.

When I start a project I simply save one of these starters under a new project directory and as a new file name.  Once I have connected the circuit elements on the shield to the connectors, either directly or by name, they will show up on the layout to be placed.  I have to be careful not to accidentally move the connector, that could be a disaster.

But I can increase the board outline size. The present board outline size matches that of the particular Arduino it is made for.  In this example it is the Arduino Mega.  You can also decrease the board outline size but be careful not to move the connectors or the mounting holes.

It took me about 8 hours to create the original versions of these, the two schematics and the layout.

Now Gentle Reader, my questions for you are:

Could these help you in your shield development?

What might it be worth to you to purchase them somewhere to download to your copy of EAGLE and begin your own layout?

$50?  $20? $10

Please let me know.

Thanks!

Posted in Technology | Leave a comment

2014 in review

The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

A San Francisco cable car holds 60 people. This blog was viewed about 560 times in 2014. If it were a cable car, it would take about 9 trips to carry that many people.

Click here to see the complete report.

Posted in Technology | Leave a comment

The Facts of Life, at least about Circuit Boards

Over the years that I have been doing board layouts the biggest surprise to customers seems to be the cost of raw circuit boards.  Often everything else is going well. The cost of the parts is not a problem, but for some reason the cost of boards comes as a shock.  Below is a short study, done in late September 2014, of the cost and vendors creating circuit boards.

The cost of circuit boards is related to the size.  Size is usually referred to in square inches. The least expensive board fab is provided by OSH Park (https://oshpark.com/). They charge $5 per square inch {or any fraction thereof} for a 2-layer circuit board.  Actually the charge works out to $1.67 per square inch because you get three boards for your order. For example a circuit board 2 inches by 2.6 inches would be 5.2 square inches or a charge of $30 because of the extra 0.2 square inch.  For a 4-layer board the charge $10 per square inch or actually $3.33 since you get 3 boards when you order 1.  The absolute lowest price is $1.00 per square inch BUT you have to purchase a board of at least 150 square inches. (Thus the total charge is at least $150.)

The other price extreme is PCB Express by Sunstone Circuits. (http://quoting.sunstone.com/quoteexpress.aspx) for a 2-layer board the cost is $69.575 per square inch.  A 4-layer board is $105 per square inch.

In delivery time the situation is reversed.  Yes, OSH Park has the lowest rates I have found but the delivery time is quoted as “12 business days” which would be 16 calendar days, over two weeks.  PCB Express costs more but you get the board in 2 days for a 2 layer and 5 days for a 4 or 6 layer.

There are other distinctions besides cost and delivery time.  OSH Park will make only 2 or 4 layer boards.  PCB Express will make up to at least a 6 layer board and the rest of Sunstone Circuits have other options for even more layers. These options are less expensive but take more time. 

OSH Park works well with output from the EAGLE PCB Design Software but won’t work well with OrCAD/Allegro.  PCB Express and Sunstone work with all PCB Design Software systems.

 The bottom line to all of this is that time is money, or money can buy you time.  There are other board vendors besides OSH Park and Sunstone Circuits. In my experience most of their quotes have fallen between the extremes listed above. All of the vendors I have worked with produce boards of high quality. So much so that quality is not really considered a competitive advantage. (Low quality would be considered a competitive disadvantage.) And for all vendors, more layers and/or larger boards is a higher expense.

Posted in Technology | Leave a comment

Your remote control: An IR Communications System

This started a couple of years ago. I tried the parts and they didn’t seem to work so I put them on the shelf. This year a client came to me with a project and I got them back down to try to make them work. The two parts are the TSAL7200 which is an Infrared LED and the TSOP4840 which is an Infrared (IR) Receiver for Remote Control Systems. Since the LED looks a lot like other LEDs I figured I would just drive it that way. The Red LED is to show that the button was pushed and something should be coming out.

SimpleWand

This would be simple, right? Well, it didn’t work. So I looked at the LED data sheet and found nothing useful. Then I began to examine the IR Receiver data sheet and started finding lots of information. First, the part number of the TSOP48xx is set up so that the xx is the carrier frequency in kilo Hertz. In communications systems they reduce the bandwidth to reduce the noise added to the system and boost the size of the signal with relation to the noise (The Signal to Noise ratio or S/N ratio.)

TypicalCharacteristics
Okay, that makes sense so I will get a 555 timer and set it to a 40 kHz square wave output. That was what it showed in the “Typical characteristics”. That is a period of 25 microseconds which should be no problem. Except it still didn’t work. So I read the TSOP data sheet further and find the test figure.

OpticalTestFig
I have to turn the pulses off periodically to get that to work. Still no problem, I will just add another 555 to my circuit to kill the output on a regular basis.

WandW555

But that doesn’t work either? What is going on here? I finally stumble on the most useful bit of information:

PulseDefTable

Oh. This list shows that the pulse setup is too complex for a simple analog solution but would be easy for a microcontroller. For the final product I will use a Microchip PIC10F206, six pins, four I/O, a small case size that should be perfect. But for now I need to answer the question: “Will it work?” So I grab a small Arduino, connect it up and start writing code. First step is to do a single pulse. That code is a simple function that will get called repeatedly. {FYI here: C defines these as function calls. In ForTran they would be subroutines.} This is pretty simple: Set output pin high, wait, set output pin, low wait. The finished code looks like this:

SingPulFnct

Once I can make a single pulse I then need a pulse burst (a string of several single pulses) and a space “burst”. First, the minimum burst length is ten pulses. But we might want more than that. So put in an IF statement to set a minimum, then put the single pulse in a loop. Thus the following code: (Note to self: No maximum limit stated, I might need that for future products.)

SendBurstFnct

So that is a pulse burst, what about spaces? Back to the Pulse Definition Table.

SendGapFnct

So how about a test? Think Morse code here: a “Dash” is three times as long as a “Dot”. So if a Dot is 11 or 12 pulses then a Dash is 36 pulses. And the gap between Dot and Dot or Dash has to be three times Dot length, so another 36-40 pulses.
LoopFnct
Once all the code is ready, I give it a try.
The Result:

Screen Capture
If you read Morse code you get the punch line: A V for Victory.
The bottom (Channel 1 in Yellow) is the pulse drive to the IR LED.
The top signal (Channel 2 in Blue) is the output of the receiver

Posted in Technology | Leave a comment

Using Heat Sinks

I have used heat dissipation devices or heatsinks at times over most of my career.

Nothing really mysterious about them once you have the basics down.

This got started after a conversation with my friend Mike.

Mike is working on some Arduino projects but his back ground is IT and not electronic hardware. The concepts of working with heat sinks are straight forward and pretty simple.

 

The basic idea is to treat the thermal system as a simple circuit.

Image

 

The power dissipated is treated as a current source. Temperatures are treated as voltages with “ambient” temperature being treated as a voltage source. Between the power or current source and the voltage or temperature source is a series of thermal resistances, often shown as “Rtheta” or R Theta.

 

In the schematic above there are four thermal resistances, each is identified by the nodes it is connected to:

  •        Rthetaja – is the thermal resistance between the semiconductor junction and ambient temperature
  •         Rthetajc – is the thermal resistance between the semiconductor junction and the case or package
  •         Rthetacs – is the thermal resistance between the case or package and the heatsink
  •         Rthetajsa – is the thermal resistance between the heatsink and ambient temperature

 Here is an example:

Consider a system where a 7805 regulator is used to create 5V from 12V.

The load current (current out of the 7805) is 500mA or 0.5A, well within the allowed maximum for the device.

From the data sheet we get the following information:

 Image

The Package for the 7805 is a T0-220 or a 221A package in the table. The junction to ambient thermal resistance is 65 degrees C per Watt (C/W)

The power is the difference between the input voltage of 12 V and the output voltage of 5 V or 7 V, times the current of a half an amp, giving 3.5 Watts of power.

Thus the rise above ambient is 65 [C/W] * 3.5 [W] equals 227.5 degrees.

Ambient temperature is assumed to be 25 degrees Celsius (77 degrees Fahrenheit) so the resulting junction temperature would be 252.5 degrees Celsius.

The maximum allowable junction temperature is 150 degrees C (302F), so this situation is not acceptable.

Now consider a heatsink, for example the Aavid-Thermalloy model 531002B02500G.

Image

This heat sink is designed to be used in either still air or with a fan, also called “airflow”. From the graph the thermal resistance can be as low as 2 degrees C per Watt with a strong fan, but for this example I will use the still air value of 13.4 degrees C/W value.

Image

The package thermal resistance between junction and case is 5 C/W, so the total is 18.4 C/W.

Multiplying the thermal resistance by the power gives a rise of 64 degrees C or a junction temperature of 89 degrees C, which is acceptable.

Now, even though the junction to ambient thermal resistance is shown in parallel with the heatsink in the schematic it is usually ignored when calculating temperature rise with a heatsink.

One thing I haven’t discussed is the thermal resistance between case and heatsink, Rthetacs. This is a necessary item and should not be overlooked. In the simplest form this is something called “thermal grease” and is, like heatsinks, available from most vendors. Thermal grease is officially called “Silicon Oil-Based Thermal Joint Compound” by one vendor, there are variations of this name among other vendors. Like lubricating grease it is a ‘paste’ consistency and often comes in a tube. It has a thermal resistance of 0.5 C/W for a TO-220. In hobby or prototype situations it works well, and tends to be messy. But it is too labor intensive for large scale manufacturing. The option is a thermally conductive, sometimes electrically insulating pad. Pads typically have thermal resistance between 0.3 and 2 C/W. And don’t forget the hardware; bolts, washers, and nuts. These are required to get the optimal thermal contact between the sink and the device.

The last part of this would be to treat this as a design challenge and show how that is done. Using the same example and most of the numbers from above the example is:

  • 3.5W to dissipate,
  • Maximum junction temperature 150 degrees C
  • Ambient temperature 25 degrees C
  • Rthetajc = 5 degrees C/W
  • Rthetacs = 1 degrees C/W

The plan is that we would be loosing 6 [C/W] * 3.5 [W] or 21 degrees C between the junction and the heatsink. (The temperature is 21 degrees C above ambient or above whatever temperature is at the heatsink.)

The allowed temperature difference between 150 and 25 C is 125, less the 21 C lost between the junction and the sink. So that is 104 degrees C.

Dividing that by the power gives the maximum thermal resistance of the heatsink or 104/3.5 or 29.7 degrees C per Watt.

The chosen heatsink meets this criterion, and there are probably others. If there wasn’t a heatsink available below the calculated value we might need to add a fan or some other sort of heat removal strategy.

That is pretty much all there is to using heatsinks.

 

Posted in Technology | Leave a comment

Recent Updates

I have been off doing other things.
Some of my work has been with clients, some has been in some classes in Business Administration that I have taken to run my company better.

The latest effort is back to the Um Counter project.
One thing I have looked at is the cost of doing the project with discrete components as shown or using a microcontroller.
It turns out that using a microcontroller is about 40% less expensive and allows me to add a lot of features.

The down side is I have to flail at things that I have no control over, such as the Arduino software. The biggest problem is that the documentation I have seen for using an SPI bus calls out an spi.h file that doesn’t seem to exist.
But that is okay, I just wrote my own from scratch.

Unfortunately I am getting ahead of myself.
Why would I need to use a 74HC595 serial to parallel shift register?
There are two different microcontrollers used on Arduino boards. (Actually there are three but the ATmega 168 and ATmega 328 are very similar.)
The micro on the Arduino Mega boards is the ATmega 2560.
At first I planned to just use the ATmega2560 because an interim prototype had been built as a shield for an Arduino Mega.
At Digikey, the ATmega2560 is $17.97 in quantities I can use.
The ATmega328 is $3.93 in the same quantities, 4.5 times less expensive.
All I need is additional outputs to run the display, so what else works?
It turns out that the 74HC595 sells for $0.73 which means I could use two of these and still spend less than half of what the ATmega2560 costs.
So if you need more outputs at a low cost the ‘595 does just what I need.

So how do I develop code without having the finished boards?
Use prototype boards!
This will allow me to develop the code to drive the 74HC595 as a function (subroutine for folks with a ForTran background.)
This is the circuit:







To make a long story short here are the code sections:
The Header

/*************************************************************/
/* Sketch to set up a function to send data out an SPI */
/* to a 74HC595 Serial to Parallel Register Chip */
/* BConley Circuitsville Engineering 15 Jan 2012 1617PST */
/* Does NOT Make use of Included Arduino SPI functions */
/* Uses an Arduino Nano 3.0 w/ ATmega 328 */
/* On q proto board */
/*************************************************************/
/* Inputs: */
/* SDATIN on Board, Arduino Nano pin 15, D12, MISO, PB4*/
/* SENS_P5V on Board, Arduino Pin 19, A0 (analog) */
/* SENS_D_P5V on board, Arduino Pin 20, A1 (analog) */
/* Outputs: */
/* SDATOUT on board, Arduino Nano Pin 14, D11, MOSI, PB3*/
/* SCLK on board, Arduino Nano Pin 16, D13, SCK, PB5 */
/* XTRIO_CLR on board, Arduino Nano pin 14, D10, PB2 */
/* OUTCLK on board, Arduino Nano Pin 11, D8, PB0 */
/* Other IO: */
/* Green LED, Arduino Nano Pin 6, D3, PD3 */
/* Red LED, Arduino Nano Pin 7, D4, PD4 */
/*************************************************************/
/* 74HC595 considerations: */
/* MSB is first out, first in */
/* */
/* NOT Use SPI.setBitOrder(MSBFIRST) */
/* Output HIGH turns LED OFF */
/* 74HC595 Has TWO (2) Clocks !!! */
/* Both clock data on the rising clock edge */
/* SCLK clocks data into the register */
/* OUTCLK clocks data into the output register so it is seen*/
/*************************************************************/
/* Pre Set up (Declarations and such) */
/* NOTE: SPI Library does NOT work, so do something else */
/*************************************************************/
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/* 74HC595 Function code section Declares & Defines */
/* Required FUNCTION Stuff-copy & paste into calling routine */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
//int xtraIO_Clr = 10; Not used in this application
int clockPin = 13; /* Define register clock as Arduino D13*/
int dataPin = 11; /* Define serial data out as Arduino D11*/
int outClkPin = 10; /* Define output reg. clock as Arduino D10*/
int sDatInPin = 15; /* Define ser. Data input as Arduino D15*/
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/* End Rqrd FUNCTION Stuff-copy & paste into calling routine */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/

What goes into the SETUP() Function

/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/* 74HC595 Code for the SETUP function */
/* Required FUNCTION Stuff-copy & paste into calling routine */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
// pinMode (xtraIO_Clr,OUTPUT);
pinMode (clockPin,OUTPUT);
pinMode (outClkPin,OUTPUT);
pinMode (dataPin,OUTPUT);
pinMode (sDatInPin,INPUT);
digitalWrite(outClkPin,LOW);
digitalWrite(clockPin,LOW);

// digitalWrite(xtraIO_Clr,LOW); /* this Clears the HC595 */
// digitalWrite(xtraIO_Clr,HIGH);
digitalWrite(outClkPin,HIGH); /* loads the cleared reg into output */
digitalWrite(outClkPin,LOW);
digitalWrite(redOut,HIGH);
digitalWrite(grnOut,HIGH);
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/* End Rqrd FUNCTION Stuff-copy & paste into calling routine */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/



The Function Code

/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/* Required FUNCTION Stuff-copy & paste into calling routine */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/*************************************************************/
/* sendHC595 function */
/* function to send a byte to an 74HC595 serial to parallel*/
/*************************************************************/
void sendHC595(unsigned char Data){
unsigned char SendCnt, BitCnt;
unsigned char DatClk = 0;
// shiftOut(dataPin, clockPin, MSBFIRST, Count);
SendCnt = Data; /* Copy Count into SendCnt*/
while(DatClk0){
digitalWrite(dataPin,HIGH); // If Bit is High, Put out 1
}
else{
digitalWrite(dataPin,LOW); // If Bit is LOW, Put out 0
}
SendCnt = SendCnt << 1; //Shift left one place
delay(100);
digitalWrite(clockPin,HIGH);
delay(100);
DatClk++;
} /* End clocking out, DatClk loop */
DatClk=0;
digitalWrite(outClkPin,HIGH); /* This sequence loads the data out */
delay(100);
digitalWrite(outClkPin,LOW); /* End data out squence */
} /* End sendHC595 function */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/
/* End Rqrd FUNCTION Stuff-copy & paste into calling routine */
/*FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF*/



That wasn’t too hard, was it?

Posted in Engineering, Money, Technology | Leave a comment