Electrical Issue: PIC input false triggering, Signal Noise suspected.


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    LinkM,

    Thanks for the great circuit sketch! I don't have any inductors on hand but if this works well, I would consider making a module of it for future uses of the reed switch as a sensor.

    I have an application question and to help explain it I have attached a schematic of my board. My traces on the etched board follow the lines on the schematic literally. You will observe that at PIC pins C4-C6 my three sensors are pulled up with 4.7k resistors to 5vDC. At the same connector I have a ground pin which further down the line combines the 3 grounds from the switches.

    My question is: Would it be good or bad practice to place the inductors further away outside the controller enclosure say under the table? This would necessitate for each of the 3 signal wires a length of lead wire maybe 6-12 inches away from the board itself (am I just creating another albeit shorter antenna?) The control enclosure is already pretty filled with stuff but maybe I could still fasten a daughter-board to take care of this function. I would really hate to redesign and rebuild my present main board yet again to integrate the inductors.

    Lastly since I am new to working with inductors could you spec or describe what I would be looking for number-wise from say the Digi-Key online catalog?

    Thanks.
    Attached Images Attached Images  

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    I'm not sure about the current required for the "run/stop, direction and turnout relays" but I notice you are sourcing the current instead of sinking it thru the PIC. That's bad design to me as most mosfet's even in the case of internal fet's in the PIC can sink more current than source. I would ideally use a NPN transistor for the relay drive circuits and feed them as a separate supply connection to the board where the power enters. I would also place a 10uF cap at the PIC pin's 19 & 20 along with the 100nF cap you already have. I also notice you have NO cap's for the display power circuits. I agree with Henrick that the ideal interface method is for optoIsolators on the inputs from the reed switches. If the wiring is run along side the track and the engine is running there is quite a bit of coupled energy into the inputs of the PIC as the engine is probably driven by a DC Brushed motor as well as the wheels making and breaking the circuit.
    Dave Purola,
    N8NTA
    EN82fn

  3. #3
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    Dave,

    As a novice I don't get exposure to best practices so this advice is very welcome. I will copy the info down and study it carefully. It will certainly be implemented in future designs that I explore. In my previous version of this control board I used relay driver IC's with single coil latching relays. They shared the same +5 and gnd traces with the PIC however. As far as sourcing current at the pin, since these relays are dual coil latching I only pulse them and no two relays are pulsed at the same time so I felt safe that I was not exceeding any pin source capability.

    I appreciate your suggestion that I should have caps for the display power. I will do further research on how to accomplish this.

    I think your last remark is on the money. As I mentioned in another reply, I run the trolleys off the overhead wire at times (I can switch between rail only & rail with overhead wire.) When running off the overhead, the trolley caenary arcs plenty. Talk about a "dirty" operating environment!

    I appreciate your comments.

  4. #4
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    abecker,

    I think your getting some excellent advice here. As I have said before there are world class programmers here (and also those knowledgeable in electronics design) and all are willing to help.

    For all this good advice I think you might owe us some pictures of your train setup and all that
    Having a train that actually has an catenary that actually works sounds pretty awesome!
    What a fun world to live in, down at the miniature level.
    And merging micro controllers and PIC BASIC... what could be better.

    You might consider wiring up a length of 6 conductor ribbon cable to the ICSP header then solder it up to a 6 pos header to plug your pickit into.
    that way you can easily impliment code changes without having to tear things apart.

    Nothing better than to be able to make code changes and test ideas out and see almost instant results.

    great stuff!!

    now if you have a few minutes check out this...
    http://hackaday.com/2016/01/17/the-s...ur-wunderland/
    It is awesome to go to google earth and get down in minature and roam around this model setup.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  5. #5
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    Heckler,

    I first discovered this thread by looking at a print ready version of the tree.

    My trolley system is at the beginning stages but all the track and overhead is assembled and in good working order when run manually.

    I am not at home now but I will send some photos of the table and the controller.

    I agree the advice has been very generous and I received more feedback than I expected. I would hope this thread is of use to others in the future with similar designs.

  6. #6
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    Voila! Photos as promised.

    I have yet to provide the scenery work but first things first- get it operating. Manual operation works as designed.

    The power (0-17vDC) from the speed control can be routed for overhead supply or to the tracks only by a manual switch. The yard turnout can be operated manually or via the PIC logic.

    Controller has an LCD and three buttons to program number of trips, seconds at east and west (future) stations or yard termination. Prompts for setting automation are displayed on LCD.

    I made the enclosure out of acrylic sheet so I could custom size it and intended to paint it gray but since it looks pretty cool as a transparent case I think I'll leave it that way.
    Attached Images Attached Images       

  7. #7
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    No offense, but I hope you are forced back here regularly as this build progresses. I would love to feel (in some small FREE way) that I had helped to make it come together. I've seen many genius level projects here, but my favorites are always those where knowledge is applied to passion.

  8. #8
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    No offense taken.

    Nobody has ever accused ME of being a genius but my tenacity has lead me to many learning opportunities.

    I will try several of the strategies offered by the contributors and hopefully if the problem gets resolved soon, I will report back.

  9. #9
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    Quote Originally Posted by abecker View Post
    I would really hate to redesign and rebuild my present main board yet again to integrate the inductors.

    Lastly since I am new to working with inductors could you spec or describe what I would be looking for number-wise from say the Digi-Key online catalog?
    Hi abecker,
    The inductors should be in your controller circuit because just as your intuition suggests, you will end up with a short antenna at the input of your box.
    If you have room at the reed switch connector, these inductors can be installed at the molex connector you have there by soldering each one inline with the wire going to the switch and the other side crimped to the connector pin. Be sure to shrink tube each one to keep from shorting to its neighbor.
    And it looks like you can put your filter caps at each (R1 pullup resistor and PIC input) to the nearest GND.
    Louie

  10. #10
    Join Date
    May 2013
    Location
    australia
    Posts
    2,689


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    another way is to filter the input with a software routine

    Code:
    reeds var byte
    reeds_flg var byte
    reed_1_active var reeds_flg.0            
    reed_2_active var reeds_flg.1
    reed_3_active var reeds_flg.2
    reed_cnt var byte[3]
    reed var byte
    define reed_threshold 64
    
    chk_reeds:
    reeds=portc & $70  ;c4 c5 c6  active low
    if reeds < 112 then
    reeds=reeds >> 4
    for reed = 0 to 2
    if ! reeds.0 then
            reed_cnt[reed]=reed_cnt[reed]+1 
            if reed_cnt[reed]> reed_threshold then reeds_flg.0[reed]=1
    else
            reed_cnt[reed]=0
    endif
    
    reeds=reeds>>1
    next
    endif
    return
    if you call the chk_reeds subroutine regularly (must be regular) say in this case 100 times per second, then if a reed input is consistently low for 64 (counts in a row the reed_threshold) then the reed_x_active flag will be set.
    Last edited by richard; - 12th February 2016 at 12:26. Reason: correction

  11. #11
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    Thanks Richard.

    This has great potential in my code because as you commented, once I set close the realys to the trolley power all I have to do is loop through the routine that checks for a low sensor. To make it easier, the trolley dbeing on a track can only go in on direction at a time so in each stage of travel I know exactly which sensor to poll. Not like I would need an interrupt to see which of the three sensors went low. The time the magnet is over the reed switch is eon's compared to the rate at which the pic can poll the sensor line.

    As I mentioned to one other reply, the pic advances to the next logical set of events just when the trolley gets moving and is several feet away from any sensor. This is what leads me to think some DC motor noise or even arcing of the pickup on the overhead wire is being picked up at the sensor pins and causing a false signal.

    I will study your code and possibly with it and many of the other outstanding suggestions here, find a solution which I will gladly report on.

  12. #12
    Join Date
    Jun 2015
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.

    LinkM,

    I appreciate your idea to inline the inductors and naturally shrink-tube saves the day for so many inline solutions like this.

    I did strike upon the idea of soldering the caps to the traces under the board because the board is on standoffs anyway.

    By the way in my searching the net for use of inductors and caps for noise filtering, I discovered some LC filter arrays in a single IC type package with 4 per chip, by TDK (series MEA) but it looked like they were narrowly designed and spec'd. for telecom use. Not understanding enough about LC filters I didn't know if the product series could have helped my situation. It was a very slick idea though having 4 filters on the chip. If that worked, it would be nice to put that on the main board in any new design I might come up with in the future.

    Thanks for all your help.

Similar Threads

  1. Intermittent reset of 16C6440 - possible noise issue
    By Christopher4187 in forum General
    Replies: 4
    Last Post: - 16th May 2012, 13:43
  2. Noise on input signal
    By fanman in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 28th February 2012, 03:55
  3. Electrical noise problem with PIC 16f84
    By Snap in forum General
    Replies: 11
    Last Post: - 26th September 2007, 10:36
  4. Input Noise
    By PJALM in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 28th February 2006, 20:26
  5. False Triggering I/O
    By pdegior in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th July 2005, 10:02

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts