Measure power from a USB calbe using an oscilloscope [closed] - embedded

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I would like to measure power from a USB cable. This needs to be very exact and the data should be recorded, so I cannot use any of these fancy devices that show the data on a display. One end of the USB cable will be plugged into a laptop and the other into some microcontroller.
As far as I know (and I know very little about this) it should be possible to cut a USB cable open and just connect the oscilloscope to the exposed wires. Sadly I have no idea how I should connect it.
Thank you very much for any help!

The thing you need is a so called shunt resistor. A resistor can be thought of as a device, which turns voltage into current and vice versa. So if a certain amount of current (I) flows through the resistor, a proportional voltage (U) occurs across the resistor. An oscilloscope only measures voltage so in order to measure current we need the resistor to turn it into a voltage. The value of the resistor should be quite small in order to not impact the measurement too much. Usually 0.1Ω or smaller is used. The accuracy of the resistor directly affects the accuracy of the measurement so get a decent one.
Why measure current?
Power (P), what you want to measure, is calculated as voltage times current. Since oscilloscopes can't measure it directly we need to calculate it. The complete formula is in the bottom of the picture.
What is the second probe for?
USB is usually 5V which we could simply plug into the formula and call it a day. But since you want to use a computer as the power supply, which output voltage can vary quite a lot, it is best to measure it as well.
What do the colors of the wires mean?
A USB cable generally has four wires. The green and the white wire are data wires, which you should simply leave connected. The back wire is the ground or negative wire and the red is the positive wire.
Is there anything else to keep in mind?
In general there is not so much you can do wrong here but when you are using a mains powered oscilloscope the probe ground is tied to the mains ground. This can cause a ground loop when the laptop is also plugged into the mains, which you generally want to avoid. So just leave you laptop on battery during the measurement and everything should be fine.

Related

How to reprogram a cheap GPS tracker?

I was wondering if I could get a cheap GPS tracking device such as this one on amazon and reprogram it to send the co-ordinates to my own server? I would then like to generate reports from the DB on my server based on dates etc. I would like to build this for a very small-scale courier company I am planning on starting.
I am an amateur/hobbyist programmer and am looking for a few pointers to help me get on the right track. Pun totally intended.
This is a very broad question. But since no one answered so far, I will just throw in my two cents. First of all, you need to know what GPS signal the (cheap) receiver can track. If it can track only single frequency at L1, there's not much you can do. You have to live with large ionosphere fluctuation error signal.
http://www.navipedia.net/index.php/Ionospheric_Delay
If it can only track code signal (not carrier phase signal) you cannot do code smoothing to reduced the noise level of code signal received.
In other words, if a GPS receiver hardware is limited, there's not much room for improvement.

How GPS working in mobile phones? [duplicate]

This question already has answers here:
How does GPS in a mobile phone work exactly? [closed]
(2 answers)
Closed 8 years ago.
How the mobile phones sending and receiving signals from the satellites?
who is providing these services at free of cost?
You clearly don't know how GPS works. You don't send anything to the satellites, you only receive.
The satellites are operated by the US armed forces, a public service as a side effect of their military use. You don't have to pay anything for that (except for US taxpayers as part of the defense budget, but there's no extra cost for the civilian use).
The satellites each send a very accurate time signal at very regular intervals. A GPS receiver listens to those signals, and based on them can calculate where it is itself to within a few meters (though that accuracy can be reduced if needed by the operators of the satellites, say in times of war).
That's all there is to it.
Of course cellphones also use position data from cellphone towers to calculate their location through triangulation. The position of each tower is known, the phone queries all towers it can talk to, and again can then calculate where it is.
It can even do so based on the location of known WiFi networks.

how many GPS satellites can be search by handset? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
These days I play google ingress, but sometimes My phone can not location,I try to use gps tools to test my phone, only 10 satellites can be searched.
I compare my phone with samsung galaxy S3.
My phone can search 10 satellites, in good signal area.
But Samsung galaxy S3 can search 16 satellites although in good signal area or bad signal area.
16 satellites? what is the max number of GPS satelites can be search ?
thanks
You don't say what type of phone you have, but the number will depend on how many GPS receiver channels are implemented in your phone chipset.
You can find out how many GPS satellites are availeable at http://www.navcen.uscg.gov/?Do=constellationstatus. Currently there are 31. I guess about half these are over the horizon so you wouldn't expect to see more than 16. I know of some GPS receivers that could handle up to 66 satellites.
Having 16 GPS satellites in view at the same time should be very rare (see user2151446's answer). 10 satellites should be plenty for an excellent fix though -- anything above 5-6 satellites is enough for a precise position in theory.
In practice however, often the more important factors are
Relative position of the visible satellites: if all of them are in the same region of the sky, triangulation won't yield very precise results. With more than 5 satellites in view this is very unlikely however. See Dilution of Precision.
Signal to Noise ratio (SNR): if the received signal from the satellites is weak, the calculated position will be pretty inaccurate as well. Also bad SNR is an indicator for:
Signal reflections: If the signal is reflected from buildings etc, it will give the receiver misleading information. In the city this can be a pretty common problem.
Signal strength info is rather hard to get. On Android the "NMEA Recorder" app gives you a good view of the detailed GPS data as well as a log of the raw NMEA data, but I'm not sure if it includes the SNR info.
Edit: This SO question contains info on how to get the SNR programmatically.
Edit 2: The app GPS Status & Toolbox displays "signal strength" indicators (use it in horizontal layout). With some trying in good/bad reception areas this should give you a pretty good indication of what the situation actually is.

Plot a graph of Time vs RSSI for a 433Mhz RF ASK Receiver

Hi Im using the following RF module
http://www.apogeekits.com/rf_receiver_module_rx433.htm
on an embedded board with the PIC16F628A. Sadly, I realized that the signal strength was in analog form and couldn't get any ideas to get the RSSI reading off the pin because well my PIC is digital DUH!.
My basic idea was
To get the RSSI value from my Receiver
Send it to the PIC
Link the PIC to a PC via RS232
Plot a graph of time vs RSSI of the receiver (so I can make out how close my TX is to my RX)
I thought it was bloody brilliant at first but ive hit a dead end here. Any ideas on getting the RSSI data to my PC from this receiver would be nice.
Thanks in Advance
You can get a PIC that has an integrated ADC for sampling the analog signal. Or, you can use an external ADC chip to do the conversion. You would connect that to your PIC using SPI or I2C.
The simplest thing to do is obviously to use a more appropriate microcontroller - one with an ADC! There are many (most), including PICs (though that wouldn't be my first choice).
Attaching an external SPI or I2C ADC might be a bit tedious since having no SPI or I2C on your part, you'd have to bit-bash it. If you do that, use an SPI part - its simpler. Your sample rate will suffer and may end-up being a bit jittery if you are not careful.
Another solution is to use a voltage controlled PWM, then use the timer input capture to time the pulse width. That will give you good regularity and potentially good resolution. You can get a chip (example) to do that, or grow your own. That last option requires a triangle wave input as well as the measured (control) voltage, but on the same site...
In a similar vein, you could use a low frequency VCO (example) and use the output to clock one of the timers, then using a second timer periodically sampling the first and reset it. The count will relate to the voltage, though not necessarily a linear relationship, linearisation could be none on the PIC or at the receiving PC - I'd go for the latter - your micro will suck at arithmetic (performance wise) - even integer arithmetic, especially if it involves division.

How does GPS in a mobile phone work exactly? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I assume it doesn't connect to anything (other than the satelite I guess), is this right? Or it does and has some kind of charge?
GPS, the Global Positioning System run by the United States Military, is free for civilian use, though the reality is that we're paying for it with tax dollars.
However, GPS on cell phones is a bit more murky. In general, it won't cost you anything to turn on the GPS in your cell phone, but when you get a location it usually involves the cell phone company in order to get it quickly with little signal, as well as get a location when the satellites aren't visible (since the gov't requires a fix even if the satellites aren't visible for emergency 911 purposes). It uses up some cellular bandwidth. This also means that for phones without a regular GPS receiver, you cannot use the GPS at all if you don't have cell phone service.
For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions).
This particular kind of GPS is called assisted GPS (AGPS), and there are several levels of assistance used.
GPS
A normal GPS receiver listens to a particular frequency for radio signals. Satellites send time coded messages at this frequency. Each satellite has an atomic clock, and sends the current exact time as well.
The GPS receiver figures out which satellites it can hear, and then starts gathering those messages. The messages include time, current satellite positions, and a few other bits of information. The message stream is slow - this is to save power, and also because all the satellites transmit on the same frequency and they're easier to pick out if they go slow. Because of this, and the amount of information needed to operate well, it can take 30-60 seconds to get a location on a regular GPS.
When it knows the position and time code of at least 3 satellites, a GPS receiver can assume it's on the earth's surface and get a good reading. 4 satellites are needed if you aren't on the ground and you want altitude as well.
AGPS
As you saw above, it can take a long time to get a position fix with a normal GPS. There are ways to speed this up, but unless you're carrying an atomic clock with you all the time, or leave the GPS on all the time, then there's always going to be a delay of between 5-60 seconds before you get a location.
In order to save cost, most cell phones share the GPS receiver components with the cellular components, and you can't get a fix and talk at the same time. People don't like that (especially when there's an emergency) so the lowest form of GPS does the following:
Get some information from the cell phone company to feed to the GPS receiver - some of this is gross positioning information based on what cellular towers can 'hear' your phone, so by this time they already phone your location to within a city block or so.
Switch from cellular to GPS receiver for 0.1 second (or some small, practically unoticable period of time) and collect the raw GPS data (no processing on the phone).
Switch back to the phone mode, and send the raw data to the phone company
The phone company processes that data (acts as an offline GPS receiver) and send the location back to your phone.
This saves a lot of money on the phone design, but it has a heavy load on cellular bandwidth, and with a lot of requests coming it requires a lot of fast servers. Still, overall it can be cheaper and faster to implement. They are reluctant, however, to release GPS based features on these phones due to this load - so you won't see turn by turn navigation here.
More recent designs include a full GPS chip. They still get data from the phone company - such as current location based on tower positioning, and current satellite locations - this provides sub 1 second fix times. This information is only needed once, and the GPS can keep track of everything after that with very little power. If the cellular network is unavailable, then they can still get a fix after awhile. If the GPS satellites aren't visible to the receiver, then they can still get a rough fix from the cellular towers.
But to completely answer your question - it's as free as the phone company lets it be, and so far they do not charge for it at all. I doubt that's going to change in the future. In the higher end phones with a full GPS receiver you may even be able to load your own software and access it, such as with mologogo on a motorola iDen phone - the J2ME development kit is free, and the phone is only $40 (prepaid phone with $5 credit). Unlimited internet is about $10 a month, so for $40 to start and $10 a month you can get an internet tracking system. (Prices circa August 2008)
It's only going to get cheaper and more full featured from here on out...
Re: Google maps and such
Yes, Google maps and all other cell phone mapping systems require a data connection of some sort at varying times during usage. When you move far enough in one direction, for instance, it'll request new tiles from its server. Your average phone doesn't have enough storage to hold a map of the US, nor the processor power to render it nicely. iPhone would be able to if you wanted to use the storage space up with maps, but given that most iPhones have a full time unlimited data plan most users would rather use that space for other things.
There's 3 satellites at least that you must be able to receive from of the 24-32 out there, and they each broadcast a time from a synchronized atomic clock. The differences in those times that you receive at any one time tell you how long the broadcast took to reach you, and thus where you are in relation to the satellites. So, it sort of reads from something, but it doesn't connect to that thing. Note that this doesn't tell you your orientation, many GPSes fake that (and speed) by interpolating data points.
If you don't count the cost of the receiver, it's a free service. Apparently there's higher resolution services out there that are restricted to military use. Those are likely a fixed cost for a license to decrypt the signals along with a confidentiality agreement.
Now your device may support GPS tracking, in which case it might communicate, say via GPRS, to a database which will store the location the device has found itself to be at, so that multiple devices may be tracked. That would require some kind of connection.
Maps are either stored on the device or received over a connection. Navigation is computed based on those maps' databases. These likely are a licensed item with a cost associated, though if you use a service like Google Maps they have the license with NAVTEQ and others.