Show Posts
Pages: [1] 2 3
1  Using Arduino / Networking, Protocols, and Devices / how to deal with the 2000mA peak current demand of a cellular shield on: July 11, 2013, 11:34:35 am
I am running the Sparkfun 5100B cellular shield on an Uno.

After some initial problems, it's now all running fine, and I've ssuccessfully sent and received SMS messages.

I'm now trying to finalize the power supply to my set-up, and I notice from the data sheets that the cellular shield idles at about 7mA, but peaks at an enormous 2000mA when transmitting. My question is how "serious" this limit is. I note that:

(a) the UNO/Cellular shield I used for testing is powered by USB from a PC. The nominal USB hub limit is 500mA, nowhere near the 2000mA. I would imagine that there are other nominal limits on the various components of the power 'train' within the Arduino itself which are also being exceded.

(b) the shield is designed to mate with the Uno, and sold without any loud warnings about definitely needing to beef up the power supply to 2000mA.

(c) my Uno is not fried - yet!

What is going on here?

  • Will the PC give 2000mA for a short burst without melting/complaining?
  • Will the Arduino pass on 2000mA for a short burst without melting/complaining
  • Is the 2000mA an exaggeration?
  • Is there some kind of capacitance within the system that facilitates short power surges?

Behind these questions, I'm obviously afraid that I've just been lucky so far and that I am courting disaster.

Have you used such a shield? Did you beef up your power supply?

Please enlighten me.


2  Using Arduino / Networking, Protocols, and Devices / Re: No response at all from Sparkfun cellular shield - SOLVED on: July 11, 2013, 03:36:20 am
The red light on the shield was on - not a power supply problem.
The introductory Serial.println messages of the sketch were appearing, but none of the expected SIND  responses appeared. 

Got back to my supplier - Proto-pic.

Since there was nothing from the shield, n ot even garbled messages which might have indicated a mismatch of baud setting between shield and sketch - Proto-pic diagnosed a dud shield. They immediately replaced it and the replacement worked right away.

Thanks John and Drew

3  Using Arduino / Networking, Protocols, and Devices / No response at all from Sparkfun cellular shield - SOLVED on: June 28, 2013, 06:10:12 pm
Hi guys,

I have the Sparkfun SM5100B-D shield sitting on an Uno. It's connected to the PC using the USB. That is the only power source at present - no external power to the shield. I'm using a very lightly modified version of the suggested Hello World sketch, as follows:

#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h>         //Used for string manipulations

char incoming_char=0;      //Will hold the incoming character from the Serial Port.

SoftwareSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

void setup()
  //Initialize serial ports for communication.
  //Let's get started!
  Serial.println("Starting SM5100B Communication...");
  Serial.println("after cell begin");

void loop() {
  //If a character comes in from the cellular module...
  if(cell.available() >0)
  {;    //Get the character from the cellular serial port.
    Serial.print(incoming_char);  //Print the incoming character to the terminal.
  //If a character is coming from the terminal to the Arduino...
if( Serial.available( ) > 0)
incoming_char = ); // Get the character coming from the terminal
if(incoming_char == '~'){ // If it’s a tilde…
  incoming_char = 0x0D;      // ...convert to a carriage return 

else if( incoming_char == '^') // If it’s an up caret…

incoming_char =  0x1A;    // ...convert to ctrl-Z 

cell.print( incoming_char ); // Send the character to the cellular module.
Serial.print( incoming_char ); // Echo it back to the terminal


I'm getting the two startup messages, and anything I type is reflected back to me, but nothing comes from the shield - no SIND messages - nothing at all.

I've looked at the forums, and it seems that Sparkfun sometimes do not set the baud rate to 9600 as advertised, but leave it at the factory setting of 115200. You cant simply switch the code to use 115200 because apparently the Softwareserial library cant handle that. Apparently to get round this you can use other serial connections to form an initial connection with the SM5100 which then allows you to reset the comms rate to 9600. However it's not explained at a level I can understand, and I'm not sure yet if this is indeed the problem.

In the first instance can you help me determine if a baud rate incompatibility is in fact the problem?

(There's a lot of other chatter about power supplies, so I hope I haven't blown something, or starved it of power, simply by trying to switch it on!!)


4  Using Arduino / General Electronics / Re: concerns over using USB and an independent power supply at same time on: June 22, 2013, 09:36:11 am
Thanks everyone that replied.

Since the Arduino only takes 5V through the USB, and since I have a 5V UPS source, I'm going to try hooking up my UPS source to the USB port. Using a couple of USB breakout boards, I'm wiring in power from the UPS and data from the computer, into a single USB cable and feeding this to the Arduino. The power coming from the computer is simply ignored. Is this crazy? Wish me luck.

5  Using Arduino / General Electronics / Re: concerns over using USB and an independent power supply at same time on: June 15, 2013, 03:32:07 am
Hi James,
 Thanks. How then do I permanently connect an external 5V supply to power the Arduino, if not through Vin, given that I want to use the USB for programming?
6  Using Arduino / General Electronics / Re: concerns over using USB and an independent power supply at same time on: June 14, 2013, 04:21:44 pm
Thanks James,

You can have Vin/Barrel jack and USB connected at the same time.
This is what I wanted to hear - USB and Vin can both safely be connected at the same time. Then you say...
As long as Vin/Barrel jack is higher than 7.5V, the auto-select circuit will continue to power with the external adapter.
Now the sparkfun board produces exactly 5V, so am I right in concluding that my Arduino will take power from the 5V USB supply when it is connected, then switch to my 5V Vin supply when the USB connection is broken?
1.  You should not connect a regulated 5V source to the 5V pin and power from USB at the same.
Now I'm getting worried again. Are you saying that I can connect a high voltage to Vin alongside the USB, but that I cannot connect 5V to Vin alongside the USB?
2.  When you open / close the serial connection, your arduino will reset.

If I have downloaded and started my programme with the USB connected, and I want now to remove my PC from the scene, are you saying that my programme will be forced to re-start?

Thanks in advance for your patience
7  Using Arduino / General Electronics / concerns over using USB and an independent power supply at same time on: June 14, 2013, 03:31:43 pm

I'm supplying power to the Arduino Uno Vin pin using the Sparkfun "Power Cell - LiPo Charger/Booster" from Proto-pic. My green On light is on. So far so good. This gives me a UPS for the Arduino and I want this to become my power source.

Now I want to plug in my USB connection to the PC to download some programmes, but I'm scared. I read somewhere that you must not have more than one power supply to the Arduino, and yet the USB used to be my power source. So when I plug the USB through to the PC will that make two power supplies to the Arduino? Is this a problem, and if so how do I stop the USB providing power while retaining its communication function?

8  General Category / General Discussion / Interrupt heresy - reactions? on: September 21, 2012, 08:28:27 pm
Standard advice on ISRs from the forums often includes one or more of the following:
  • avoid putting too much inside an ISR - keep them lean and mean
  • simply set a flag of some kind in the ISR, then poll that flag in the main loop and do the bulk of any processing required there
  • dont use function calls in the ISR
  • you cant use anything that uses interrupts inside the ISR, including importantly, timing functons like millis(), and
  • comms using the Serial class

So why is this advice being offered, and does it always apply?
The argument seems to run t like this. Some sources of interrupts are random in the sense that there is no telling when or how often they will occur. There is therefore no guarantee that the ISR will have finished servicing one interrupt before the next interrupt of the same type occurs. To handle fully this situation of 'overlapping' interrupts within the ISR itself, the ISR code would have to be re-entrant. Since ISRs are tricky to code/debug at the best of times, and writing safe re-entrant code is even more difficult, so keep things as simple as possible by disabling interrupts inside ISRs.
Occasionally an incoming interrupt that follows close on the heels of a similar interrupt will be missed while you are busy processing the first interrupt, but in many cases this is acceptable. This is presumably the reason that the AVR processor has been designed to automatically disable further interrupts just before calling an ISR.

As a result, on the Arduino, unless you take counter-measures, all interrupts arriving during the processing of an ISR will supposedly be lost (unless they persist in some way until after the ISR has finished processing).
In that light, the standard advice starts looking very wise:
        keep ISRs short (or you will miss even more interrupts)
        don't use functions (they may contain code that uses interrupts, and this will fail)
        dont use millis, or Serial in an ISR since these use interrupts
But notice the large price you are paying for adopting this so-called 'safe' approach
        occasional lost interrupts (lost accuracy?)
        occasional loss of characters during serial communications (now you may have to protect more thoroughly against
          dropped characters, eg more complex protocol, slower comms)
        inability to use standard timing mechanisms inside ISRs (may mean resorting to custom built timinig mechanisms)
        inability to use standard comms inside ISRs (makes debugging ISRs much more difficult, may have to resort to flashing LEDs etc)
        inaccuracy of timing mechanisms outside ISRs (since the millis() will not be counting while the ISR is running, and
          will therefore always be running slow, by an undetermined amount)
        loss of structure (avoiding function calls), and/or redundant coding (replacing function calls) for fear of using
          function calls inside the ISR

In some cases, you may nevertheless conclude that this is the right solution on balance.
BUT ...
In many situations, the nature of the interrupts involved is such that they are guaranteed to arrive serially (one at a time), and sufficiently spaced out so that concurrent invocation of the ISRs is never an issue.
Take the situation where there are only two types of interrupts: interrupts from a timer (A), and interrupts from a serial interface (B). You may get an A and a B arriving at the same time, but never two As or two Bs at the same time. Since the interrupts from any one source are guaranteed to arrive serially, you don't require re-entrant code in the ISR for either type of interrupt. Consequently you dont require the 'simplification' of switching off further interrupts in the ISR.

You can't stop the AVR chip from switching off interrupts before calling an ISR, but you CAN switch them back on again as soon as you're in the ISR (simply make     sei();    the first instruction of your ISR.)

If this situation applies to you (and I believe it to be quite common) you're life as an ISR writer will be greatly enhanced:
  •       you'll very rarely miss an interrupt (the time when interrupts are disabled will be extremely small), and so you either don't have to cope with that possibility, (either in terms of extra code, or lost precision) or the impacts of occasional missed interrupts are greatly reduced
  • you can start using normal timing mechanisms like millis() for timing inside your ISR
  • your millis timer will not run slow
  • comms using Serial outside the ISR will be unaffected (since the ISR involved with Serial can now interrupt your custom ISR)
  • you can use Serial comms within the ISR, whicjh is especially valuable for debugging
  • you can safely use most function calls within the ISR without worrying about any embedded use of interrupts
  • you dont have to worry unduly about the size of the ISR - since you're no longer under the same time pressure, and you're not missing interrupts

In fact you can see that it is the very act of inhibiting further interrupts that is making the writing of ISRs seem difficult - by keeping interrupts enabled, most of the problems evaporate.

However it all hinges on the nature of the interrupts you are trying to handle:
          with random interrupts there is a real issue to solve: you can either accept the processor default (further interrupts inhibited) or you can write re-entrant code (tricky);
          with serial, spaced out interrupts, there is no big issue - why not re-enable interrupts at the start of the ISR and then just programme normally.

I know it's heresy, and I'm expecting a fatwa, but I'm old and ugly - bring it on.
9  Using Arduino / Storage / Re: Looking for guidance on data storage: EEPROM vs memory stick, vs SDcard on: July 15, 2012, 06:23:55 pm
Hi Crossroads / Nick

I took a look at that fancy soldering kit, and on reflection dont want to go that way. I think I'll give Nick's I2C / EEPROM a go. No problem with pins, and Nick has provided a really first class tutorial on his site on how to put it all together. I'll close this for now, until I get the part and give it a go.

Thanks for your help.
10  Using Arduino / Storage / Re: Looking for guidance on data storage: EEPROM vs memory stick, vs SDcard on: July 12, 2012, 05:54:51 pm
Hi CrossRoads

I'm gonna follow your lead here, but I starting from scratch, and I haven't a clue what to do with the breakout board!!

How do i "mount" the part on the breakout - do I need a soldering iron?

And then what do I do with the breakout board - does it have pins coming out of it that will fit into a breadboard? I have the Arduino attached to a breadboard that came with my "experimentation kit", so once it's on the breadboard I can make all the connections I need to.

The Ocean Controls Thermocouple Multiplexor shield covers the Uno almost completely, but repeats most of the pins of the Uno. It also provides a fairly extensive area full of holes, which I presume I could use for locating the FRAM when I've got it all sorted out.

Feeling very wet behind the ears!

11  Using Arduino / Storage / Re: Looking for guidance on data storage: EEPROM vs memory stick, vs SDcard on: July 12, 2012, 01:09:02 pm
Thanks for all feedback

Despite what i said about not wanting to get into "hacking", this FRAM looks amazing, its cheap as chips, and doesn't look TOO complicated - (may regret saying that). However I didnt really follow all that stuff about SPI modes, etc, on the data sheet. Can you reassure me that I dont need an electronics degree to make this work? Can you point me at any resources that would help a non-hardware guy to get this up and running?

The other thing is that, if I understood the stuff on the link you gave me, the chip only comes in surface mount format - is that correct? and if so, how do I attach it to my Uno?
12  Using Arduino / Storage / Looking for guidance on data storage: EEPROM vs memory stick, vs SDcard - SOLVED on: July 12, 2012, 11:26:02 am
Hi guys,

I'm making a controller to control several kilns at the same time. I'm using my PC as the front end where the firing procedure is specified, and also as the backend where the data is displayed and analysed.

The Arduino will be given its "instructions" with the PC connected. I will then unplug the PC and use it for other things. Arduino will control the kilns and log temperatures over a number of hours, currently to EEPROM. Given the limited size of the on-board EEPROM, I'm looking at other solutions for storing the data, and subsequently uploading it to the PC. I'm looking for as close to plug and play as I can get, not a solution where I have to hack about, either in terms of hardware or software.

I considered a USB memory stick (plenty of storage, and avoids an upload over the serial interface). I looked at the Sparkfun USB Host Shield. It talks about interfacing with a lot of stuff, but I don't see a plain old memory stick. Is this just taken for granted, or do I need software to correctly format my data on the stick so that Windows can access it?

I considered EEPROM (I've already developed for this - presumably an easy upgrade path for me). I looked at an inexpensive module from dfrobot. It mentions their Interface Shield For Arduino, without being clear whether I really need this. The Arduino playground  article it links to says there isn't a library, but offers some code - not too encouraging.

I considered an SD card, but the shield I looked at seems to conflict with the pin usage on the thermocouple multiplexor board that I'm using (The multiplexor uses SPI and uses D4,5,6,7,9,12,13; the SD shield uses D 8 to 13). Presumably its perfectly all right to share the SPI standard pins 10 to 13, but I cant work out whether the other pins present a problem.

Each avenue is full of ambiguity for me, probably because i'm not used to this low level stuff.

Any overall advice (best direction to pursue, warnings), specific product/project experiences, or help clarifying any of the above would be appreciated.

Sorry about the long post

13  Using Arduino / Programming Questions / Re: health check on an ISR please - COMPLETED - THANKS on: July 11, 2012, 04:02:59 am
Thanks for all contributions
14  Using Arduino / Interfacing w/ Software on the Computer / Re: Gobetwino is running very slow after a few hours - anyone else had this? on: July 11, 2012, 03:47:03 am
Hi Mikael

Started another test before I had your latest reply - ran it without the GBT status window and without the internal GBT logging - everything running fine with my files after 8 hours.

Now I'll add back the status window and see what happens.
15  Using Arduino / Programming Questions / Re: health check on an ISR please on: July 09, 2012, 07:03:26 pm
Hi PaulS

nor does the compiler do anything clever to make a routine into an ISR.

The reason I asked was because somewhere along the line I came across this article

which suggested that compilers do indeed take account of the peculiarities of an ISR. Perhaps only for more sophisticated compilers?
Pages: [1] 2 3