Shop OBEX P1 Docs P2 Docs Learn Events
wireless data analyser — Parallax Forums

wireless data analyser

EKS29EKS29 Posts: 10
edited 2005-02-17 19:40 in BASIC Stamp
Hey guys , i do need help . i am trying to build a wireless device that can detect analog signal (amplitude between 0- 5mV) and set the threshold for this signal. Then after setting the threshold i just need it to send one or zero based on the threshold. I dont know if i can do this with BS2 specially when there is a threshold already set for BS2 which is 1.4v ?????

Please help

Thanks

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 05:48
    simplest way is to use an analog comparator with a digipot controlling the threshold, nice thing is all the analog is kept off chip. The analog comparator out is a digital value. (this whole setup can be accomplished on an SX by a single capacitor, but no sense explaining that since your using the stamp)

    Post Edited (Paul Baker) : 2/16/2005 5:52:51 AM GMT
  • steve_bsteve_b Posts: 1,563
    edited 2005-02-16 05:52
    you need a filter to only let through the desired frequency....then any A/D converter would work to bring in the signal to the stamp which could then decide what to do based on what the signal is.

    without filtering out the unwanted signals (as there are lots of signals all about) you'll be picking up any signal and it would probably trigger your 5mV level.· A flourescent tube would probably do it too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 05:55
    ah sorry missed that its 5mV (I read 5V), in that case an opamp with high gain should be placed between the analog signal and analog comparator, and depending on your lead length you may need a low-pass filter like steve says.
  • EKS29EKS29 Posts: 10
    edited 2005-02-16 05:57
    The threshold is set difrently between time to time, which mean i need to change it. Filtering the signal will make it set and i wont be able to change the threshold.
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 06:12
    no no, I think you misunderstand. Your trying to differentiate a very small·voltage (to give you an idea thermal noise in a transistor is on the order of 25mV at room temperature). Because this voltage is very small, your circuit will be suceptable to noise from other electronic devices (such as the ballast in a florescent light). Because of this you have to filter the signal to try to reduce any unwanted noise in your system. First minimize the length of wire between·the device which·is generating the voltage and the part that is measuring the voltage (wire acts like an antenna picking up EM waves), second right next to the analog measuring part you put a low pass filter, this will attenuate frequencies above the cutoff frequency which you set to not interfere with the speed at which the signal is changing. The output of the low pass filter goes into the V+ terminal of an analog comparator. You place a digitally controlled potentiometer wiper output to the V- terminal of the analog comparator. tie one end of the digipot to ground and tie the other to the highest voltage your signal will go plus a small margin. You use your stamp to set what position the digipot is at, much as you would with a manual potentiometer. Then feed the Aout of the analog comparator into your stamp, whenever the signal is above the set voltage of the digipot (V+ > V-)·Aout will be Vdd whenever the signal is below the wiper voltage of the digipot (V+ < V-) Aout will be 0V. Since the digipot is electronically controlled by your stamp, you are free to set it whenever you like.

    Hope this clears the issue for you,

    Paul
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 06:23
    Ah, I was so busy explaining I left out the op amp heres the chain:

    5mV device -> short connection wire -> lowpass filter -> opamp -> analog comparator -> stamp
    ··································································································· ^··················· ·|
    ·························································································digital potentiometer <---

    in this configuration the digipot's high voltage feed is whatever the max output of the opamp is. The reason the opamp is needed is comparison of two analog voltages (ADC's do this too but the other voltage is generated internally) has a thing called common mode rejection, meaning when the two voltages are close there can be some ambiguity (can be thought of as a tolerance), so you want an analog comparator that has a high CMRR (last R stands for ratio), but in the max swing in the millivolts, even high CMRR analog comparators can still find it difficult, so you boost the signal.

    Correction: I defined CMRR wrong, CMR is when comparing two voltages which are equal, regardless of their value, the result should be 0 (In1-In2 when In1=In2). CMRR is the measure of an opamp's ability to amplify the signal between the positive and negative terminals (the AC component) and reject the common mode (the DC component or the DC bias that is common between the two terminals)

    Offset voltage is what I was trying to refer to which represents a degree of uncertainty of the sign of the output when the two signals to be compared are very close to each other (ie an offset voltage of 1mV means if the two inputs are within 2mV of each other, you cannot be sure the sign of the output is correct, in analog comparator terms this means an output error)

    Post Edited (Paul Baker) : 2/16/2005 5:54:16 PM GMT
  • EKS29EKS29 Posts: 10
    edited 2005-02-16 06:23
    Yes it did . thank you very much . One last thing do you know where can i get the digipt or analog comparator that would work with basic stamp?? i dont want to buy ones that may not work

    Thanks alot
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 06:46
    mouser, digikey, jdr, jameco. You want an op amp and analog comparator which has a high CMRR and low offset voltage, you may want to get an instrument amplifier for your op amp and run a pseudo differential signal, this can help with noise. Go exploring and write down a few examples for each part, report back and we'll tell you if thier suitable or point you in a direction which you should get a part with a better spec in a certain metric. A 10k digipot should be good, get as many taps as you feel like paying for. Xicor x9440 series has a analog comparator and digital potentiometer on a single chip, they are surface mount, but sparkfun.com sells a 28 pin soic to dip board for $3 (the chips are 24-soic but thats fine you just wouldnt use 4 of the pins)

    Post Edited (Paul Baker) : 2/16/2005 6:50:56 AM GMT
  • EKS29EKS29 Posts: 10
    edited 2005-02-16 07:51
    how about this Digipot
    http://www.intersil.com/cda/deviceinfo/0,1477,X9440,00.html#data

    x9440 the one you recomended. ???
    Dual Digitally Controlled Potentiometer (XDCP&#8482[noparse];)[/noparse] & Voltage Comparator
  • EKS29EKS29 Posts: 10
    edited 2005-02-16 07:52
    what if i want to initiate time stamp ?? can i do that with basic stamp?
    after i get the digitalized signal can i also initiate time to know when did the high output occured ???
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 17:25
    yeah thats the one I was refering to, I have not used this part and don't use a stamp, but from an EE's perspective there should't be a problem, the offset voltage on the comparator is a nice value (1mV for (V+)-(V-)=3V). I suggest reading all the application notes and the spec before buying to make sure you understand how to use it, if after reading everything you have some points of uncertainty/confusion, ask and I'll try to help you out.

    As far as the time stamp is concerned, I'm not the best person to ask, I don't use a stamp (I develop on the SX). Theoretically it can be done on stamp using the PULSIN command on the signal, which will provide a delta time measurement (time since last transition). By keeping an accumulation register you could provide a traditional timestamp to associate with the transition.

    Post Edited (Paul Baker) : 2/16/2005 5:31:36 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 17:52
    I made a correction to the post illustrating the chain of components, I was improperly defining the gist of the CMRR value.
  • EKS29EKS29 Posts: 10
    edited 2005-02-16 22:27
    Whats SX ?? is it the intel SX microprocessor?? can i do the threshold technique with all what i am asking for (time stamp, digitalize the signal) using the SX ???
    Can you explain what and how ??
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-16 22:58
    Its the other development environment that Parallax offers, on thier main page there is a link titled "SX Chips and Tools". It is a straight-out 8 bit microcontroller which runs at 50MHz (75MHz parts are availible and the processor can be overclocked up to 100MHz if you know what your doing and get your hands on a good chip, though Parallax doesn't directly support doing this). It is mainly programmed in assembly language, but Parallax has recently released a·BASIC compiler for the chip. But the compiler is not for the faint of heart because you are not isolated from the SX's architecture like a stamp does, this requires a little more knowledge and effort because the SX has some quirkyness in its architecture that many microcontrollers don't have. But if you have programmed a PIC, there are alot of similarities. In some quarters the SX is refered to as a PIC on steroids.

    The SX does have a built in analog comparator and I talk about what your trying to acomplish using a SX in this thread: http://forums.parallax.com/showthread.php?p=526402

    But development on the SX requires investing in another development kit, and learning how to program it. If you are new to the world of embedded programming, I wouldn't suggest switching to the SX. There is nothing about this project that would truely justify switching platforms, unless the frequency in which you need to take measurements is something the stamp cannot handle (we haven't discussed how fast you need to collect data). Especially since the chip we've been discussing is less than $10, a switch just doesn't really make sense.

    I got my feet wet learning how to program using BASIC on the original apple back in '82, moved to the TRS-80 (also in BASIC and dabbled in the assembly language too) in '84, transitioned to C++ with my first PC in '89, then embedded programming in '92 on the HC11. As you can see I have had two decades of experience and gradually moved from very high level languages down to low level languages. This is the easiest method of learning to program, if you just learned to crawl your not going to do very well if you enter yourself in a 10K run. Its better if you wait until you feel competent with what your using before transitioning to something more complicated.
  • EKS29EKS29 Posts: 10
    edited 2005-02-17 01:02
    I know how to programm in C and C++ but i am new to this PBasic programming.

    *how fast ; i think what i need is something that can take samples every 1 mili second or less . is this possible for basic stamp2p ???
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-17 02:33
    it would be tight if you have a BS1 but all other revisions, it should be adequate.

    If your interested in the SX read http://www.parallax.com/dl/docs/prod/sx/SxUsersManualV31.pdf·I read this document more than half a dozen·times over a year before deciding to get the development package. It explains everything you need to know to program a SX.

    Post Edited (Paul Baker) : 2/17/2005 2:49:19 AM GMT
  • EKS29EKS29 Posts: 10
    edited 2005-02-17 05:37
    Paul ... i think its better to just use one of the SX chips instod of buying both the analog comparator with the digital pot. .. dont you think its cheaper and i can perform all what i want using a small chip ?!!! the size count for me, and i am looking to use small parts.. what do you think ???

    i can use SX20AC/SS : The SX20AC/SS's on-chip functions include a general-purpose 8-bit timer, an analog comparator, watchdog timer, a power-save mode with wakeup capability, a configurable internal oscillator and high-current outputs.
  • EKS29EKS29 Posts: 10
    edited 2005-02-17 05:51
    paul to make more clear .. the device will be connected to a transceiver that will wirelessly be connected to the computer where initializing the threshold and the clock.. the ouput will be saved as data sheet
    .. i can do this using LabView programms
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-17 07:26
    Ok:
    Do you already have a stamp?
    Have you chosen a wireless module (if so what frequency/protocol)?
    Do you plan on having a microcontroller on both ends of the wireless connection,·or do·you·plan on having the PC connected to the tranceiver (not all wireless protocols will do this easily)?
    What is the size you are looking for your remote gadget?
    What is your experience with soldering surface mount parts?

    The SX development kit is $99 or $130 including the books (which I strongly recomend, I find Geunther's book invaluable) and this is only compatible with the SX28-DP, to program an SS variety youll need to put a header on your board for in circuit programming (occupying pcb real estate) or buy an SOIC prototyping socket which are >$50, unless you want to desolder it off your DIP converter and resolder it onto your PCB.

    The device we've been talking about is a 28-SOIC which contains both the analog comparator and digipot it, the package dimensions are 7.5x15.3mm, draw it out on paper, its pretty small, the stamp will dwarf it in comparison. If you put it on an adapter board it will be about the size of the stamp. But its up to you, doing it the SX way will still require external components, including an opamp, and resisistors for the DAC portion, but if your comfortable soldering speck size components you can go with 0402 or 0603 resistors and I do mean they are tiny. My current board Im getting back tomorrow is using 0603's and I recieved the components today and thier size frightens me. I have solder paste but I should have also bought a hair size needle for the syringe because the aperature of the included needle is twice the size of the pads on the board, I will likely have to use a stick pin to remove and dab miniscule amounts of solder to put on the pads. I don't want to scare you unessesarily but I don't want you to plunge over the deep end and regret jumping. But if you have access to a reflow oven, wave solderer or vapor solderer and stenciling then this wont be an issue.
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-17 18:11
    The SX Tech Tool Plus (www.parallax.com/detail.asp?product_id=45181) is currently on sale for only $99. This kit includes both Gunther's book as well as Al William's Beginning Assembly Language for the SX Microcontroller.

    Jim
  • EKS29EKS29 Posts: 10
    edited 2005-02-17 18:27
    i did purchase basic stamp2p (24 pin) and i finished building the wireless interface (Transceiver at both end working on 433MHz). One side its the PC connected to the Transceiver and the other end is the device connected to the basic stamp2 and a transceiver. i dont know if i should change to using SX or not, i think the best is to use what i have and try to make it work then change in the future.

    i will draw a schematic diagram for the design we were discussing and i will post it so we can discuss more of it later. Thanks for all ur help PAUL
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-17 19:40
    I think thats a wise idea, if you want you can think of this as your proof of concept/prototype. Then if you feel the stamp cannot handle the data throughput or you feel that miniturization is needed, you can transition to the SX platform. This way your segregating an interface your unfamiliar with and a platform your unfamiliar with, when designing embedded systems its much easier to try to subcompartmentalise as much as you can, its much easier to debug the system. (Same holds true for software design). I will be _very_ busy for the rest of the month so please be patient if I don't respond quickly.
Sign In or Register to comment.