A battery-powered small datalogger based on a PIC18F2620 microcontroller project from Jesus Echavarria:
The idea comes a few months ago, talking with a friend. He needs something to monitoring temperature and humidity inside a sea container, for a three weeks travel from Spain to China. Low consumption is important, in order to have maximum autonomy with a small battery. I use a HDC1050 temperature and humidity sensor, and a TEMT6000X01 ambient light sensor. The collected data is stored on a micro SD card. Also the board has a RTC for timestamp, a Li-Ion battery charger, user pushbuttons and leds, and a MCP2221 USB bridge to communicate with the board and configure some parameters through software.
First of all, here’s a view of the board with the main components. After I’ll talk about the case 😉
The schematic of the board is available here: EEL_PIC_DATALOG_V1.0. It’s divided in the following parts:
- Main diagram: Includes the mini-B USB connector, TVS diode for protecting the USB line and the rest of the connections.
- Power supply stage: The board can be powered using a 3.7V Li-Ion battery or through USB port. I use a 3.7V/1100mAh battery for this first prototype (LP603450). USB port is also used to charge the battery. I use the MCP73832-2ACI/OT regulator from Microchip with a Rset of 4K7 (not 10K as appear in the schematic). This allows a current charge of around 220mA/h. D4 (red) and D5 (green) leds indicate the status of the charge. Also, D1 (green) lights when USB power is present:
- The hot point is the battery manager, when charging the battery. Although is a high temperature, is not critic and with this setup, the battery is fully charged in around 5 hours.
System voltage is 3.0V, so I use a TPS76930DBVR LDO regulator. with a maximum output current of 100mA and a typical dropout voltage of 115mV at 100mA output. Also, there’s another LDO regulator, U10. This one is used to power the USB – serial converter. The input of this regulator comes from the USB port, so when there’s no connection with the USB, the regulator and also the USB converter are not powered, increasing the battery life.
Battery voltage is measured with the RA3 analog input of the microcontroller. I just set a voltage divider to adjust the maximum battery value (4.2V at the end of the charge) to the 3.0V maximum voltage on the PIC pins.
At this time, duration of the battery is around 10 days. With the actual software, there isn’t any low power implemented yet. The consumption is around 5-6 mA, including the DS18B20 sensor that I don’t use. I think that unassembly this sensor and forces SW to low power consumption, the goal of three weeks of autonomy is easy to reach.
- PIC18F2620 microcontroller: The brain of the board!. 64KB Flash, 3968 RAM bytes, 1KB EEPROM, 25I/O, I2C, UART,…all condensed on a 28-pin soic package. Enough for this project! Of course, the board has the ICSP connector and also J4 and J5 connectors with accesible VCC, GND and three not used pins. I also let in the board the footprint for a DS18B20 temperature sensor. Originally, it’s on the board because I’m not sure if I’ll be able to solder the HDC1050 sensor, so if I can’t, at least I can obtain the temperature from this sensor.
- I2C bus: On the 3.0V I2C bus are the HDC1050 temperature and humidity sensor and also the M41T00SM6 RTC. The RTC has a CR1220 battery for backup date and time. Also there’s a connector available with these signals for future uses. The I2C bus is implemented by software, because the I2C lines are shared with the SPI port, and I need it for the micro-SD card.
- Micro-SD Socket: I use this one from Molex because is easy to solder by hand. Not much to say here, just and SD card connected to the SPI port. You can check here the SD card specs.
- User interface: Two pushbuttons (active low) and two led’s (D2 Green / D3 Red) for what user wants!.
- LDR: A TEMT6000X01 ambient light sensor. It reads with the analog RA0 input. Because the internal ADC of the PIC has 10-bit resolution, maximum value will be 1023 that corresponds with maximum level of illumination.
- USB-Serial bridge: Based on the MCP2221 chip that I use before.
- I design the board with components only on top layer, it’s easy to assemble. I use the DP5050 sick of beige PCB format from DangerousPrototypes. The gerber files of the board can downloaded here: GBR_PIC_DATALOG_V1.0. And here’re a couple of 3D-previews images from Altium:
Project info at Jesus Echavarria blog.
Read more Here