Posts

Showing posts from June, 2022

Microbit ADC Logger

Image
Introduction This is a simple data logger that reads and logs the voltage on the microbit pins P0 , P1 and P2 every hour. It stores the reading as a text string together with the date and time of each reading. The date/time is kept by a DS3231 Real Time Clock (RTC) board. The readings can be uploaded to a device using the microbit’s USB. An example reading: #count = 3 17/06/2022 11:00,3.28,0,0 17/06/2022 12:00,3.28,0,0 17/06/2022 13:00,3.28,0,0 To allow the measured voltages to be greater than the nominal supply microbit voltage (3.3V) two external resistors are used to divide the measured voltage so that the pin voltage V(Pn) does not exceed 3.3V. The scaling in the code assumes external resistors of 270 kΩ from input to Pn and 330 kΩ from Pn to ground. So full scale is 6.0V . Other ratios require code change. The ADC voltage reference is the microbit “3V” supply (nominally 3.3V), so if the supply drops below this then the ADC readings will be wrong. It is possible to change the