The Vas
UNITED STATES OF AMERICA • + Follow
Edit Project
Description
ADC2PWM PCB
ADC2PWM
#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
99 views
ADC2PWM PCB
ADC2PWM
99
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.
Topic
- Comments(0)
- Likes(0)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
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
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
- ToFnLED v1 ToF sensor and RGB LED controlled via I2C bus are placed on a small board for use in espresso coffee...
- ADC2PWM PCB ADC2PWM#include <Arduino.h> #define PWM_PIN PB1 #define ADC_PIN 1 // PB2 void setup()...
- 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...
You may also like
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
121 0 0 -
DIY Laser Power Meter with Arduino
172 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
162 0 2 -