How to convert .1 volt step to 3.3 volt logic high

dl324

Joined Mar 30, 2015
16,839
This was my first request for design help on a forum, and I just didn't slow down enough to consider everything involved.
That's completely acceptable as long as you learn to provide relevant details in your questions and are able to take some constructive criticism.

I was trolled by a number of members when I first started on this site. I didn't even know what trolling was until I came to this site. I developed thicker skin and started ignoring the people who were here for purposes other than trying to be helpful. If you come across some not-so-useful personalities, the ignore feature on this site can make your experience more enjoyable.

There are also people who post "dumb" questions and act like they don't understand the responses they get. After it becomes clear what their intent is, they get put on my ignore list.

I had wondered if I could use a sensitive Hall effect device and a small inductor to generate enough magnetic field to trigger it.
Sounds like more trouble than it's worth.
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
If you could change from the PIC12C509 to PIC12LF1840 or similar modern device that would reduce the power consumption and it also has a built in analogue comparator which you could use to detect the 100mV voltage change.
That looks like just the part for this project. Given that my tools are 30 years old, what's the current way to code these parts cheaply? MPLAB X and an MPLAB Snap? Is MPLAB X free to use?
 

Bryan Hord

Joined Aug 24, 2019
3
Here is one solution. Try looking for devices called "high side current monitor" on your favorite parts site.
The assumption is that you want to monitor the current through the positive wire and not through ground, is that right?
There are many to choose from. Choose the one that meets your requirements like quiescent current, or speed or package size. I see one that is 50uA max but there may be ones with lower Iq. The SOT23-5 is a popular package for these devices and they are easy to hand solder if you need that. Set the gain so that when 0.1V is across the resistor, the output will rail to 3.3V. This image is from INA138,INA168 datasheet. It has a typical Iq of 25uA. I hope we can post images from datasheets if the copyright is in tact.
1621643348874.png
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
I like the part! But neither Mouser nor DigiKey have inventory of the SOT package, only TSSOT, which is too small to hand solder. The same thing is true for most other chips in the category. But, I can get a MAX9938 in SOT23 which is similar. I will order a handful of these and see if they will do.

Thanks for suggesting the broader category.
 

LesJones

Joined Jan 8, 2017
4,174
RS components and Farnell have the SOT23 version of the INA168 in stock but the INA138 is not available until September / October this year. (I don't know if they have branches in your country as you do not give your country in your profile.)
You would need at least PICKit3 to program the PIC12F1840. If you program in assembler then you would need to avoid the latest version of MPLABX. (I use version 5.30.)
Are you hoping to log 6 months of events that occur every second an store them in the PIC ? IF so the PIC will NOT be capable of storing that much data. What is the purpose of this project ?

Les.
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
You would need at least PICKit3 to program the PIC12F1840. If you program in assembler then you would need to avoid the latest version of MPLABX. (I use version 5.30.)
Are you hoping to log 6 months of events that occur every second an store them in the PIC ? IF so the PIC will NOT be capable of storing that much data. What is the purpose of this project ?
I downloaded the current version of MPLABX yesterday to look into new tools. I also looked at the SNAP and PICKit4. Why is it no good for assembler? I'm not opposed to leaving assembly language behind for new projects, but my work involves precise timing using single NOP instructions to time intervals. How can you get that precision in C?

I don't need to record a history but, sorry to say, I'm not willing to share the exact details of this project widely because it could lead to a product.
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
How about using a mosfet on the low side to detect the 1 mA? I found an N-channel mosfet with a typical Igs of .65 volts. 650 ohms would develop this voltage with 1 mA of current and pull a PIC input to ground.


pic3xb.jpg
 

LesJones

Joined Jan 8, 2017
4,174
I don't like the mosfet idea as the gate threshold voltage is very temperature dependent. I think the INA138/168 is a much better solution. I don't know how you would do what you want using "C" (I find "C" much more difficult than assemble. ) There are members of the forum that are good at working wit "C" that would probably help you. (It is Mpasm.exe that is missing from the latest version of MPLABX.)

Les.
 

djsfantasi

Joined Apr 11, 2010
9,156
I don't like the mosfet idea as the gate threshold voltage is very temperature dependent. I think the INA138/168 is a much better solution. I don't know how you would do what you want using "C" (I find "C" much more difficult than assemble. ) There are members of the forum that are good at working wit "C" that would probably help you. (It is Mpasm.exe that is missing from the latest version of MPLABX.)

Les.
So what is the smallest time delta do you need to measure or delay?

0.000000001 seconds (10^-9) is possible in C. With some error correction code.
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
I don't like the mosfet idea as the gate threshold voltage is very temperature dependent. I think the INA138/168 is a much better solution.
It probably is a better solution, but I can't get one next week. Or next month. Mouser is quoting February of 2022.

How sensitive is the mosfet gate to temperature? The device will generate no heat and be in living spaces. The range of Igs is .4 to .9 volts.
 

LesJones

Joined Jan 8, 2017
4,174
I think the best thing to do is to try it to see if it works in your application.
I don't see how you can achieve 1 uS resolution using a 96 Khz crystal. The internal clock will be one quarter of this. (24Khz.) So one instruction cycle is just under 42 uS.

Les.
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
I don't see how you can achieve 1 uS resolution using a 96 Khz crystal. The internal clock will be one quarter of this. (24Khz.) So one instruction cycle is just under 42 uS.
I've been making "version 1" of this device since 2002. I have a parts box with an assortment of picofarad disk capacitors in steps of 3 pf. I assemble a board and insert two timing capacitors on the crystal. I then measure the loop time with an external tool that displays microseconds and is calibrated to a GPS reference. If the time is too fast, I swap one of the capacitors for one a little larger. In this way I can usually get to within 5 or 10 uS of the target time. I solder the caps when I've selected the right pair to run a hair fast.

To get the final microsecond, I solder in a loop of 6" wire wrap wire, twist it tightly, and let the parts cool. After cutting the loop end I have a gimmick capacitor that I can trim with cutters until the loop time is perfect. It's still temperature sensitive but, like I said, it's in a living room and the temperature varies little. And nothing is perfect.

Another way would be to insert a NOP instruction after 40 loops. This diminishes the effect of one instruction by 40 times. I keep thinking I'll try this, but old habits die hard and it always seems like something else is more important.
 

Thread Starter

NOPdowop

Joined May 21, 2021
20
1mA is enough to turn on an opto-isolator. You don't need and ADC to detect this.
Thanks for the suggestion. The LDA211 will indeed turn on with 1 mA, but it drops 1.2 volts, and this is twice as much as the mosfet circuit. For battery operation a volt matters. But I will keep this in mind if the mosfet doesn't work out.
 

Bryan Hord

Joined Aug 24, 2019
3
Looking through datasheets is really helpful. You may want to look at this circuit. This OP-AMP is very low supply current (< 1uA) and R-R output. Adjust the series resistor and gain to provide the performance you want. The response is not fast but a faster part can also be used with a slight power penalty.
1622148305078.png
 
Top