The Vas
UNITED STATES OF AMERICA • + Follow
Edit Project
Description
ADC2PWM PCB
ADC2PWM
Usage example is replacing a flowmeter with a pressure sensor in a coffee maker.
Code
FW
C/C++
#include <Arduino.h> #define PWM_PIN PB1 #define ADC_PIN 1 // PB2 void setup() { // Set the PWM pin as output DDRB |= _BV(PWM_PIN); // Configure Timer/Counter0 TCCR0A = 0x00; TCCR0A |= _BV(WGM00) | _BV(COM0A0)| _BV(COM0B1); TCCR0B = 0x00; TCCR0B |= _BV(CS02); // Set the PWM frequency to 122 Hz TCNT0 = 0; OCR0B = 0; // ADC configuration ADMUX = _BV(MUX0); // Select ADC input channel 1 (PB2) ADCSRA = _BV(ADEN) | // Enable ADC _BV(ADPS2) | // Set prescaler to 64 (125kHz with 8MHz clock) _BV(ADPS1); } void loop() { // Start ADC conversion ADCSRA |= _BV(ADSC); // Wait for conversion to complete while (ADCSRA & _BV(ADSC)); // Read ADC value (10-bit value) uint16_t adcValue = ADC; // Scale ADC value to match OCR1A range (0 to OCR1C) uint8_t pwmValue = adcValue >> 2; OCR0B = pwmValue; }
Nov 13,2024
177 views
end-flag
ADC2PWM PCB
ADC2PWM
Usage example is replacing a flowmeter with a pressure sensor in a coffee maker.
177
0
0
Published: Nov 13,2024
Download Gerber file 1
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-NonCommercial (CC BY-NC)
License.

Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
ESP32-S3 4.3inch Capacitive Touch Display Development Board, 800×480, 5-point Touch, 32-bit LX7 Dual-core Processor
BUY NOW
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
Topic
- Comments(0)
- Likes(0)

Upload photo
0 / 10000
It looks like you have not written anything. Please add a comment and try again.
You can upload up to 5 images!
Image size should not exceed 2MB!
File format not supported!
View More
VOTING
0 votes
- 0 USER VOTES
0.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
More by The Vas
-
ADC2PWM PCB ADC2PWMUsage example is replacing a flowmeter with a pressure sensor in a coffee maker.
-
FPC scales cable adapter 5 pin JST adapter for Dual HX711 scales board with FPC connector
-
GaggiaBoard_V2.1 GaggiaBoard_V2.1Gerber zip contains LCSC BOM and Centroid file
-
Dual HX711 scales board with FPC connector Compact dual HX711 board for electronic scales with FPC connector.Gerber zip contains LCSC BOM and C...
-
GaggiaBoard_V3 GaggiaBoard_V3Gerber zip contains LCSC BOM and Centroid fileWARNING!Most of SMD components are place...
-
Dual HX711 scales board Compact dual HX711 board for electronic scales.Allows common or separate VCC and VDD, as well as com...
-
ToFnLED v1 ToF sensor and RGB LED controlled via I2C bus are placed on a small board for use in espresso coffee...
-
BT for CK2150 Add Bluetooth to CK2150 scales
-
Generic AC dimmer Generic AC dimmer with zero-cross detector.LCSC BOM and Centroid are in Gerber ZIP
-
ADC2PWM PCB ADC2PWMUsage example is replacing a flowmeter with a pressure sensor in a coffee maker.
-
FPC scales cable adapter 5 pin JST adapter for Dual HX711 scales board with FPC connector
-
GaggiaBoard_V2.1 GaggiaBoard_V2.1Gerber zip contains LCSC BOM and Centroid file
-
Dual HX711 scales board with FPC connector Compact dual HX711 board for electronic scales with FPC connector.Gerber zip contains LCSC BOM and C...
-
GaggiaBoard_V3 GaggiaBoard_V3Gerber zip contains LCSC BOM and Centroid fileWARNING!Most of SMD components are place...
-
Dual HX711 scales board Compact dual HX711 board for electronic scales.Allows common or separate VCC and VDD, as well as com...
-
ToFnLED v1 ToF sensor and RGB LED controlled via I2C bus are placed on a small board for use in espresso coffee...
-
BT for CK2150 Add Bluetooth to CK2150 scales
-
Generic AC dimmer Generic AC dimmer with zero-cross detector.LCSC BOM and Centroid are in Gerber ZIP
-
ADC2PWM PCB ADC2PWMUsage example is replacing a flowmeter with a pressure sensor in a coffee maker.
-
FPC scales cable adapter 5 pin JST adapter for Dual HX711 scales board with FPC connector
-
GaggiaBoard_V2.1 GaggiaBoard_V2.1Gerber zip contains LCSC BOM and Centroid file
You may also like
-
Modifying a Hotplate to a Reflow Solder Station
164 0 2 -
MPL3115A2 Barometric Pressure, Altitude, and Temperature Sensor
119 0 1 -
-
Nintendo 64DD Replacement Shell
181 0 1 -
V2 Commodore AMIGA USB-C Power Sink Delivery High Efficiency Supply Triple Output 5V ±12V OLED display ATARI compatible shark 100W
367 4 1 -
How to measure weight with Load Cell and HX711
418 0 3 -
-
Instrumentation Input, high impedance with 16 bit 1MSPS ADC for SPI
528 0 0