Built-in project · Arduino Pro Mini, 3.3 V 8 MHz

Pro Mini at 3.3 V

A knob across 3.3 V on A7 fading an LED on pin 9. A full turn reads 1023, which is 3.3 V on this board, and the sketch keeps time at 8 MHz. The whole build, a 3.3 V Arduino Pro Mini and 3 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

Runs in your browser. Free, and no account needed.

Pro Mini at 3.3 V · Arduino Pro Mini, 3.3 V 8 MHzlive0.000 s 0.00x
Click to open it in the editor
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · Arduino Pro Mini, 3.3 V 8 MHz
// Dial: a potentiometer on A7 fades an LED on pin 9, and reports volts.
//
// The potentiometer's ends go to VCC and GND, and on this board VCC is 3.3 V.
// The ADC measures against AVCC, which is the same rail, so a full turn still
// reads 1023: the count is a fraction of the supply, not a number of volts.
// To turn it back into volts the sketch has to know the supply, and that is
// the line a sketch copied from a 5 V board gets wrong.
//
// A7 is an analogue-only input, as on the Nano: analogRead reaches it and
// nothing else does. Pin 9 is OC1A, so analogWrite is hardware PWM, at
// 245 Hz here rather than 490 Hz, because the timer runs from an 8 MHz clock.

const int DIAL_PIN = A7;
const int LAMP_PIN = 9;
const long SUPPLY_MV = 3300;

unsigned long lastReport = 0;

void setup() {
  Serial.begin(57600);
  pinMode(LAMP_PIN, OUTPUT);
  Serial.println("turn the dial on A7");
}

void loop() {
  int raw = analogRead(DIAL_PIN);
  analogWrite(LAMP_PIN, raw >> 2);

  unsigned long now = millis();
  if (now - lastReport >= 250) {
    lastReport = now;
    long mv = (long)raw * SUPPLY_MV / 1023;
    Serial.print("A7 ");
    Serial.print(raw);
    Serial.print("  ");
    Serial.print(mv);
    Serial.println(" mV");
  }
}

Parts list

5 parts, plus the jumper wires. Every one is in the editor's parts bin.

How it is wired

6 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • Ground: Arduino Pro Mini, 3.3 V 8 MHz pin GND; LED, yellow pin C
  • Arduino Pro Mini, 3.3 V 8 MHz pin 9; Resistor, 220 Ω pin 1
  • Ground: Arduino Pro Mini, 3.3 V 8 MHz pin GND; Potentiometer pin 3
  • Arduino Pro Mini, 3.3 V 8 MHz pin VCC; Potentiometer pin 1
  • Arduino Pro Mini, 3.3 V 8 MHz pin A7; Potentiometer pin 2
  • Resistor, 220 Ω pin 2; LED, yellow pin A

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.