Jun 122011
 

Many devices that send & receive data via antennas give you information about their power in units of dBm. If you wan to know how to convert this unit to a power value given in mW (and vice versa) you may read on.

The formulae found in the Wikipedia article on dBm expressed in Python:

from math import log10

def mw_to_dbm(mW):
    """This function converts a power given in mW to a power given in dBm."""
    return 10.*log10(mW)

def dbm_to_mw(dBm):
    """This function converts a power given in dBm to a power given in mW."""
    return 10**((dBm)/10.)

Tests of the functions:

print "%.2f mW are equivalent to %.2f dBm" % (10, mw_to_dbm(10))
print "%.2f mW are equivalent to %.2f dBm" % (30, mw_to_dbm(30))
print "%.2f mW are equivalent to %.2f dBm" % (250, mw_to_dbm(250))
print "%.2f mW are equivalent to %.2f dBm" % (200, mw_to_dbm(200))
print "%.2f mW are equivalent to %.2f dBm" % (1.3, mw_to_dbm(1.3))

print "%.2f dBm are equivalent to %.2f mW" % (12, dbm_to_mw(12))
print "%.2f dBm are equivalent to %.2f mW" % (mw_to_dbm(10), dbm_to_mw(mw_to_dbm(10)))
print "%.2f dBm are equivalent to %.2f mW" % (mw_to_dbm(0.01), dbm_to_mw(mw_to_dbm(0.01)))

Output:

10.00 mW are equivalent to 10.00 dBm
30.00 mW are equivalent to 14.77 dBm
250.00 mW are equivalent to 23.98 dBm
200.00 mW are equivalent to 23.01 dBm
1.30 mW are equivalent to 1.14 dBm
12.00 dBm are equivalent to 15.85 mW
10.00 dBm are equivalent to 10.00 mW
-20.00 dBm are equivalent to 0.01 mW

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Related Posts:

  • No Related Posts

  One Response to “Convert between Power and dBm”

  1. [...] you want to set the transmit power, you have to give the value in dBm. See Convert between Power and dBm for more [...]

 Leave a Reply

(required)

(required)


nine − = 8

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>