9

I have build a couple of projects using arduino. For a new project I want to log skin surface temperature vs. time (just perhaps a few times per day) and possibly other easy to obtain info such as voltage.

I need to make everything as small and lightweight as possible (since it would be measuring skin temperature on a small mammal), i.e. below 5g, lighter if possible, ideally 3g, including the battery, so that it doesn't upset the 50-100g animal too much.

I read it might be possible to change the arduino pro mini to use less current by getting rid of the voltage regulator? but perhaps it is more sensible to change completely and learn to program another type of microcontroller which someone could recommend? It would need to be possible to operate it directly from a lightweight coin cell or similar lightweight battery. (I'm also not sure how to find a lightweight 3.3V battery for the arduino pro mini, I guess they exist but I can only find 3V batteries so far). If it has onboard memory to save temperature every few hours which could be downloaded later that would be ideal (I would also be interested if anyone has recommendations for memory). I know it's possible to buy an "Ibutton" but if I have time I would like to make my own so that I can add other sensors and obtain more information.

  • ...sorry, my actual question is: Could someone recommend a suitable low powered lightweight microcontroller, or do you think I should continue with arduino and try to adapt it? Any help is really appreciated! – shara Oct 30 '16 at 21:20
  • You could use an ATmega328 at 8MHz, powered with two 1.5V batteries in series. You could then continue using Arduino libraries and IDE. – jfpoilpret Oct 30 '16 at 21:31
  • @jfpoilpret, 2AA would be too heavy I think. A 2032 3V coin cell could be better. – Dat Ha Oct 30 '16 at 21:46
  • 2
    Depending on how you program it, an ATmega328 or an ATtiny84 or 85 might have very light current consumption and work with a lithium CR2032 cell for quite some time. However, reducing power consumption of a circuit (ATmel or any other) can become rather tricky. – jfpoilpret Oct 30 '16 at 21:48
15

I made up a small torch locator which used an ATtiny85 powered from a button-cell (CR2032). It looks like this:

Torch locator

Other side:

Other side

That currently weighs 5.9g. The battery-holder weighs 1.6g so you could save that by making a more light-weight holder (perhaps a bit of plastic for insulation, and soldering directly to the battery). The chip socket weighs at least 0.5g, so you could save that as well by soldering to the processor pins. So we are down to 3.8g.

The ATtiny85 has 512 bytes of EEPROM which you could use to log readings to. I'm not sure about a clock if you are trying to save weight, but if you start it at a known time, you could have a reasonable estimate of the time by using the millis() function to find miliiseconds since startup.

I made another one a while ago which flashes an LED every couple of seconds:

LED flasher

That is similar. The processor is there (upside down under the chip socket) and the battery is underneath. That weighs 6g. The battery has lasted a couple of years, and that is flashing an LED every couple of seconds!

Instead of the LED you could have a thermistor to read the temperature.

You could program it to take a reading every few hours and save it to EEPROM. Then when instructed (eg. by joining a couple of pins) it could output the readings to another pin (via serial).

You could save more weight by using SMD (surface mounted) devices, and perhaps using a tiny circuit board you could get made up.


Code

The code for my torch locator is below. Of interest is the fact that it sleeps most of the time. Also it sleeps during the ADC sampling. Although in my case I am measuring a LDR (light dependent resistor) the code for measuring a thermistor would be similar. You just need to do some calculations at the end to turn the reading into a temperature.

// ATtiny85 torch detector
// Author: Nick Gammon
// Date: 25 February 2015

// ATMEL ATTINY 25/45/85 / ARDUINO
// Pin 1 is /RESET
//
//                  +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2) Ain1 
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//            GND  4|    |5  PB0 (D 0) pwm0
//                  +----+

/*

  Pin 2 (PB3) <-- LDR (GL5539) --> Pin 7 (PB2) <----> 56 k <----> Gnd

  Pin 5 (PB0) <---- LED ---> 100 R <-----> Gnd

*/


#include <avr/sleep.h>    // Sleep Modes
#include <avr/power.h>    // Power management
#include <avr/wdt.h>      // Watchdog timer

const byte LED = 0;          // pin 5 
const byte LDR_ENABLE = 3;   // pin 2
const byte LDR_READ = 1;     // Ain1 (PB2) pin 7
const int LIGHT_THRESHOLD = 200;  // Flash LED when darker than this

 // when ADC completed, take an interrupt 
EMPTY_INTERRUPT (ADC_vect);

// Take an ADC reading in sleep mode (ADC)
float getReading (byte port)
  {
  power_adc_enable() ;
  ADCSRA = bit (ADEN) | bit (ADIF);  // enable ADC, turn off any pending interrupt

  // set a2d prescale factor to 128
  // 8 MHz / 128 = 62.5 KHz, inside the desired 50-200 KHz range.

  ADCSRA |= bit (ADPS0) | bit (ADPS1) | bit (ADPS2); 

  if (port >= A0)
    port -= A0;

#if defined(__AVR_ATtiny85__)  
  ADMUX = (port & 0x07);  // AVcc   
#else   
  ADMUX = bit (REFS0) | (port & 0x07);  // AVcc   
#endif

  noInterrupts ();
  set_sleep_mode (SLEEP_MODE_ADC);    // sleep during sample
  sleep_enable();  

  // start the conversion
  ADCSRA |= bit (ADSC) | bit (ADIE);
  interrupts ();
  sleep_cpu ();     
  sleep_disable ();

  // reading should be done, but better make sure
  // maybe the timer interrupt fired 

  // ADSC is cleared when the conversion finishes
  while (bit_is_set (ADCSRA, ADSC))
    { }

  byte low  = ADCL;
  byte high = ADCH;

  ADCSRA = 0;  // disable ADC
  power_adc_disable();

  return (high << 8) | low;

  }  // end of getReading

// watchdog interrupt
ISR (WDT_vect) 
{
   wdt_disable();  // disable watchdog
}  // end of WDT_vect

#if defined(__AVR_ATtiny85__)  
  #define watchdogRegister WDTCR
#else
  #define watchdogRegister WDTCSR
#endif

void setup ()
  {
  wdt_reset();  
  pinMode (LED, OUTPUT);
  pinMode (LDR_ENABLE, OUTPUT);
  ADCSRA = 0;            // turn off ADC
  power_all_disable ();  // power off ADC, Timer 0 and 1, serial interface
  }  // end of setup

void loop ()
  {
  // power up the LDR, take a reading
  digitalWrite (LDR_ENABLE, HIGH);
  int value = getReading (LDR_READ);
  // power off the LDR
  digitalWrite (LDR_ENABLE, LOW);

  // if it's dark, flash the LED for 2 mS
  if (value < LIGHT_THRESHOLD)
    {
    power_timer0_enable ();
    delay (1);  // let timer reach a known point
    digitalWrite (LED, HIGH);
    delay (2); 
    digitalWrite (LED, LOW);
    power_timer0_disable ();
    }

  goToSleep ();
  }  // end of loop

void goToSleep ()
  {
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);
  noInterrupts ();       // timed sequence coming up

  // pat the dog
  wdt_reset();  

  // clear various "reset" flags
  MCUSR = 0;     
  // allow changes, disable reset, clear existing interrupt
  watchdogRegister = bit (WDCE) | bit (WDE) | bit (WDIF);
  // set interrupt mode and an interval (WDE must be changed from 1 to 0 here)
  watchdogRegister = bit (WDIE) | bit (WDP2) | bit (WDP1) | bit (WDP0);    // set WDIE, and 2 seconds delay

  sleep_enable ();       // ready to sleep
  interrupts ();         // interrupts are required now
  sleep_cpu ();          // sleep                
  sleep_disable ();      // precaution
  }  // end of goToSleep 
  • for your flashing led "thing", wouldn't it be better to use a 555 timer chip? I find using an ATtiny somewhat of a waste. – Dat Ha Oct 30 '16 at 21:57
  • 2
    I was going for low power consumption. The processor sleeps most of the time, and then flashes the LED for a millisecond or so. – Nick Gammon Oct 30 '16 at 22:05
  • thanks! looks possible to use this, will have a go at learning how to set up and program it. – shara Oct 30 '16 at 23:06
  • Re “Instead of the LED you could have a thermistor to read the temperature”, one could instead read ADC channel 15, the on-board temperature sensor. [However it isn't highly sensitive or accurate.] – James Waldby - jwpat7 Nov 3 '16 at 21:57
  • Your torch finder is a wonderful piece of design and the power consumption estimation you did is very much in the spirit of the "engineer as much as you need to" spirit of Ardunio. The whole thing warmed the cockles of my heart (wherever those are). – Curt J. Sampson Apr 3 '17 at 14:32
8

I would personnaly suggest an ATtiny 45/85. It is pretty much a small AVR with 5 GPIOs. You can program it with the Arduino IDE and use the Arduino as ISP. If you can design you own custom PCB, a SMD version of the ATtiny is small, low and compact. The total circuit to make the ATtiny function is also minimal.

enter image description here

Also, at a low clock speed (0-4MHz), you can power the ATtiny at a voltage as low as 1.8V. You could probably even run it at 1.5V, but this is not totally recommended. If you want to be safe, a 3V coin cell will be small, flat, and it can last probably many years. It is also a little safer compared to lipos which have many risk, especially if you mount it on an animal that you can't really control.

enter image description here

I would also recommend SMD components if possible. It lets all the component be lower and it doesn't hurt or sratch the skin of the person/animal you are monitoring.

  • Looks like we both had the same idea! – Nick Gammon Oct 30 '16 at 22:04
  • thanks!! this looks great, really appreciate the help! I will try to learn the basics of how to set up the microcontroller etc. from the first circuit and once I get it working will probably change to SMD components as you suggested. I think realistically I will need to do that to make it small enough. – shara Oct 30 '16 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.