Menu
Microbots
0
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • ProtoBot
    • Modules & Parts
    • Tools & Gears
    • Coming Soon
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Sign in
  • English
  • Your Cart is Empty
Microbots
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • ProtoBot
    • Modules & Parts
    • Tools & Gears
    • Coming Soon
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Language

  • 0 0

CodeCell: Read Analog Values with ADC

Analog sensors, potentiometers, and other variable inputs require an Analog-to-Digital Converter (ADC) to be read by a microcontroller. With CodeCell, reading an analog signal is as simple as calling pinADC().

How to Use pinADC()

To read an analog value, use:

uint16_t myADC = myCodeCell.pinADC(uint8_t pin_num);
  • pin_num → The ADC pin you want to read from (IO1, IO2, or IO3).
  • Returns a 12-bit value between 0 and 4095 (corresponding to 0V – 2.5V, due to the internal voltage reference).

Example: Reading a Potentiometer

If you connect a potentiometer to IO2, you can read its position with:

uint16_t potValue = myCodeCell.pinADC(2);
Serial.println(potValue);

Correct Potentiometer Wiring:

Since the maximum voltage on CodeCell’s ADC pins should not exceed 3.3V, you should connect the potentiometer to 3V3 instead of Vo:

3V3 → One end of the potentiometer  
GND → Other end of the potentiometer  
IO2 → Middle pin of the potentiometer  

Important: Internal Voltage Reference is 2.5V

The onboard microcontroller uses a 2.5V internal voltage reference. This means:

  • If your input voltage is 2.5V, the ADC reading will be 4095 (max value) - any voltage above 2.5V will be 4095
  • If your input voltage is 1.25V, the ADC reading will be around 2048.

To scale readings properly:

float voltage = (myCodeCell.pinADC(2) / 4095.0) * 2.5;
Serial.println(voltage);

 

Whether you're reading a potentiometer,  sensor, or other analog signals, CodeCell makes ADC reading easy. 

  • Share:

Follow

Github

  • About
  • Software
  • Education
  • Contact
  • FAQs
  • Terms
  • Refund Policy
  • Privacy Policy

Join our Community ~ Be the first to know about new products and get exciting deals!

© 2026 Microbots.

★ Reviews

Let customers speak for us

67 reviews
Write a review
85%
(57)
6%
(4)
1%
(1)
3%
(2)
4%
(3)
62
21
C
CodeCell C3
Cloke74

Great piece of kit, had just what i needed to complete the project i had in mind. Shame shipping to the UK is so expensive, but appreciate this isn’t necessarily in the hands of MicroBots

A
CodeCell C6
Anonymous

I had an issue, got a red light, I used too much flux. Support said clean it, then the one sensor worked fine. I got the help and answer same day I provided a foto.

A
CodeCell C6 Drive
Anonymous

I think this is the best of the ESP offered, most versatile.

User picture
P
CodeCell C6
Prudhvi tej Chinimilli

Been testing the Microbots CodeCell C6 and honestly impressed with how much functionality they packed into such a tiny module. Great form factor for rapid prototyping wearable/embedded sensing applications. ESP32-C6 + IMU integration makes development much easier compared to building everything from scratch.

Still exploring battery optimization and compact LiPo options for our use case, but overall the platform is promising for low-cost real-time sensing systems. Excited to keep building with it.

F
CodeCell C6
Francisco Estivallet

Amazing hardware, my go to for compact projects.

User picture
123