Pic 16f873/nrf24l01 power problem - body capacitance?

Discussion in 'Embedded Systems and Microcontrollers' started by Russell, Dec 2, 2015.

  1. Russell

    Thread Starter New Member

    Sep 20, 2006
    7
    1
    Hi All

    I'm trying to build a man overboard device for a yacht. The idea is that an nrf24l01 module on the yacht sends a message to a similar module which each crew member carries. If the crew member's module goes out of range the device on the boat sounds an alarm and can issue a man overboard instruction on the instrument bus - and possibly put the rudder over so the boat will go in circles rather than disappearing into the distance. Each nrF24l01 is controlled by a microcontroller.

    The circuit for the boat based device is giving me trouble.

    The board has two voltage regulators to provide 5v power for an LCD display and 3.3V power for the nfr24l01. Each has a 330nF ceramic chip capacitor on the input and a 100nF ceramic disc on the output. as suggested by the datasheet They are arranged sequentially so the 5V feeds the 3.3V. There is a six pin header for programming the PIC and a 10 pin header for connecting the RF module. There are a couple of transistors for reading and sending messages to the yacht's instrument bus. There's also an LED.

    I have built the board and so far just programmed the PIC to test the LCD and PIC. I have tried powering this in two ways. Powered from the PicKit 3 at 5V it works OK - but that doesn't need the voltage regulator. Powered from a 9V wall wart it doesn't work properly - except that if I touch the track side of the PCB virtually anywhere it works fine. I've tried adding a 100uF electrolytic across the supply which made no difference. I've measured the regulated voltages at 4.99 and 3.25 volts. By not working I mean that the PIC continually resets.

    Because it works when I touch the PCB I suspect the capacitance of my body is affecting it but I can't see how.

    I attach a schematic and I'd be grateful for any suggestions or advice.

    Russell

    schematic.png
     
  2. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,969
    744
    I would say the wall wart is at fault or the 5V regulator is at fault, put1000uf capacitors on the input,output of the regulator.

    Have you programmed the not mclr?

    if it works ok from the programmer putting 5v in, the pic is ok, do you have another psu like 12v from an atx supply?
     
    Last edited: Dec 2, 2015
  3. Russell

    Thread Starter New Member

    Sep 20, 2006
    7
    1
    Thanks for the suggestions. I'll report back later.

    Russell
     
  4. Picbuster

    Member

    Dec 2, 2013
    373
    50
    Correct pull-up 4k7 and 100nF to mclr (cap on chip).
     
    MaxHeadRoom likes this.
  5. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    A properly balanced sailboat won't need a device to move the rudder when a hand is removed from the tiler. Talk to a rigger and have him put some weather helm into the yatcht. The very fact that you are having issues in your lab is only a small indication of the issues you will see in a harsh marine environment. And you can add issues you might have with the desiel and on board electronics. So keep it simple and get your yatcht properly trimmed. The best thing to do is not fall OB in the first place and be harnessed when in the cockpit alone.
     
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    And a linear regulator is the wrong way to go for this application. You will be dumping an enormous amount of energy via heat from 12v down to 3 or 5v.
     
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,505
    2,367
    I agree with picbuster, no pull up on the MCLR.
    Max.
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Yep MCLR needs a pull up. Those of us who have been caught by the "works with PICkit but not without" know to look for that first.

    You have a bigger problem in mixing 3.3 and 5v devices: a 5v pin driving a 3.3v device will try to power the device thru it's input pin.

    I would drive both the PIC and the rf thingie off the 3.3 and just the display on the 5v. Most displays I have seen just need 2v min as a logic hi so the display needs no extra level translation.
     
  9. Russell

    Thread Starter New Member

    Sep 20, 2006
    7
    1
    Thank you for all those suggestions. I'm pleased to see there's a consensus emerging on what the problem is.

    Thanks especially to ErnieM for suggesting that it is not an uncommon mistake.

    I agree spinnaker that not falling overboard is a much better solution - but releasing the wheel won't make the boat round up into the wind if it has an autopilot. The idea is not to replace existing safety systems but to improve what we have. It's not my boat but I'm interested in the technical challenge. There is already a PIC based remote control for the autopilot so that you can issue an "engage autopilot" command on the instrument bus - as the autopilot isn't in reach from the helm - so I'm confident it can be made to work in the marine environment.

    I'm not too worried about the power loss - it should only draw 10 - 15mA and the power lost in the regulators will only be milliwatts but I chose a 78L05 because I'm familiar with it and I had some. What would be a better choice?

    The RF module input pins are 5V tolerant so I decided to run the PIC at 5V along with the display. I established that the PIC could talk to the RF module on a breadboard and I admit it never occurred to me to run the display at 3.3V.

    This is a learning experience for me, and I'm grateful for your help.

    Russell
     
  10. JohnInTX

    Moderator

    Jun 26, 2012
    2,339
    1,022
    I wouldn't use a 78L05.. its hard to get enough power out of it without a snap-on heatsink and they make for a flimsy setup. Been there. You could get away with a 7805 in a TO-220 case probably. I also like TI's simple switcher stuff. Efficient and you can get lots of power out of it without the heat. If you run the numbers, you'll find that the linear regulators start to need heat sinking with even moderate current draws.

    In fairness, a few jabs at the 'lil Professor says that at 15ma you are OK with power dissapation. Still wouldn't use the 'L'05 - Fussy that way. Plus, projects have a way of growing..
     
    Last edited: Dec 3, 2015
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    You still power the display with 5v, just the digital inputs do not need to be 5v levels.

    Unless your device is different from those I have used.
     
  12. rgallo2007

    New Member

    Dec 3, 2015
    2
    0
     
  13. rgallo2007

    New Member

    Dec 3, 2015
    2
    0
    i have run into this sort of problem in the past and half the time it is a bad solder joint on ground....for good measure i would re-flow everything.
     
  14. Russell

    Thread Starter New Member

    Sep 20, 2006
    7
    1
    I've added the pull up resistor and capacitor to Mclr and now all the hardware works as expected.

    Thanks again for the help.

    Russell
     
    ErnieM likes this.
Loading...