Board selection advice

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
idries
 
Posts: 4
Joined: Fri Aug 22, 2014 8:45 pm

Board selection advice

Post by idries »

Hi,

I've just got back into hobby electronics after a little break - around 20 years. So far to refresh myself I have purchased and completed the 'Sparkfun Inventors Kit' (https://www.sparkfun.com/products/12001) and then bought a soldering iron and completed a few basic electronic projects (flashing LED's, buzzers etc.).

Now I'm looking to create a 'self directed' project: an application with a flex sensor attached which will detect the opening and closing of my post box and then message me when I have post. I'm still debating what kind of message I want but it will be over the internet (i.e. e-mail, tweet, fb message etc.) so the application will need to connect to the internet. I know you can buy things like this but I want to make one.

Given my front door (where the post box is situated) is far away from any power or cabling the application is going to need to connect to my home wi-fi and be powered by a battery. I'm going to mount it on the door (inside) so it should also be small and light.

When I last did anything like this the PIC micro controller would have been the obvious choice for this kind of project. I can see that there are now wi-fi modules available for the PIC so it's obviously an option but there seems to be many more micro controller avenues these days. The 'Inventors Kit' has shown me that Arduino is incredibly easy to use, originally I had thought that Arduino would be too heavyweight for my application but I'm starting to consider this route more seriously now that I've seen there is a big range of boards available.

If I'm going that route then I'd like some advice on which Arduino board to purchase. The 'Trinket' board available on this website seems ideal but I need to know a few things:

- There are several wi-fi 'shield' boards available, the most appropriate options appear to be those based on the CC3000. Will the Trinket be powerful enough to drive this module?
- How do I power these boards? The Uno that I have a the moment claims I can just connect a 9Vbattery straight to it (well it needs some wiring but no circuitry). Is this true of the Trinket? Can the Trinket power the wi-fi module or does it need to be connected to a power source as well? Will it be the same one?
- Many (perhaps all) of the shield boards have an integrated SD card reader. Are these readers accessible from the micro controller boards for reading arbitrary files or are they for the sole use of the shield (i.e. for data files specific to the wi-fi module). Basically, I'm wondering if I can store an e-mail template on the SD card which the controller can send when it detects the post box opening?

Thanks in advance.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Board selection advice

Post by adafruit_support_rick »

The Trinket can't run a WiFi module - it doesn't have sufficient memory.
There is a new Pro Trinket which *can* run Wifi:
https://www.adafruit.com/product/2000
You might also consider an Arduino Micro:
https://www.adafruit.com/product/1315

Both can run on external battery power. The Pro Trinket 5V needs at least 5.5V, the Pro Trinket 3V needs at least 3.5V, and the Micro needs at least 7V.

You really don't want to run any of these on a 9V battery - you will get very little battery life. If I were doing this, I would use a large LiPo battery and a PowerBoost charger
https://www.adafruit.com/product/1944
That will give you plenty of 5V regulated power to run everything you want to do. I would also make extensive use of low-power 'sleep' mode on the microcontroller. You can easily arrange to have the processor sleep until interrupted by mail appearing in the slot.

These are small boards, and are not designed for use with a shield. If you want to use a shield, you should get a regular Arduino Uno. We have breakout versions of the CC3000 Wifi module, designed to be used with small-form-factor controllers.
https://www.adafruit.com/product/1469

The SD card on the shields are intended for general use - they are not dedicated to the shield. We also have a breakout version of the sd card reader:
https://www.adafruit.com/products/254

The on-board 5V regulator of the Pro Trinket cannot provide enough power for the WiFi and the SD modules. You would need to power them in parallel.

User avatar
idries
 
Posts: 4
Joined: Fri Aug 22, 2014 8:45 pm

Re: Board selection advice

Post by idries »

Hi,

Thanks for such a comprehensive and detailed reply (although it gave me quite a lot to read and think about). In the end I sketched out all the components in order to get a better feel for the relative sizes and I think that the Uno route is probably better as it seems a bit simpler which I'd prefer. Additionally the size difference isn't all that great relative to the smaller and more fiddly options. Better to walk before you can run etc.

Based on that I'm intending to place the following order:
Screen Shot 2014-09-01 at 00.36.19.png
Screen Shot 2014-09-01 at 00.36.19.png (84.97 KiB) Viewed 431 times
https://www.adafruit.com/products/1491
https://www.adafruit.com/products/1944
https://www.adafruit.com/products/1578
https://www.adafruit.com/products/50

At suggestion of the site I also added these:

https://www.adafruit.com/products/85

Does this all add up correctly? I've made a few assumptions in putting this together:

- I read the tutorial on the CC3000 and it looks fairly straightforward but the page on the shield version doesn't talk about power. I'm assuming that the shield can be powered straight off the Uno.
- Similarly, I'm assuming that I can just connect the USB output of the power converter straight into the Uno's USB port?
- Finally, the shield components appear to stack on top of the Uno, is that correct? This assumption is pretty key in my thinking that the size difference is not all that significant.

Thanks again :)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Board selection advice

Post by adafruit_support_rick »

That all looks good, and your assumption are correct.

However, I think you want to get a bigger battery. The 500mAh battery will not give you very much run-time at all.

How does your flex sensor work? Is it a digital or analog output? If you use a sensor with a digital output, you can put the Arduino to sleep and have it wake only when the sensor activates. That will extend your battery life a bit. With a bit of fiddling, you can also power-down the WiFi module.

User avatar
idries
 
Posts: 4
Joined: Fri Aug 22, 2014 8:45 pm

Re: Board selection advice

Post by idries »

Hi,

So I'll be honest, I spent most of my time thinking about the physical dimensions and going 'well the power aspect is going to be much of a muchness'. That was probably a mistake :/

There's no clear guidance I can see on how much current these boards draw (presumably because this varies a lot depending on the software and application) but I found this article: http://gadgetmakersblog.com/arduino-power-consumption/

Which leads me to think I'll get about 10 hours from the battery I've selected if I run the Uno (500mAh / 46.5mA = 10.75 hours - assuming it's not asleep and the shield is not drawing anything). The article also quotes a number of 1456uA for the 'Pro' (which it seems is still bigger than the Pro Trinket but is much closer in terms of voltage and clock speed). Which suggests I would see better than 14 days of charge from this board (500mAH / 1456uA = 343 hours ~ 14 days). Am I along the right lines here?

Presumably I'd see even better performance if I go with the Pro Trinket and I can go to a 1200mAh battery to give me around a month between charges - which is what I'm really looking for here.

As you suggest the board itself will be asleep most of the time anyway which will save me a bit more. Occasionally powering the CC3000 and the SD card will eat into that a little but the post man comes a maximum of twice a day (although we only get mail about 3 times a week) so that's not going to be huge amount overall.

Based on that analysis I'd probably reverse my previous decision and go with the Pro Trinket and the breakout boards. Does that stand up to reason?

As for powering down the CC3000 and SD card I had been thinking that I'd have to put in a of couple of relays at some point so that I could have the Arduino only power them up when needed. Is that too heavyweight? Are there software approaches which can achieve the same thing?

Finally, I've just got a really bog standard analogue flex sensor. I'd be really interested in a digital flex sensor but I can't track down any more info on something like that. Do you have a link?

Having said that I'll probably leave the mechanics of interfacing with the mailbox itself until I've bought the main components and got the wi-fi connection working (and have a better grasp of the physical size of the assembled unit). I was poking around with the mail slot today and I'm now wondering if I wouldn't be better off tracking down a very small microswitch. Something like this: http://tinyurl.com/k3g8b4c (but less than 100 of them). Attaching the flex sensor is going to be a bit challenging and there's very little advantage in knowing how far the box has opened, just that it has.

Thanks again :)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Board selection advice

Post by adafruit_support_rick »

If you went with some sort of switch for the mailbox instead of a flex sensor, then you could have the Arduino wake up when the switch is triggered. That's easy.

Instead of a relay, you could use a transistor to power up the SD and WiFi. Connect the base of the transistor to an Arduino digital output (through a 2.2kOhm resistor) and switch on 5V through the transistor.

You can use one of these NPNs:
https://www.adafruit.com/products/756

I think I'd still go with the Uno and the CC3000 shield. The shield has a prototyping area where you can set up the transistor. If you do it this way, the thing is going to be asleep almost all of the time, so the overall current draw when it's awake is much less of an issue.

User avatar
idries
 
Posts: 4
Joined: Fri Aug 22, 2014 8:45 pm

Re: Board selection advice

Post by idries »

Agreed that is a much better idea.

I have a bunch of resistors and NPN's already so I've just placed the original order (but with a bigger battery). Thanks for all your help, let's hope I can get all this stuff hooked up right :)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Board selection advice

Post by adafruit_support_rick »

I've attached a sketch that demonstrates sleeping. Attach a switch between pin 2 and GND. The Arduino will sleep until you press the switch, then it will wake up. It will stay awake until you release the switch, then it will sleep again. LED 13 will turn on while it's awake and off while it's asleep.

Code: Select all

// Demonstrates power down mode. 
// Sketch will put Arduino to sleep when Pin 2 is HIGH
// Arduino will wake when Pin 2 goes low
// You can substitute another external interrupt pin for pin 2:
// See http://arduino.cc/en/Reference/AttachInterrupt for pin
// and interrupt number information.
// Written by Rick Lesniak for Adafruit Industries

#include <avr/sleep.h>

void setup()
{
  Serial.begin(115200);
  pinMode(2, INPUT_PULLUP);
  pinMode(13, OUTPUT);
}

void loop()
{
  while (LOW == digitalRead(2))    //wait for pin 2 to go high
  {
    delay(500);
  }
  Serial.println("going to sleep now");
  sleepNow();          //sleep until pin 2 goes low
}

void sleepNow(void)
{
    // Set pin 2 as interrupt and attach handler:
    attachInterrupt(0, pinInterrupt, LOW);
    delay(100);
    //
    // Choose our preferred sleep mode:
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    //
    // Set sleep enable (SE) bit:
    sleep_enable();
    //
    // Put the device to sleep:
    digitalWrite(13,LOW);   // turn LED off to indicate sleep
    sleep_mode();
    //
    // Upon waking up, sketch continues from this point.
    sleep_disable();
    digitalWrite(13,HIGH);   // turn LED on to indicate awake
}
//
void pinInterrupt(void)
{
    detachInterrupt(0);
}

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”