Ask for review: Weather Station PCB project

Discussion in 'The Projects Forum' started by inoskyh, Apr 11, 2015.

  1. inoskyh

    Thread Starter New Member

    Apr 11, 2015
    13
    0
    Hi community,

    I'm currently working on a simple Weather Station project that gather some environment measures (barometric pressure and temperature with BPM180, luminosity with TSL2561 and relative humidity with HTU21D) and broadcast them over RF using a nRF24L01+ module. I also wanted to experiment SMT and airflow soldering so I put 0805 and SMT parts on my board.

    I reached a point where I feel quite confortable with the project's schematic and board I designed.
    So now I'd like to to challenge what I produced with experts to reveal if I made some mistakes and correct them before producing some boards (I plan to use OSHPark).

    Following schematic and board was designed on Eagle 7.2 Light Edition:

    [​IMG]
    [​IMG]

    In addition to your reviews, I also have some question:

    I plan to program my uC (an Atmel 328p) using SPI ISP and an AVR USB programmer, but not with a soldered connector but directly with pogo pins as mentioned here and here. Do you have any feedback on this technique?

    I want to measure the VIN (battery voltage/charge), so I implemented what is described in this Arduino forum post, ie. use uC's ADC with a voltage divider. The voltage divider in the schematic was sized to decrease a 5V voltage to 1V (to be compatible with the ADC internal 1.1V voltage reference) but I now want to ensure that the VIN never goes above 5V to protect the ADC. I read here and there that I could use two Schottky diodes (eg. SS34 aka 1n5822) or a Zener diode. What is the best in your opinion?
    Edit: with Schottky diodes, I have to connect one diode from line to a 5V reference but I don't have one on the board since I regulate the input to 3.3V (see the power rail on the schematic). Is there any solution?

    The SMT 0805 RGB LED seems quite common part but I still have a doubts whether it's common anode or common cathode (schema shows common anode but their is no description on the part I bought). I'll probably have to test myself once I receive the parts.

    Some blogpost about nRF24L01+ module mention that transmission can cause a current peak and make module behavior unstable. A solution is to put a CAP close to the 3.3 VCC and GND pins. I chose a 4.7uF one but it was an empirical choice based on reading. How can we size it correctly?

    Thanks a lot for your help!

    Kind regards,
    Nicolas
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I see a few things:

    The LM317 needs 3V in to out to work. You're not getting that off the 5V USB, so switch to a low dropout regulator (and get a fixed value on while you are at it).

    The I2C bus needs pull up resistors. 4.99K to Vcc is a typical value on both the SCL and SDA lines.

    I would not recommend flowing the ground plane underneath the SMD R's and C's as it is prone to shorting where you cannot see if the mask has a pinhole. If you don't use a solder mask then don't even think of doing this.

    As far as the cap on the nRF device every part typically need a bypass cap. A ceramic o.1uF and occasionally a o.oo1uF as close as possible to the power pins is typical for high frequency rejection. Larger values (tantalum or electrolytic) for low frequency bulk rejection are also needed, usually one device at the power regulator source is adequate, especially on a small board like this.

    For overvoltage protection the schottky is probably best. Your part runs off 3.3V so connect it there, not 5V.

    I've used many methods for programming connections. Pogos into thru holes work well, and one can get away with just using header pins many times. Personally with my chips I will solder in header pins (they are cheap) so my programmer has a nice friction fit connector and can hang there for a while; my programmer also works as an in circuit code debugger.

    I don't use these microcontrollers so I make no comments there.
     
  3. MrChips

    Moderator

    Oct 2, 2009
    12,421
    3,357
    I design weather stations for commercial/industrial/agricultural applications.

    I find some short comings in your design.
    What battery or power source do you intend to use for your design? What is the run current and stop current?
    For a remote weather station, power source and current consumption is critical.

    In your design you are measuring:
    • temperature
    • atmospheric pressure
    • relative humidity
    • sunlight

    I would also add:
    • rainfall
    • leaf wetness
    • wind speed
    • wind direction
     
  4. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,518
    1,247
    Here is a super-ultra-minor-picky thing about the layout. For LED RGB, the traces to the top and bottom right pads enter at an angle and form an acute angle with each pad. Before the days of water-wash and no-flux soldering, old-school purist called this a flux trap, something to be avoided for very long term reliability.

    a
     
  5. inoskyh

    Thread Starter New Member

    Apr 11, 2015
    13
    0
    Hi ErnieM,

    Thanks a lot for your answer!

    You're right! I used an adjustable LM317 version and chose resistors value to produce 3.3V output. But after reading the datasheet, I did not considered the 3V-min dropout (3V<VIN-VOUT<40V). So, I have to switch the LM317 with a Low Dropout Regulator such as LM1117 or LM3940 (the first one seems more popular). Do you confirm?

    Here I planned to use the AT328P internal pull up resistors. I heard about capacitance consideration when dealing with I2C, but Since there is only 3 devices on the bus, I bet on the fact that this was sufficient.
    But after some research, I found this interesting Stackoverflow: "From what I've read1, ATmega have 20kΩ internal pull-ups, which can be enabled or disabled from the firmware. 20kΩ is way too weak for the I2C pull-up. But if the bus has a low capacitance (physically small) and communication is slow enough, then 20kΩ can still make the bus work. However, this is not a good reliable design, compared to using discrete pull-up resistors."
    Thus, I definitely need to add pull-up resistors, but how to find their values? And how to calculate total capacitance from the I2C devices on the line?

    There will be a solder mask (see attached images) and as suggested in the Sparkfun tutorial, I increased the isolate to 0.012”. What do you mean by "if the mask has a pinhole"?

    I put 0.1uF and 1uF around the regulator as advised in the datasheet to negate noise. I understand that it is not enough and that I should put a CAP in front of each device, you agree?
    How calculate the value of the low frequency bulk rejection cap?

    The problem is that I want to measure VIN (battery charge) value using the ADC. If I put a Schottky between VIN and the regulated 3.3V reference, I will not read VIN value but 3.3V (that should not vary up to the point the battery is discharged) since it will conduct?

    Yeah, debugging is a good reason to solder a header and let programmer's hands free :)

    Nicolas
     
  6. inoskyh

    Thread Starter New Member

    Apr 11, 2015
    13
    0
    Hi MrChips,

    Actually this is a first version of the board, I did not even think about energy consumption yet!
    But for now, it is intended to be used with computer USB and/or 5V USB battery (~3000mAh).
    Measures will be taken each 3 or 5 minutes.
    I also planned to work on MCU sleep modes to improve consumption, I think it should be enough?
    I have no idea about how to proceed to estimate/measure current consumption in various modes.

    Those are good ideas! Thanks :)

    Nicolas
     
  7. inoskyh

    Thread Starter New Member

    Apr 11, 2015
    13
    0
    Hi AnalogKid,

    Good to know! Do I have to expect some issues when soldering or flux and mask will do the thing here?

    Nicolas
     
  8. MrChips

    Moderator

    Oct 2, 2009
    12,421
    3,357
    Simple. Insert an ammeter into the supply circuit and measure the current during RUN and STOP modes.
    You want your MCU to be in STOP mode. Then use a 32.768kHz crystal driven RTC to wake up the MCU every interval (2 to 5 minutes) to take measurements.

    LM317 is an energy hog. You want to get rid of that.
     
Loading...