العودة لقائمة المشاريع
استفسار حول برمجة أردينو ويكون بقدر يعطي صور طريقة الشبك وعندي كود بدي أشبك
الميزانية
$50.00 - $100.00
التصنيف
برمجة، تطوير المواقع والتطبيقات
المهارات المطلوبة
تطوير البرمجيات
هندسة البرمجيات
اختبار البرمجيات
تعلم البرمجة
البرمجة الخطية
أنظمة مدمجة
برمجة
تصحيح برمجي
برمجة التطبيقات
البحث والتطوير
تطوير البرمجيات
هندسة البرمجيات
اختبار البرمجيات
تعلم البرمجة
البرمجة الخطية
أنظمة مدمجة
برمجة
تصحيح برمجي
برمجة التطبيقات
البحث والتطوير
الوصف
بدي يبرمج المديول ويشبكهم مع بعض ويخليه يشوف تردد معين ويعمل فلترة للموجة وغير هيك ممكن نستخدم ESP32 او اردينو نانو مع هوائي المنيوم
i need programer can do connected between arduino NANO with PWM Generator Dual way duty cycle module
with 2 antenna and sensor i need coding on arduino snd how to conect eachather
نظام التشغيل
اردينو
تقنيات التطبيق
اردينو
المطلوب استلامه
بدي يبرمج المديول ويشبكهم مع بعض ويخليه يشوف تردد معين ويعمل فلتره للموجه وغير هيك ممكن نستخدم ESP32 او اردينو نانو مع هوائي المنيوم
في عندي كود جاهز اذا بتقدر تقولي كيف اشبكهم
#define TX_PIN 9 // PWM output pin for transmitting antenna
#define RX_PIN A0 // Analog input pin for receiving antenna
#define LED_PIN 13
const int PWM_FREQ = 10000; // Base PWM frequency in Hz
const int SAMPLE_SIZE = 100; // Number of samples to average
const int NUM_FREQUENCIES = 5;
const int FREQUENCY_STEP = 1000; // Step size for frequency sweep
int baselineReadings[NUM_FREQUENCIES];
int metalReadings[NUM_FREQUENCIES];
void setup() {
Serial.begin(115200);
pinMode(TX_PIN, OUTPUT);
pinMode(RX_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
// Set up Timer1 for PWM
TCCR1A = _BV(COM1A1) | _BV(WGM11);
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10);
ICR1 = F_CPU / PWM_FREQ - 1;
OCR1A = ICR1 / 2; // 50% duty cycle
Serial.println("Calibrating baseline...");
calibrateBaseline();
Serial.println("Baseline calibrated. Ready to detect metals.");
}
void loop() {
for (int i = 0; i < NUM_FREQUENCIES; i++) {
int frequency = PWM_FREQ + (i * FREQUENCY_STEP);
setFrequency(frequency);
delay(10); // Allow the circuit to stabilize
int reading = getAverageReading();
metalReadings[i] = reading;
int difference = abs(reading - baselineReadings[i]);
Serial.print(frequency);
Serial.print("Hz: ");
Serial.print(difference);
Serial.print(" ");
}
Serial.println();
if (detectMetal()) {
digitalWrite(LED_PIN, HIGH);
identifyMetal();
} else {
digitalWrite(LED_PIN, LOW);
Serial.println("No metal detected");
}
delay(100);
}
void setFrequency(long freq) {
ICR1 = F_CPU / freq - 1;
OCR1A = ICR1 / 2; // 50% duty cycle
}
int getAverageReading() {
long sum = 0;
for (int i = 0; i < SAMPLE_SIZE; i++) {
sum += analogRead(RX_PIN);
delayMicroseconds(100);
}
return sum / SAMPLE_SIZE;
}
void calibrateBaseline() {
for (int i = 0; i < NUM_FREQUENCIES; i++) {
int frequency = PWM_FREQ + (i * FREQUENCY_STEP);
setFrequency(frequency);
delay(100); // Allow the circuit to stabilize
baselineReadings[i] = getAverageReading();
}
}
bool detectMetal() {
const int THRESHOLD = 20; // Adjust this value based on your setup's sensitivity
for (int i = 0; i < NUM_FREQUENCIES; i++) {
if (abs(metalReadings[i] - baselineReadings[i]) > THRESHOLD) {
return true;
}
}
return false;
}
void identifyMetal() {
int maxDiff = 0;
int maxDiffIndex = 0;
for (int i = 0; i < NUM_FREQUENCIES; i++) {
int diff = abs(metalReadings[i] - baselineReadings[i]);
if (diff > maxDiff) {
maxDiff = diff;
maxDiffIndex = i;
}
}
int peakFrequency = PWM_FREQ + (maxDiffIndex * FREQUENCY_STEP);
Serial.print("Metal detected. Peak response at ");
Serial.print(peakFrequency);
Serial.println(" Hz");
// This is a basic identification. You'd need to calibrate these ranges for your specific setup
if (peakFrequency < 11000) {
Serial.println("Possibly Iron");
} else if (peakFrequency < 12000) {
Serial.println("Possibly Aluminum");
} else if (peakFrequency < 13000) {
Serial.println("Possibly Copper");
} else if (peakFrequency < 14000) {
Serial.println("Possibly Silver");
} else {
Serial.println("Possibly Gold");
}
}