Legal Removal Request This form is for reporting content posted on the AB Electronics UK forums that you believe violates your personal legal rights or applicable local laws for your country. Post: I'm glad you managed to get it working. The bit rate is the resolution or the number of bits the ADC uses to sample the voltage. The MCP3424 IC used on the ADC Pi Plus can support 12-bit, 14-bit, 16-bit and 18-bit modes. Basically, the higher the bit rate the more accurate the reading will be but at the expense of taking longer to read each sample. You can find a more detailed description of the different bit rates in [url=/kb/article/6/adc-bit-rates-and-resolution]our knowledge base article.[/url] Due to the way the ADC Pi Plus is designed one of the bits is never used so the actual resolution in each mode is 11 bits, 13 bits, 15 bits and 17 bits but for setting the bit rate in the code use the values of 12, 14, 16 or 18. In 18-bit mode, the ADC can return 3.75 samples per second. In 16-bit mode, the ADC returns 15 samples per second, 14-bit mode is 60 samples per second and in 12-bit mode is 240 samples per second. When you take a reading using the readvoltage function the code will request a sample from the ADC and then wait in a while loop until the sample is ready. This can take anywhere from around 4ms in 12-bit mode to around 270ms in 18-bit mode and the code will hang until the sample is ready. The gain value controls the internal programable gain amplifier. This basically multiplies the voltage at the input to increase the resolution and the accuracy of the reading. The gain amplifier supports four settings, 1, 2, 4 and 8 which are the multiplication factors for each mode. If you put 1V into the input when the gain is set to 1 the ADC would only use around a quarter of the sample space for the reading but if you set the gain to 4 the voltage is multiplied so 1V would be measured by the ADC as 4V which will take up four times as much sample space and therefore give you a reading which is 4 times more accurate. When using the gain amplifier you have to make sure your input voltage does not exceed the limits of the ADC. With a gain of 1, you can use a maximum voltage of 5V. With a gain of 2, you can use a maximum voltage of 2.5V. With a gain of 4, you can use a maximum voltage of 1.25V. With a gain of 8, you can use a maximum voltage of 0.625V. If you set the gain to 8 and then put 1V into the ADC this would be multiplied by the amplifier to 8V and would damage the ADC so you need to know what the maximum voltage your circuit will produce and then set the gain so the voltage will not exceed this. When you change the gain the ADC library automatically compensates for the new setting so if you have the gain set to 4 and put 1V into the input the read_voltage() function will return 1V even though the ADC is actually measuring 4V internally. The conversion parameter is for the conversion mode inside the ADC. The MCP3424 has two possible conversion modes, one-shot and continuous. In one-shot mode the ADC will sit in a sleep state until it receives a command to take an ADC measurement, it will then wake up, take the measurement and then go back to sleep. In continuous conversion mode the ADC is awake all of the time and continuously samples the ADC channel which was last selected. When the ADC is asleep it uses very little power but waking up takes a small amount of time so ADC measurements will take slightly longer than in continuous mode. As continuous conversion mode samples the same ADC channel repeatedly if you are only reading from a single channel using this mode can in some instances reduce the amount of time it takes to take a reading but at the expense of using a tiny bit more power. [url=/docs/pdf/mcp3424.pdf]The datasheet for the MCP3424 ADC[/url] has a more detailed description of how all of the features work and may be worth reading if you want a better understanding of what is going on inside the chip. The ADC Pi library can only read from one input at a time and while it is doing this the program will wait for a reply so if your program needs to be doing something else at the same time the best way to get around this problem would be to use threading and have the ADC readings done in a separate thread. Unfortunately, I don't have any experience of using threading in C as most of the programming I do in C is on microcontrollers which don't have multithreading in the normal desktop OS sense so I am afraid this is something I can not help you with. If you have any other questions about the library or the ADC Pi please let me know. Select the country where you are claiming legal rights. Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua and Barbuda Argentina Aruba Australia Austria Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bermuda Bhutan Bolivia Bosnia And Herzegovina Botswana Bouvet Island Brazil British Indian Ocean Territory British Virgin Islands Brunei Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Canary Islands Cape Verde Cayman Islands Central African Republic Chad Channel Islands Chile Christmas Island Cocos (Keeling) Islands Colombia Comoros Congo Cook Islands Costa Rica Croatia Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Estonia Ethiopia Falkland Islands (Malvinas) Faroe Islands Federated States of Micronesia Fiji Finland France French Guiana French Polynesia French Southern Territories Gabon Gambia Georgia Germany Ghana Gibraltar Greece Greenland Grenada Guadeloupe Guam Guatemala Guyana Haiti Heard Island and McDonald Islands Honduras Hong Kong Hungary Iceland India Indonesia Ireland Israel Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati Kuwait Kyrgyzstan Laos Latvia Lesotho Liechtenstein Lithuania Luxembourg Macau Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Martinique Mauritania Mauritius Mayotte Mexico Micronesia, Federated States Of Moldova, Republic Of Monaco Mongolia Montenegro Montserrat Morocco Mozambique Myanmar Namibia Nauru Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niue Norfolk Island Northern Mariana Islands Norway Oman Palau Panama Papua New Guinea Paraguay Peru Philippines Pitcairn Poland Portugal Puerto Rico Qatar Reunion Romania Russia Rwanda Samoa San Marino Sao Tome and Principe Saudi Arabia Serbia Seychelles Singapore Slovakia Slovenia Solomon Islands South Africa South Georgia and the South Sandwich Islands South Korea Spain Sri Lanka St. Helena St. Kitts and Nevis St. Lucia St. Pierre and Miquelon St. Vincent and the Grenadines Suriname Svalbard and Jan Mayen Islands Swaziland Sweden Switzerland Syria Taiwan Tajikistan Tanzania Thailand Togo Tokelau Tonga Trinidad and Tobago Tunisia Turkey Turkmenistan Turks and Caicos Islands Tuvalu U.S. Virgin Islands Uganda Ukraine United Arab Emirates United Kingdom United States United States Minor Outlying Islands Uruguay Uzbekistan Vanuatu Vatican City Venezuela Vietnam Wallis and Futuna Islands Western Sahara Yemen Yugoslavia Zambia What legal issue or problem do you wish to report? Please select Privacy / Erasure under GDPR Defamation Intellectual Property Hate Speech Other Please enter the following information so we can process your report. Contact Name: Contact Email: Details of complaint: Submit Complaint