Author Topic: PIC holes in my project  (Read 645 times)

0 Members and 1 Guest are viewing this topic.

Offline PerranOak

  • Regular Contributor
  • *
  • Posts: 166
  • Country: gb
PIC holes in my project
« on: February 19, 2019, 03:37:57 am »
HI,

May I humbly offer my project for inspection/criticism. Firstly, my apologies for the diagram: I have no software to draw circuits so I forced LTSpice to do it(!)

It measures temperature (using and LM35) and displays the same on three standard 7-seg LEDs. The PIC is the 16F1827. The pot alters the display brightness, the switch selects between immediate display and logging to EPROM and the button is a selector for various time gaps between recordings.

The MOSFET is there to turn-off the LM35 and the pot between logging measurements as these were using “lots” of current. I need to use the PIC and the LEDs that I have: the whole point is to use-up some old components I had lying about; I’m not tied to the MOSFET though.

It seems to work ok but I wanted to run it by you guys before I commit to building it “properly” – it’s currently on a breadboard.

Any and all comment gratefully received, thank you.
 

Online hexreader

  • Regular Contributor
  • *
  • Posts: 153
  • Country: england
Re: PIC holes in my project
« Reply #1 on: February 19, 2019, 03:45:45 am »
First thought is that there is no 0.1uF (typical value) decoupling capacitor close to the PIC power lines.

You show a few pF capacitor, but I don't see that it serves any useful purpose

Second thought is - what is that strange component called "switch" ?  Is it a device that shorts out the battery? probably not, but it looks that way on your schematic. My guess is that it should really have the same circuit as "button"

Forgive my limited understanding

« Last Edit: February 19, 2019, 03:52:57 am by hexreader »
Don't post drunk - and don't ask why I say that
 

Offline ebastler

  • Super Contributor
  • ***
  • Posts: 2374
  • Country: de
Re: PIC holes in my project
« Reply #2 on: February 19, 2019, 04:30:34 am »
I am surprised that the MOhm pot and the LM35 contribute such a significant current. How often do you turn on the LEDs, which must dominate the current sonsumption by far? How much current do you measure through the pot and LM35?

If you indeed want to switch the LM35 and pot, do you really need a separate MOSFET? Looks like you could easily power them directly from a PIC output pin?

I agree with hexreader that your "switch" is wired funny. It probably is connected to the positive supply via a resistor, rather than directly as shown? Also, what's up with the potentiometer connection? What are the two outputs on its right, which you have shorted together?

As a general question -- when you say you want to build this properly, do you want to create a PCB? It does not look like you drew the schematic with a proper schematic & layout package. What tool did you use so far, and how do you intend to create a PCB layout (if that's what you want to do)?

[Edit : Ah, sorry; you had mentioned LTSpice. DIPtrace or the free, limited version of Eagle are a better choice, I think. Both offer PCB layout in addition to schematic capture.]

Sorry -- lots of questions... But maybe some food for thought?
« Last Edit: February 19, 2019, 05:37:05 am by ebastler »
 

Online MarkF

  • Frequent Contributor
  • **
  • Posts: 904
  • Country: us
Re: PIC holes in my project
« Reply #3 on: February 19, 2019, 05:17:54 am »
HI,

May I humbly offer my project for inspection/criticism. Firstly, my apologies for the diagram: I have no software to draw circuits so I forced LTSpice to do it(!)


Download Diptrace (Free version:  2 layers and 300 pins) for schematic and PCB layout. 
I found it very intuitive and easy to learn.
   https://diptrace.com/download/download-diptrace/

 

Offline PerranOak

  • Regular Contributor
  • *
  • Posts: 166
  • Country: gb
Re: PIC holes in my project
« Reply #4 on: February 21, 2019, 02:02:53 am »
hexreader, thank you for replying.
Yes, sorry, I have been told, on this forum, many times not to forget the 0.1uF cap so what did I do? Forgot it! Cheers.
I was experimenting and when I put in the 20pF cap, the stability improved. Maybe I’ll not need this on the PCB version.
Switch is drawn very badly as I couldn’t find a real switch on LTSpice. It is shown wrongly because what it really does is to take pin RA5 either high or low in order to select the mode.

ebastler thank you too.
I should have said that the LM35 and pot take too much current when the unit is in logging mode during which the PIC sleeps and the display is off. This can be for up to an hour so it seemed like a good idea to reduce the current and preserve the battery. Before the MOSFET it was taking around 100uA to 200uA depending on the software.
Again, apologies for the diagram of the switch (see above) and the pot: there was no pot in LTSpice but, in reality, it is wired correctly on the board.
Indeed, I do wish to get a PCB properly made so that I can take a simple project “all the way”.

MarkF thank you for that, I’ll go and look. I was going to use EasyEDA to get it made.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 1658
  • Country: gb
  • 100% Brand New and High Quality, in theory.
Re: PIC holes in my project
« Reply #5 on: February 21, 2019, 02:41:35 am »
"I should have said that the LM35 and pot take too much current when the unit is in logging mode during which the PIC sleeps and the display is off."

Doesn't make sense to me. The LM35 only needs 0.1mA so could be powered by a digital output. The outputs stay powered during sleep so turn it off before sleep. :-//
 

Offline ebastler

  • Super Contributor
  • ***
  • Posts: 2374
  • Country: de
Re: PIC holes in my project
« Reply #6 on: February 21, 2019, 03:06:03 am »
The LM35 only needs 0.1mA so could be powered by a digital output. The outputs stay powered during sleep so turn it off before sleep. :-//

Thanks, StillTrying. I was about to ask the same again, since PerranOak had not commented on that part of my question/proposal in reply #2.
 

Offline PerranOak

  • Regular Contributor
  • *
  • Posts: 166
  • Country: gb
Re: PIC holes in my project
« Reply #7 on: February 21, 2019, 04:00:55 am »
Sorry ebastler I did miss that bit and thanks for picking it up StillTrying.

Do you mean the actual LM35 Vs pin to be powered from a PIC pin rather than being connected to the power rail?

I didn't think of that. So, I would use pin RA6 not to switch the MOSFET but rather to "power" the LM35 and the pot? This doesn't cause problems with noise from the PIC?
 

Offline ebastler

  • Super Contributor
  • ***
  • Posts: 2374
  • Country: de
Re: PIC holes in my project
« Reply #8 on: February 21, 2019, 04:14:35 am »
Yes, that's what I thought (and StillTrying as well): Power the LM35 and pot directly from a PIC output pin. I'm cheap and lazy.  ;)

I would not expect major noise problems. And you could always add an RC lowpass to filter the output pin's voltage a bit if needed.
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Re: PIC holes in my project
« Reply #9 on: February 21, 2019, 08:13:50 pm »
Switch is drawn very badly as I couldn’t find a real switch on LTSpice. It is shown wrongly because what it really does is to take pin RA5 either high or low in order to select the mode.

Rather than switching it high or low, I would tie it high or low via a resistor and use the switch to pull it to the opposite rail. This would seem more traditional to me anyway.

Granted, flicking a switch doesnt take very long, but ideally you dont really want inputs to be floating for any amount of time. It could also be somewhat of a "safety" mechanism in that respect, incase the switch fails or makes bad contact.
 

Offline PerranOak

  • Regular Contributor
  • *
  • Posts: 166
  • Country: gb
Re: PIC holes in my project
« Reply #10 on: February 22, 2019, 09:44:12 pm »
Brill will do, cheers both.

Oh, BTW, what value of cap should I have across the battery?
« Last Edit: February 22, 2019, 11:55:11 pm by PerranOak »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf