Computer Display?


Closed Thread
Results 1 to 30 of 30
  1. #1
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322

    Question Computer Display?

    Hi All!
    I have a sensor that when I add about 1 meter of cable to the readings become wrong! I think the main problem is the pulses from the sensor are too fast so the PIC can only be a short distance. It would be great if there was a program I could download and display the results on the screen or maybe a different cable type than just shielded twisted wires?

  2. #2
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Quote Originally Posted by Ramius View Post
    Hi All!
    I have a sensor that when I add about 1 meter of cable to the readings become wrong! I think the main problem is the pulses from the sensor are too fast so the PIC can only be a short distance. It would be great if there was a program I could download and display the results on the screen or maybe a different cable type than just shielded twisted wires?
    Hyperterminal is one program which will display RS232 protocol.
    It is sometimes found in the Windows menu under Start>Programs>Windows Accessories>Communications.
    If not it can be downloaded.
    Another is TeraTerm.

    You will need a PC with a serial port or for newer PC's use a USB virtual serial port adapter.
    For longer distances a converter to and from RS485 with RS232 at both ends works well.

    You didn't say the baud rate in use.

    Others will have more info as well.


    Norm

  3. #3
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Thanks Norm!
    I do have a "newer computer with both USB and RS-232. If I look at the pulse width from the sensor with a Saleae Logic Analyser the pulse width from the sensor is very short an looks almost like it is at 2.4 MHZ although not closely spaced! The sensor clock is at 32,768. Since I am only displaying the data from the sensor I would think that a baud rate of 9,600 should be good? Don't really know for certain, never ran into this before. If I keep all the wires short (1' or less) everything seems to work fine. I just need to go a longer distance to read the sensor without having to build something complex and involved.

    Best, Ed

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Quote Originally Posted by Ramius View Post
    If I keep all the wires short (1' or less) everything seems to work fine.
    Hi. RS-232 should work for a distance much greater than 1'. I suspect something else is going on. What type of protocol are you using to communicate between the PIC and the sensor? Maybe noise in the line????

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    A link to the datasheet for the sensor in question, or at least a part number would be a good idea to post. Somehow Norm knew or assumed its output was RS232, something you didn't say in your first post, so my question is: Is it?

    If the sensor is indeed outputting async serial it may be doing so at TTL levels and your PC may not like that (even though it usually works for short distances) so you may need a MAX232 driver or something.

    A diagram showing how you have it connected would be nice as well.

    But again, without even knowing what type of sensor you're talking about it's just guesses.

    /Henrik.

  6. #6
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Henrik!
    The sensor is the infamous MS5541-CM and I believe the protocol is SPI. Basically the sensor to a 3v to 5v converter to the PIC then from the PIC to a MAX232-cpe to the computer. At short distances from the 3-5v converter the sensor readings are "normal", that is you will accurately read room temperature for example. As the cable from the 3-5v converter becomes longer the room temperature reading becomes abnormal such as -1434C. First cable was a shielded 6-wire, 22 gauge cable. Then I tried a ribbon cable with signals on every other wire with ground at one end only for the wires inbetween the signal wires to avoid cross talk and any ground loops.

    Best, Ed

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    OK, so the problem is not with the cable to the PC then....

    More questions:
    1) The sensor needs an external clock of 32.768kHz (typically), how are you feeding it that clock signal? Thru the same cable?
    2) The maximum SPI clock frequency (not the same as above) is 500kHz, what frequency are you using and are you using the MSSP module in the PIC or SHIFTIN/SHIFTOUT?

    Again, a diagram showing what you have and exactly how it's connected really does make it a lot easier when trying to help. What's that 3-5V converter for example?

    /Henrik.

  8. #8
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Ramius

    If it's the RS232 cable to the PC you are trying to lengthen try setting the RS232 baud rate slower.
    As a rule reliability goes up when the baud rate is slower.

    Norm
    Last edited by Normnet; - 7th August 2013 at 18:59.

  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Ed,

    Sometimes that 3v/5v converter for the communication lines are not needed. Are you converting the SPI lines to 3v going into the sensor? For a long cable there are already losses. Try your setup without the DC/ DC converter.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  10. #10
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Quote Originally Posted by rsocor01 View Post
    Ed,

    Sometimes that 3v/5v converter for the communication lines are not needed. Are you converting the SPI lines to 3v going into the sensor? For a long cable there are already losses. Try your setup without the DC/ DC converter.

    Robert
    A 5 volt pullup resistor also can help when not using a 3v/5v converter.

    Norm

  11. #11
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi All!
    Basically the sensor goes into a TXB0104 at 3v and from the TXB0104 at 5v into the PIC. I have been trying to extend the 5v side from the TXB0104 to/from the PIC with Shiftin and Shiftout. This has clearly been a problem for others after several hours of searching the internet and no one seems to have published a solution. From the PIC 18F1320 through a MAX232CPE into Com1 using the ICD in PicBasic Pro you can see all the readings. While very difficult to do I did manage to place a 47mfd tant. cap to the back of the sensor so it could not be any closer/shorter! Attached is the drawing. Ed
    Attached Images Attached Images  
    Last edited by Ramius; - 8th August 2013 at 03:17.

  12. #12
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    Personally I would not trust the 3.3V power supply setup you've got going there. The current consumption of both the sensor and the "A-side" of the TXB0104 will most likely not be constant meaning the voltage drop across that resistive divider will change resulting in an unstable 3.3V supply rail. Now, the cap you fitted obviously will help but I still don't think it's good solution. I'm not saying it will fix your issue but I would at least try with a proper 3.3V supply for the sensor and the A-side of the TXB0104 - at least to rule it out.

    Also, make sure you have a decoupling capacitor on the VccB pin of the TXB0104. As you extend the cable length the capacitance of the cable increases, that capacitance will need to be charged and discharged by the driver circuitry in the TXP0104. It'll need proper decoupling.

    Are you generating the 32.768Hz clock for the sensor with the CCP module in the PIC?

    /Henrik.

  13. #13
    Join Date
    Apr 2011
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Parallel a 0.1uF capacitor across the 47uF. Whilst the 10k pot to derive the 3V supply is very crude you show no decoupling of the 5V supply itself or the attached ICs - all of which are required.

    The data lines to the PIC should be via twisted pair and, if necessary, decoupled to ground themselves.

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?


  15. #15
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Guys!
    Thanks and I actully did place some .1 caps across the 3v and 5v side. Just added a 100mfd to both the 3v and 5v side of the TXB0104. How things are built is there is a small proto board about 4" from the pic which has the TXB0101. Then the sensor connects to the same board. I would love to be able to add a .1 on the back side of the sensor with the 47mfd cap. and just connecting what I have connected has been a real challenge. Damn stuffs too small! Lol Best, Ed

  16. #16
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Quote Originally Posted by kellyseye View Post
    Parallel a 0.1uF capacitor across the 47uF. Whilst the 10k pot to derive the 3V supply is very crude you show no decoupling of the 5V supply itself or the attached ICs - all of which are required.

    The data lines to the PIC should be via twisted pair and, if necessary, decoupled to ground themselves.
    Good advice on decoupling 5V, but not good advice about adding 0.1 uF across the 47 uF. In some instances, for example using a large electrolytic capacitor with high ESR/ESL this could help with high frequency noise, however tantalum devices are likely as good as the ceramic in this case, so this will not do anything useful and will drive you crazy trying to solder it on. Worse, in some cases, you could introduce instability with a second pole in the filter, so this approach should be used with caution. And adding caps to the data lines will reduce the range and degrade the signal - very bad idea. Also twisted pair will be more harmful than helpful in this instance, since the signal is unbalanced.

    Honestly, the problem is most likely the poor 3V supply - fix that before investing any time in other approaches.

  17. #17
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi All!
    First thank all of you for all the great information, ideas, and opinions which are highly valued! I did find 3.0 volt regulators (MCP1700-3002E/TO) I would like to ask the group thier opinions on the best approach to decoupling. There are two methods possible using proto type boards (the boards with all the holes). First is to take the power and ground leads and run them parallel at the top of the board and then add connections to the I.C.'s from these "rails". The catch is that pin 1 is + power and pin 7 is ground. Thus the connection to ground would be long. The second approach is to take the ground and make a "C" shape buss with heavy ground wire so that the grounds would be shorter. What would be the advantages /disadvantages to either approach and is one approach better than the other when it comes to I.C. power and power supply decoupling? Thanks, Ed

  18. #18
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    In your case I'd keep the GND connection as short as possible, the connection to the positive rail then becomes whatever length is required. Then place the decoupling capacitor right across the supply pins of the device or as close to the supply pins as you possible can.

    /Henrik.

  19. #19
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Henrik!
    Thanks! One idea was to use 18ga buss wire for ground while 22ga for power. If I understand correctly then the negatives leads of the capacitors would be short and the positives would be long? Wouldn't this be allowing any spikes or signals to be on the positive supply rail? Thanks, Ed

  20. #20
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    Not that I think it matters in this application but if you're going to use different gauge wire use the heavier gauge wire for the ground bus and the thinner for the power bus. The connection from the IC to the GND will be kept short, the connection from the IC to the power rail perhaps a little longer. The capacitor should be placed across the power supply pins of the IC and its purpose is to act as a local "power reservoir" for the IC as well filtering noise on the supply rail, bypassing it "down" to GND.

    It's very important but really not that complicated for the general stuff we're tinkering with.

    Here's a link to an article describing and showing how and why and here's a more technical app note from Analog Devices.

    /Henrik.

  21. #21
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Thanks Henrik!
    I basically understand what the intent is and from all the examples show the caps are mounted with equal lead lenghts which is where I became confused. (http://www.vagrearg.org/content/decoupling breadboard setup figure 4) Of course the ground will be connected directly to the ground pin of the I.C. It just seemed that with pulse widths indicating a frequency of 2.4 mhz that having parallel capacitor wires (caps on the 3.0 volt side and caps on the 5.0 volt side spaced about an inch apart and at a higher than ground potentials (3v and 5v) you would be inductively coupling the signals thus the need for a better understanding. Best, Ed

  22. #22
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    I don't really understand but I can say that there's no signals in that circuit with a frequency of 2.4MHz. The sensor is supposed to work with a 32768Hz clock signal (which I'm guessing you're generating with the CCP module in the PIC) and SPI communication runs at a couple of 100kHz at most (depending on the clock frequency of the PIC).

    Understanding is great but at this point you are just overthinking it. Supply power to you chips using as short wires as you can, place a capacitor across the supply pins of each chip - done. Voltage regulators usually wants/needs capacitors on both the input and the output, read the datasheet for the device in question.

    /Henrik.

  23. #23
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Thanks Henrik and you are right I probably am overthinking this and just trying to do the best possible job posible. About the 2.4Mhz, the Saleae Logic Analyser shows the pulses to and from the sensor. When you look at the pulses from the sensor the pulse width +5v to zero is narrow and the Logic Analyser says the frequency is 2.4 Mhz. Yes, I agree regulators need both input and output capacitors or they can oscillate, pluse you need a "reserve" for powering devices. Thanks again. Best, Ed

  24. #24
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Ed,
    If there really ARE pulses with a frequency of 2.4MHz then I'd say that's a problem, note that the width of the pulses alone doesn't say anything about the frequency. Can you post a screenshot and tell us exactly where you're probing?

  25. #25
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi henrik!
    No idea what is going on I swear the analyzer showed 2.4mhz for the narrow pulse width and now when I go to do a screen shot it is much lower! Probably I was looking at the pulses before adding all the decoupling caps?

  26. #26
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Henrik and all!
    Just an update. After rebooting my computer things settled down and became more reasonable. I did some intense research and it turns out the TXB0104 does not like a capacitance load on any of the output or input pins of more than 70nf! So while twisting the wires seemed like a good idea (suspecting noise) it just made everything worse! I cannot believe they would make a device with such limits! Also I got my 3.0v regulator and things again look good. Thanks. Best, Ed

  27. #27
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    1) There is no way you are getting more than 70 nF capacitance from twisting a few inches of wire. Not even 70 pF. 70 nF is HUGE!
    2) All signal pins on all devices will have some value of capacitance that renders them inoperable. The value at which things fall over is usually related to the signalling speed, and sometimes related to the driver design.
    3) Power pins are not signal pins. They need capacitors.
    4) If rebooting your computer addressed the problem, then your circuit was fine all along. But it's hard to see how it could have had any impact at all. Very unusual. I think there's still "some 'splaining to do"...

  28. #28
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Charlie!
    You are right and I started off trying to go a few feet. At a few feet from the output of the TXB0104 to the PIC things would go "spritual". Then at a shorter distance back to "normal". You are also right there is something very strange and wierd going on just not sure what it is or how to track it down. Best, Ed

  29. #29
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Do you have VERY large speakers near your desk? Or possibly industrial power cables?

    (just a silly idea)

    Robert

  30. #30
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Computer Display?

    Hi Robert!
    Not silly, great idea and no, no big speakers as I also worked with a digital compass and try to stay with only brass for everything including the pressure sensor. Once in a great while aluminum which is difficult to solder! Yes, there is aluminum solder and it takes a lot of heat. Typically I take the aluminum soldering rods and cut them down so they are thinner than what I am trying to solder. While the specs for the TXB0104 states it can handle upto a 70nf (.07mf) load there is some other factor. Another problem was with my code. I had a "gosub" that should have been a "goto" which fixed a lot of issues. I have not tried longer cable lenght(s) again, just working with short lenghts.

    What I would really love to know is what code to use and what the code would look like so I can run the PIC at full speed and not delayed using ICD to see the parameters. Maybe assign some pins to feed a MAX232 and use hyperterminal or similar? Second, I know this is probably been asked a million times and is there a simple way to tell at what speed the code is really running?

    So many questions, so little time!

    Best to all, Ed

Similar Threads

  1. Two Versions of MPASM in the Same Computer???
    By rsocor01 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 11th July 2011, 21:24
  2. PIC16F877A interface with computer
    By jonil22 in forum Serial
    Replies: 4
    Last Post: - 19th February 2008, 21:29
  3. Computer crash and PBP V2.45
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2008, 21:57
  4. Some HID devcie on one computer
    By Shamir in forum USB
    Replies: 4
    Last Post: - 19th February 2007, 07:52
  5. read signal from computer
    By menhwa in forum Serial
    Replies: 1
    Last Post: - 18th February 2006, 05:28

Members who have read this thread : 1

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

Posting Permissions

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