Roast my schematic, autonomous data logger - Page 1
Forum section: electronics / beginners

author: nachocpol
author_rank: Contributor
timestamp: September 12, 2020, 10:57:28 pm
content: Hey folks!I'm working on a data logger that can be used on RC planes or small rockets. It's powered by a 1S LiPo. I'll probably program it using the Arduino IDE or similar. During flight it will store things like acceleration, velocity, max altitude an so on to a MicroSD.Parts used:Power regulator:MCP1602-ADJI/MSUSB to serial:FT232RLSensing devices:BMI160 BPM280MCU:ATmega328-PUI was hoping if anyone could give some feedback, this is the schematic:So far I have a few concerns:Should I add some protection diodes to the USB D+/- lines?I used the Arduino nano schematics as refernce, however I skipped several decoupling caps on the VCC/AVCC lines, Is this ok?Thanks!Nacho.

author: tszaboo
author_rank: Super Contributor
timestamp: September 12, 2020, 10:59:42 pm
content: The text is really small, PDF please?

author: ledtester
author_rank: Super Contributor
timestamp: September 12, 2020, 11:09:12 pm
content: Two quick things that come to mind...Consider just exposing TX, RX and GND pins and remove the FT232 and USB interface. Then just use a FT232-to-TTL module when you need to talk to the micro. You don't need the FT232 when flying. This removes some parts and simplifies the design. The plane's battery will need to be charged to talk to it, but you'll have battery chargers around anyway.Just search ebay/aliexpress for "FT232 module".Second thing -- put the LED under control of the micro. Then it can blink it to report its status or an error condition. Also saves some power since it won't be on all the time.A third thing -- maybe adding a push button to tell the micro to start/stop recording might be helpful.

author: nachocpol
author_rank: Contributor
timestamp: September 12, 2020, 11:31:05 pm
content: Quote from: NANDBlog on September 12, 2020, 10:59:42 pmSorry about that, I've attached the PDF.Quote from: ledtester on September 12, 2020, 11:09:12 pmRemoving the usb chip is a good idea, it will save some space and weight!I wanted to have a power LED and another one for status , maybe it's overkill.. not sure.Thanks!

author: SmokedComponent
author_rank: Regular Contributor
timestamp: September 13, 2020, 01:21:01 am
content: Powering ATmega328 @ 16Mhz with 3.3V might be risky business, especially in non-ideal conditions (hot/cold environment), according to its datasheet. Maybe you should run it at 5V or decrease clock to 8 MHz to be sure. ATmega328 does have internal 8 MHz oscillator but unfortunately it is not accurate enough to be used with RS232 communication, so you have to use external 8 MHz crystal or resonator.Also, for a data logger, it would be handy if you used some real time clock/calendar IC. Not only will this make very easy to correlate events, with backup coin cell battery, it will keep the clock set up and running.

author: Renate
author_rank: Super Contributor
timestamp: September 13, 2020, 02:34:50 am
content: Ugg. I'm so sick of seeing µCs with an FTDI hanging off it.How about using an ATMega32u4?It's smaller than a big DIP and supports USB all by itself.

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 08:49:31 am
content: Quote from: SmokedComponent on September 13, 2020, 01:21:01 amOh wow, thanks for mentioning this... So according to the datasheet:For 3.3V safe clock would be 13.4MHz:Code:Min = 2.7VMax = 4.5VDelta = Max - MinCur = 3.3VDeltaCur = (Max - Cur) / DeltaFreq = Min * DeltaCur + 20 * (1 - DeltaCur)I'll change my schematic to use a 8Mhz crystal instead. thanks!Quote from: Renate on September 13, 2020, 02:34:50 amHey! Thats an option yeah, I just feel a bit more comfortable with the 328 as I used it more.

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 09:55:16 am
content: Fixed a few things:- USB test wasn't grounded- SPI wasn't wired to the correct pins- 8MHz crystal as its within the safe operation area- Added some stuff: ICSP header, LED, bat voltage dividerI think for this initial version I'm going to keep the FT23 as it will make things easier for the development of the firmware, however, it should be possible to get rid of it.

author: Renate
author_rank: Super Contributor
timestamp: September 13, 2020, 11:03:36 am
content: Don't you need a couple of small caps on the XTAL?

author: krzysssztof
author_rank: Contributor
timestamp: September 13, 2020, 11:54:39 am
content: Where are the pull-up resistors for I2C protocol?Are they embedded in any of the chips?If not, you may want to add them or at least prepare footprints on PCB.

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 11:57:48 am
content: Quote from: Renate on September 13, 2020, 11:03:36 amNow that you mention this, the hardware design considerations uses caps on the crystal... Interesting that the Arduino NANO schematics (https://www.arduino.cc/en/uploads/Main/Arduino_Nano-Rev3.2-SCH.pdf) don't have it..

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 12:02:08 pm
content: Quote from: krzysssztof on September 13, 2020, 11:54:39 amI think the lines have internal pull-ups. The wire library (arduino framework) then enables the pull ups. I wonder if they are strong enough? The PCB size is going to be small, and I don't need max speed. So maybe this can work with the internal pull-ups. Could be wise to have the footprints just in case...

author: cgroen
author_rank: Unknown
timestamp: September 13, 2020, 12:07:16 pm
content: Quote from: nachocpol on September 12, 2020, 10:57:28 pmHow are you going to measure velocity (on an R/C plane) with the components listed ?

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 12:13:38 pm
content: Quote from: cgroen on September 13, 2020, 12:07:16 pmCan be extracted from the acceleration, it will be noisy, but its a start.

author: Mecanix
author_rank: Frequent Contributor
timestamp: September 13, 2020, 12:15:39 pm
content: The environment and conditions that system will be subjected too seems rather hostile for a SD card design (vibrations, linear forces, etc). Consider using fixed flash memory (sop8?). Sorry for being completely off-topic, just an observation that's all. Looking good/cool otherwise. To The Sky!

author: cgroen
author_rank: Unknown
timestamp: September 13, 2020, 12:17:19 pm
content: Quote from: nachocpol on September 13, 2020, 12:13:38 pmYou can't get velocity on an R/C plane from acceleration (at all). You will need airspeed (differential pressure sensor) or as a sub-optimal solution (very sub-optimal) a GPS.PS: I have been doing some of this for "some time" in my spare time:https://moonbounce.dk/electronics-for-rc-models.html

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 12:25:07 pm
content: Quote from: Mecanix on September 13, 2020, 12:15:39 pmThis is something I'm a bit worried about, it may be wise to add a small SRAM IC just in case.

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 12:27:44 pm
content: Quote from: cgroen on September 13, 2020, 12:17:19 pmWouldn't be possible to do something like:Code:t = fixed delta timea = current accelerationv(t) = a * t + v(t-1)That said, my main use case for this is model rocketry (mainly interested in raw accel and barometric pressure). But I thought I would be possible to reconstruct the velocity (at least poorly).

author: Renate
author_rank: Super Contributor
timestamp: September 13, 2020, 12:42:47 pm
content: Not to be a party pooper, but wouldn't this do everything that you want?https://www.adafruit.com/product/2795On the xtal/capacitor question, that linked schematic seems to show capacitors. There is no BOM.Some Arduino stuff uses resonators instead of xtals.Wouldn't you want GPS in there too?Oh, for extra credit you could make the USB appear to be a flash drive.

author: nachocpol
author_rank: Contributor
timestamp: September 13, 2020, 01:02:48 pm
content: Quote from: Renate on September 13, 2020, 12:42:47 pmIt's missing the IMU and barometer! GPS would be a nice addition, for now I want to get a basic version right.

author: ledtester
author_rank: Super Contributor
timestamp: September 13, 2020, 03:03:12 pm
content: If you're not aware of it already you might be interested in the OpenLog open-source firmware:https://github.com/sparkfun/OpenLogIt's written to run on a 328P.

author: tszaboo
author_rank: Super Contributor
timestamp: September 14, 2020, 04:45:44 pm
content: You need a lot more bypassig capacitors. An SD card could eat 200mA for example with jumps in the current. And place a separate cap next to each supply pin separately.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 15, 2020, 10:18:13 pm
content: You have a resistive voltage divider for measuring the battery voltage of 10k and 33k, which suck a lot of current out of your battery, and you probably can't turn it off.You can use resistors in the mega ohm range, if you combine it with a capacitor.The ADC pin is mostly a capacitive load which has a very short sample, and a long hold time.If you add a capacitor to the voltage divider then it "swamps" the input capacitance of the ADC

author: ledtester
author_rank: Super Contributor
timestamp: September 16, 2020, 06:48:37 pm
content: Quote from: Doctorandus_P on September 15, 2020, 10:18:13 pmWhat about switching the lower end of the voltage divider with a GPIO -- like this:https://www.eevblog.com/forum/projects/how-to-prevent-battery-over-discharge-while-running-unnattended-circuit/msg3232554/#msg3232554

author: fourfathom
author_rank: Super Contributor
timestamp: September 16, 2020, 07:10:38 pm
content: I'm using the SAM D21 for small projects. It has built-in USB interface, and an internal clock oscillator (no xtal needed).

author: nachocpol
author_rank: Contributor
timestamp: September 17, 2020, 08:06:48 am
content: Quote from: fourfathom on September 16, 2020, 07:10:38 pmThanks for the recommendation, definitely worth keeping in mind!Quote from: ledtester on September 16, 2020, 06:48:37 pmOh nice one, I would've never thought of that.

author: tszaboo
author_rank: Super Contributor
timestamp: September 18, 2020, 10:50:27 pm
content: Quote from: nachocpol on September 13, 2020, 11:57:48 amAnd now I see this. Here is a story for all engineers and hobbyist:Please dont ever use the original Arduino schematic as an example. Or to prove a point. It's bad. It is really bad.The schematic is bad. The layout is bad.If a circuit works, it doesnt mean it is properly designed.

author: nachocpol
author_rank: Contributor
timestamp: September 20, 2020, 10:31:39 am
content: Quote from: NANDBlog on September 18, 2020, 10:50:27 pmThanks for the heads up. I didn't know it was that bad, I'm not an EE, just a hobbyist trying to get things done. Arduino being a commercial product that I have used, gives me a degree of confidence to at least have a reference.

author: bsodmike
author_rank: Regular Contributor
timestamp: September 21, 2020, 02:43:44 pm
content: Quote from: NANDBlog on September 18, 2020, 10:50:27 pmDo you have an example of this done right then? Wouldn't ATmel chip docs be a better source for application circuitry?

author: tszaboo
author_rank: Super Contributor
timestamp: October 13, 2020, 09:38:47 pm
content: Quote from: bsodmike on September 21, 2020, 02:43:44 pmYes, absolutely. Atmel/Microchip has application notes on their website. And they provide reference designs.Much better design resource:https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATMEGA168PB-XMININotice, how they managed to place the bypassing capacitors next to the chip, where they belong? Or how the USB port has ESD protection? Or how they didnt place a bunch of electrolytic capacitors on the board, because why would you, if you have the same value in an MLCC?