A few teething problems

A couple of teething problems in my board design. Lessons learnt and problems solved!

Design philosophy


Because you get 3 boards from OSHPark, and really I only needed one for this project, I wanted to 'future-proof' my board so that I could use the other two effectively as an Aruduino-type board for other future projects.  Therefore I have broken out every pin that I can and added convenient sockets for the following peripherals, which are likely to be useful in future projects (as well as in this one):

- Bluetooth module (HR-04)
- nRF240l radio
- GY-86 10-DOF module (MPU6050 + MC5883l + MS5611)
- Onboard EEPROM 4Mbits/500kbytes (a25l040-f AMIC)
- ISP: Programming chip and flashing with bootloader for Arduino GUI use.
- FT232RL for convenient serial USB communication.

It's always a bit of a pain to wire up the nRF2401 radios and with this board design I can very easily drop on into the correct socket, and also add a bluetooth module and not having to worry about wiring things up correctly or adding the necessary capacitor across the power pins (in the case of the nRF240l module). Very neat and tidy.  I've also added room on the board for a 3.3V SMD EEPROM chip, for adding extra storage.

Power play

So I've soldered up the board, flashed the chip with my program, which previously only existed in the context of a messy breadboard, and everything looks great and is working great!  Initially it's powered by the USB connection, everything lights up and the serial port output tells me all the peripherals are responding as expected - including crucial the serial port FT232RL chip.  I was pretty pleased with my soldering skills on that one, definitely a soldering level up and +10 EXP.  All the power buses 5V, 3V3 and GND read out as expected.  The 3.3V output is provided courtesy of the 3V3OUT pin 17 on the FT232RL chip, which can provide up to 50 mA of current.

BUT something funny happens when I switched to the 5v regulated input coming either the ISP programmer, or the 5V BEC regulator from the quadcopter LiPo.  I no longer get 3.3V on the output, in fact I had about 4.3V.  After much double (triple, quadruple...) -checking of all the FT232RL pin connections, the schematic, the board layout, the datasheet, my soldering job under a magnifying glass and with a connection probe, nothing amiss was apparent.   I decided to cut my losses and de-solder the 3V3OUT pin of the FT232RL chip and add in a 3V3 regulator instead.  Weirdly, when I cut the pin connection and checked the voltage on the now isolated 3V3 output against GND, I still got 4.3V...!  Something was definitely pretty wrong, but now I had a very firm suspicion that the SMD EEPROM chip was to blame.  Interestingly the bluetooth told me that the Atmega328p could still read the EEPROM IDs and it was functioning well... without any input power!  When I disabled the SPI interface in software, I could finally read the expected 0V on 3V3.  Clearly this pointed to the chip was being backpowered through the SPI inputs and outputing 4.3V on the 3V3 bus.  This is totally my fault - the chip is 3.3V device, but the inputs I'm providing from the Atmega328 chip are 5V.  I tested this extensively on a breadboard before hand and it was not a problem, though clearly I am operating the chip beyond the specifications and run the risk of burning out the chip.  So the 5V SPI inputs to the chip were back-powering it and outputing 4.3V to the 3.3V bus.  An improved design would use a level shifter to correct this.  In either case, I can salvage my design with a 3.3V diode across the power input, or better, using a 3.3V linear regulator.  I opted for the latter option, with a TS1084 which frankly was the only one that I could get my hands on very rapidly and seems to do the job - the pinout is perfect for dropping into place in the 5V-3V3-GND pinouts.  In retrospect this is a better solution than using the FT232RL as a 3.3V power source, as I may want to draw more than 50 mA in the future.

Incidentally, there is a jumper between the quadcopter BEC and the 5V line in order to use the battery as the power source.  I decided not to add a regulator to this input as it is already regulated from the LiPo battery, and from the USBtiny ISP.  To prevent back powering of the USB when an alternative 5V is being used, an MBR0520 Schottky diode is employed.

Capacitors

Whoops, I added a capacitor in series for nRF240l power supply, rather than in parallel across the power inputs!  Easily corrected with a small piece of wire and soldering in a capacitor across the 3V3 linear regulator.

I also neglected to put a capacitor between Aref and GND - this means I can't do the ADC measurements I wanted to for low battery detection :(. I'll have to use a digital pin input and configure the resistor divider for the battery voltage so that the low battery threshold delivers 3V (the HIGH to LOW transition voltage at 5V). EDIT: In fact, I will bend up/cut the Aref pin (pin 21) so that it doesn't make contact with the board, and either leave as unconnected, or solder a capacitor across to GND (which conveniently is adjacent pin 22)

These relatively minor problems were solved and the board works precisely as expected!  Now to develop the software to the point where I can control input by radio, and also tune the flight PIDs remotely.

Comments

Popular posts from this blog

Getting started with the Pro Micro Arduino Board

Arduino and Raspberry Pi serial communciation