PIC holes in my project - Page 1
Forum section: electronics / general

author: PerranOak
author_rank: Frequent Contributor
timestamp: February 18, 2019, 04:37:57 pm
content: 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.

author: hexreader
author_rank: Frequent Contributor
timestamp: February 18, 2019, 04:45:45 pm
content: 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 purposeSecond 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

author: ebastler
author_rank: Super Contributor
timestamp: February 18, 2019, 05:30:34 pm
content: 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?

author: MarkF
author_rank: Super Contributor
timestamp: February 18, 2019, 06:17:54 pm
content: Quote from: PerranOak on February 18, 2019, 04:37:57 pmDownload 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/

author: PerranOak
author_rank: Frequent Contributor
timestamp: February 20, 2019, 03:02:53 pm
content: 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.

author: StillTrying
author_rank: Super Contributor
timestamp: February 20, 2019, 03:41:35 pm
content: "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.

author: ebastler
author_rank: Super Contributor
timestamp: February 20, 2019, 04:06:03 pm
content: Quote from: StillTrying on February 20, 2019, 03:41:35 pmThanks, StillTrying. I was about to ask the same again, since PerranOak had not commented on that part of my question/proposal in reply #2.

author: PerranOak
author_rank: Frequent Contributor
timestamp: February 20, 2019, 05:00:55 pm
content: 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?

author: ebastler
author_rank: Super Contributor
timestamp: February 20, 2019, 05:14:35 pm
content: 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.

author: TomS_
author_rank: Frequent Contributor
timestamp: February 21, 2019, 09:13:50 am
content: Quote from: PerranOak on February 20, 2019, 03:02:53 pmRather 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.

author: PerranOak
author_rank: Frequent Contributor
timestamp: February 22, 2019, 10:44:12 am
content: Brill will do, cheers both.Oh, BTW, what value of capshouldI have across the battery?