Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Networking, Protocols, and Devices / Re: Can the Ethernet Shield work with other SPI devices? on: June 26, 2011, 07:17:20 am

Per my example, I'm using a distinct SS pin (37) for the SCP1000, and a SS pin of 10 for the Ethernet Card. 

I have tried forcing the SS pins of each to HIGH to disable and LOW to enable (although the SCP library sets the SCP to LOW only before reading, and HIGH straight after).

Can someone confirm that the Ethernet shield will play nicely with other SPI devices?  Were library mods needed?

2  Using Arduino / Networking, Protocols, and Devices / Can the Ethernet Shield work with other SPI devices? on: June 25, 2011, 09:47:05 pm

I have a Mega 1280, the latest Ethernet Shield, and an SPI-connected SCP1000 (on a Sparkfun Breakout).  

I am using this library ( to interface with the SCP1000.  I have changed the following to correspond to the mega:
  • const byte DataOutPin = 50;
  • const byte DataInPin = 51;
  • const byte SPIClockPin = 52;

I initialise the SCP1000 with a slave select pin of 37.

The SCP1000 and Ethernet Shield work fine independently.  My research suggests there are/have been problems with the Ethernet Shield co-existing with other SPI devices.

I have tried setting the SS pins of both devices to LOW to enable and HIGH to disable, and
PORTB |=  _BV(4);
to reset the SS on the Ethernet Shield.

My current hacky code is as follows - any ideas?

  Web  Server
 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 created 18 Dec 2009
 by David A. Mellis
 modified 4 Sep 2010
 by Tom Igoe

#include <SPI.h>
#include <Ethernet.h>
#include <SCP1000.h>

#define PIN_BAROM_CSB     37 //also referred to as Slave Select
#define PIN_ETHER_SS     10 //also referred to as Slave Select

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,0, 16 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);
SCP1000 scp1000(PIN_BAROM_CSB);

void setup()
  // start the Ethernet connection and the server:
  digitalWrite(PIN_ETHER_SS, HIGH);
  digitalWrite(PIN_BAROM_CSB, LOW);

  digitalWrite(PIN_BAROM_CSB, HIGH);
  digitalWrite(PIN_ETHER_SS, LOW);
  Ethernet.begin(mac, ip);

void loop()
  // listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c =;
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");

//  client.print("Temprature (C/F): ");
//  client.print(scp1000.TempC);
//  client.print(" / ");
//  client.println( (1.8*scp1000.TempC + 32) );
//  client.print("Pressure (hPa): ");
//  client.println(scp1000.BaroP);
//  client.println();
//  client.println();
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(" is ");
            client.println("<br />");
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
    // give the web browser time to receive the data
    // close the connection:
3  Using Arduino / General Electronics / Re: PCB Grounding and Power Tracking Questions on: February 05, 2011, 06:54:51 pm
Thanks Mike, that all makes sense. 

For anyone else with similar questions, the Atmel paper Udo linked is very useful, as is reading relevant parts of the Art of Electronics and the Circuit Designer's Companion.
4  Using Arduino / General Electronics / Re: PCB Grounding and Power Tracking Questions on: February 04, 2011, 11:56:56 am
You may want to read Atmel application notes AVR-040 EMC design considerations and AVR-042 Hardware Design considerations. Of course they apply to Arduino. They might answer more questions than you stated smiley-wink You can download them from Atmel's website for free.


Thanks Udo,

That looks pretty good.  Will read through tomorrow.

5  Using Arduino / General Electronics / PCB Grounding and Power Tracking Questions on: February 04, 2011, 08:31:40 am

I have been reading up on grounding and power tracking in PCB design, and want to put a few dumb questions that I'm not sure on yet...

My questions are in context of relatively low DC voltages/current on a 2-sided PCB (say, 15V@3A max), connected with an arduino to supplying it with voltage and break out pins to connectors, with no radio or high-speed comms.

If I have a circuit that includes a DC supply and a Battery (with IC-controlled charging and powerpath control), their 0V/Ground terminals should/must be connected, right?  I've been confused by talk of 'isolation', which I assume refers to using mosfets, diodes, etc to ensure their positive voltages are isolated. 

I've also seen reference to 'separate power supply returns' (i.e. 0V).  In a low voltage/current circuit as referred to above, is this needed for on-board step-down regulators, battery ground, etc?  Does it mean having a star topology to a common point, or is just having a ground plane on each layer of the PCB, with these connected at the nearest point OK?

While I get the basic concept of ground loops, I'm confused about it within a circuit.  Taking an arduino shield as an example, if I connected the shield to more than one arduino ground pin, would that potentially cause a loop?  Looking at the ethernet shield, it appears to do this. 

Also, how 'bad' is it to use vias to join ground planes together?  I'm trying to avoid this when routing, but have a busy PCB and it's doing my head in.

I've seen talk of it being desirable to avoid crossing signal and power tracks.  Is this really going to matter in this context?

Is it advisable to add a small resistor on the 0V DC connections from battery and DC supplies?  I saw this suggested to 'prevent ground current flow'.

Lastly, if using a metal enclosure, or a plastic case with a metal chassis, is it good/bad/indifferent to connect the PCB's ground to the chassis (in one place only)?

Thanks in advance...


6  Using Arduino / LEDs and Multiplexing / ShiftBrite, Mega, Pins, and Ports on: February 02, 2011, 09:40:36 pm

I'm looking to use a Mega with a ShiftBrite in non-SPI mode, per the second example here (with an Ethernet Shield):

But I want to use different pins.

Should I be able to use *ANY* unused  digital pin/port combination for any of the ShiftBrite's pins?  Does it matter if they are on the same port?  I assume they don't need special features like PWM as the communication is low-level.  Is that correct?

I have found these arduino pin/port mapping spreadsheets linked from this forum:


7  Using Arduino / General Electronics / Re: Cheap/Good PCB houses outside China (Chinese New Year) on: January 29, 2011, 05:19:40 am
Is this going to become the most political thread on the board? Maybe there are fab houses in Iran and Egypt we could work into the conversation?
I don't know what that means, (and frankly, I don't care)...
A lame attempt at humour on my part given the direction of the conversation - Egypt is possibly undergoing a revolution, Iran is obviously a 'hot topic'.  Not sure why that got a prickly response. 

For me, the SA ones that looked OK would need me to send designs for a quote, and don't have online pricing.  Maybe I'll send a few my design but I don't get the impression they will be cheap.  As Asia is so close, shipping rates are usually best from there, and curiously from the UK.

on topic... is in Malaysia.  Just ordered some prototypes from them.  They verified my design with me and even doubled my order!
  Well, there are a lot of Chinese people in Malaysia and their site says they're closed.
These guys in MA, USA are offering 100 square inches for $95 plus shipping worldwide.
This looks like an option - I can produce gerbers no problem.  Thanks!!!
8  Using Arduino / General Electronics / Re: Cheap/Good PCB houses outside China (Chinese New Year) on: January 28, 2011, 06:42:30 pm
Maybe try these, I have no experience with them, nor do I know what shipping will be, just googled for South Africa.

South Africa baby  smiley-grin
Is this going to become the most political thread on the board? Maybe there are fab houses in Iran and Egypt we could work into the conversation? smiley

And let's not get started on African politics/ history/ corruption/ British colonialism...

Only cboards (who look small) have online pricing - works out about same as US or Olimex.  I think I'll just admit defeat and wait for Seeed or Itead to get back.

Re universities, that's an interesting idea, but my PCBs are quite complex (incl surface mount, double layer, vias) and I expect anything here to either be expensive or amateur.
9  Using Arduino / Project Guidance / Re: Problems with my first shield on: January 28, 2011, 06:21:31 am
R5, 6 and 7 add up to 460.6k. Given that they are in series with a pot couldn't you just use a 470k?

Admittedly the pot is only 2k, do you need that fine adjustment?


Hi Rob,

Good pickup.  I should change it to give more range.  It's the voltage divider to set the float voltage for the battery on the LT1513 (which is 13.65V in my case).  I may go with a larger multi-turn, and a standard resistor to match.


10  Using Arduino / General Electronics / Re: Cheap/Good PCB houses outside China (Chinese New Year) on: January 28, 2011, 06:11:05 am
Thanks for the above, they're either too expensive (esp with shipping - I'm in Aus), or actually in China (like PCBCart).  Unless I'm missing something, Olimex are quite expensive for 3 or so 100mm x 100mm boards, and seem to get mixed reviews.  Their website makes my head hurt.
11  Using Arduino / Project Guidance / Re: Problems with my first shield on: January 28, 2011, 03:33:36 am
Thanks for your post

There's too much for me to digest at once and I can't comment much on the analogue/PSU stuff, but a couple of things I'm not sure about .

1307 GND connected to VBAT, its that OK. The chip will expect a battery on that to work when power is cut.
Yep, it's OK to ground VBATT if not using it.  In my circuit, the UPS function will mean that the 12V battery will supply the RTC (and the rest of the circuit) if power is cut.

The 18B20 temp sensor, doesn't that need a VDD/VCC connection?
The way I have it hooked up works, and is in 'parasitic mode' per here.  Of course the other conventional method of separate VCC works and I may do that with my next revision to play safe.

Silly question, but are you sure the external PSU is DC?

Definitely.  I am using either a wall wart I've used in previous projects, or one of these Adjustable DC-DC regulators downstream from one of these 24VDC supplies.  But perhaps my supply also needs better filtering downstream , esp when the charger is running.

As I read up on grounding, I'm beginning to think that I have screwed up by having one monolithic ground plane that the battery and PSUs connect to, with a 'switched' ground track running between different pads on my board that cause a loop(s) and oscillation.  I am still a little mystified by the specific frequency of the 50Hz DC signal, and am beginning to wonder if I'm picking it up capacitively (e.g. from the AC/DC regulator) as my meter has long leads.  I did think that only happened on AC but will have to check.
12  Using Arduino / General Electronics / Re: Cheap/Good PCB houses outside China (Chinese New Year) on: January 28, 2011, 12:38:32 am
Are there any good options in SE Asia etc that don't celebrate Chinese NY?  E.g. Thailand, Malaysia etc?

Maybe Tibet ?   smiley-grin
Nice one.   They  are 'encouraged' to celebrate it...

Wikipedia tells me Losar is on March 5 this year.  8 days before the ides of march...
13  Using Arduino / General Electronics / Cheap/Good PCB houses outside China (Chinese New Year) on: January 28, 2011, 12:30:05 am

I usually use SeeedStudio for PCBs.  I need a board made in about 7-12 days and it seems every fab house is about to shut down.  I'm in Australia and the local options are ridiculous, US-based ones charge too much for shipping, and I haven't heard good things about Futurlec (Thailand) and Olimex (Eastern Europe).  Are there any good options in SE Asia etc that don't celebrate Chinese NY?  E.g. Thailand, Malaysia etc?

Otherwise I'll just wait...

14  Using Arduino / Project Guidance / Re: Problems with my first shield on: January 28, 2011, 12:22:01 am
I'm really keen for some help here - it occurs to me that my post may be too dense or not make sense in places.  If you think you can help, please let me know if anything is unclear or if I need to break my issues up into more discrete questions.

Thanks in advance.

I just ordered an oscilloscope so hope I can diagnose more effectively...
15  Using Arduino / Project Guidance / Problems with my first shield on: January 27, 2011, 08:57:03 am

I am trying to develop what is essentially an Arduino Mega Shield to act as a 'brain' for a project I'm working on.  I've had a PCB made (my first), and after thinking I had it sorted have gradually discovered a number of screwups.  I'd appreciate some pointers before I attempt revision B..

I have included my schematic with some annotations.  It's a complex schematic, but most of it is just breaking the mega out to spring terminals.

I have a very good multimeter (Fluke 87V) but no scope (I plan on getting one), so my diagnosis ability is limited.

Here are the major things I'm concerned about...

The 'DC UPS' function appears to work on the surface.  If I connect a 12V battery and the 12V regulated supply the battery charges up to float, and disconnecting the regulated power supply appears to continue delivering power from the battery.  Also, if I disconnect the battery power is taken from the power supply.

Note that I am using another PSU to take the output of the DC UPS and convert that to a 9VDC and 5VDC supply.  I used a 3A model from Sure Electronics that I should probably replace with a couple of LM317's or similar as my amp requirements are ~1A max on 5V and less on 9V.  (Is a series of LM317's a good choice)?

However, when the battery and the supply PSU are connected the real-time clock stops working (inaccessible), and I can see 50Hz at various points in my circuit (including Arduino VIN).  If just using the battery the RTC is fine.  While I now realise that I should have decoupling capacitors at every IC, I am wondering if I may have a ground loop, or if the charger is producing noise.  I understand that all parts of the circuit must have the same DC 'ground' (0V), but I am confused about whether the battery needs any special treatment or whether it and all PSUs will have the same 'ground'.

I have experimented with moving the crystal and RTC off my board, powering it directly from my 5V PSU rail, using a 0.1uF decoupling cap, and using soft I2C in case there's a problem on my SDA/SCL lines.  I have also tried a good wallwart (outputs 12.1VDC) and what I thought was a decent DC-DC regulator unit taking power from a 240VAC-24VDC supply.  Same result in all cases - will only work with the 12V supply disconnected.  The EEPROM works in any case, but only if the RTC is diconnected when the 12V supply is connected.

I am suspicious of the fact that I have pull-ups on my I2C bus connected to a different 5V source than the VCC of my EEPROM chip (which used the Arduino's 5V).

I want to be able to have a SPST switch cut power to both the 9V and 5V supplies for all but the RTC. The reason is that I have an arduino, a display (4D Systems LCD) and a beagleboard hanging of this circuit and would like to be able to cut power to them (after a graceful shutdown), but also have a UPS-style battery backup.  I have tried to avoid using a specific 3.3V battery for the RTC.

I tried to do that by switching their ground (and that of the line into the PSU), but that failed miserably with ~8V being output on my 5V line.  I then used a jumper to close the ground switch permantently.  Obviously I can just switch the positive 5VDC and use a relay controlled by that to actuate the 9V, but there must be a better/simpler way?

Also, if I want to make a direct USB connection without the large cable ends, is there any problem with soldering the cores (and shield) of the USB cable to the pins of the Arduino's connector?

I'd appreciate any other suggestions...


Pages: [1] 2 3 4