อยากทราบ วงจรของเครื่องแยกเหรียญค่ะ

เครื่องแยกเหรียญ มี มอเตอร์1ตัว เซอร์โวสำหรับปิดการไหลของเหรียญ4ตัว เซนเซอร์ตรวจนับเหรียญ4ตัว อาดุยโน่ ลำโพงขนาดเล็ก 4ตัว ไฟled 4ตัว จอ lcd
อยากทราบว่า วงจรต่อยังไงเหรอคะ เป็นลายวงจรเลยอ่ะค่ะ

ถ่ายรูปอุปกรณ์ กับลายปริ้นมาดูครับ

19

#include <CapacitiveSensor.h>

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);

CapacitiveSensor capSensor  = CapacitiveSensor(4, 2);
CapacitiveSensor capSensor2 = CapacitiveSensor(4, 5);
CapacitiveSensor capSensor5 = CapacitiveSensor(4, 6);
CapacitiveSensor capSensor10 = CapacitiveSensor(4, 7);

int ms_time   = 800;
int threshold = 640;
const int ledPin = 13;
bool led_state = LOW;
bool pass = false;

int count_c1 = 0;
int count_c2 = 0;
int count_c5 = 0;
int count_c10 = 0;
int sum       = 0;

unsigned long ms1=0;
unsigned long ms2=0;
unsigned long ms5=0;
unsigned long ms10=0;

void setup()
{
  lcd.init();                      // initialize the lcd

  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("1  2  5  10  sum");

  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  delay(50);
}

void loop()
{

   checkCoin1();
   checkCoin2();
   checkCoin5();
   checkCoin10();

   lcd.setCursor(0,1);
   lcd.print( count_c1);

   lcd.setCursor(3,1);
   lcd.print( count_c2);

   lcd.setCursor(6,1);
   lcd.print( count_c5);

   lcd.setCursor(9,1);
   lcd.print( count_c10);

   lcd.setCursor(13,1);
   lcd.print( sum);
}
void checkCoin1()
{
  long sensorValue = capSensor.capacitiveSensor(30);

  Serial.println(sensorValue);

  if (sensorValue > threshold)
  {
    if( ms1 == 0){
      ms1 = millis();
      count_c1++;
      sum = sum + 1;
    }
      digitalWrite(ledPin, HIGH);
 
  }else{
      digitalWrite(ledPin, LOW);
  }

  if( ms1 != 0){
      if( (millis() - ms1) > ms_time){
         ms1 = 0;
      }
  }
}
void checkCoin2()
{
  long sensorValue = capSensor2.capacitiveSensor(30);

  Serial.println(sensorValue);

  if (sensorValue > threshold)
  {
    if( ms2 == 0){
      ms2 = millis();
      count_c2++;
      sum = sum + 2;
    }
      digitalWrite(ledPin, HIGH);
 
  }else{
      digitalWrite(ledPin, LOW);
  }

  if( ms2 != 0){
      if( (millis() - ms2) > ms_time){
         ms2 = 0;
      }
  }
}

void checkCoin5()
{
  long sensorValue = capSensor5.capacitiveSensor(30);

  Serial.println(sensorValue);

  if (sensorValue > threshold)
  {
    if( ms5 == 0){
      ms5 = millis();
      count_c5++;
      sum = sum + 5;
    }
      digitalWrite(ledPin, HIGH);
 
  }else{
      digitalWrite(ledPin, LOW);
  }

  if( ms5 != 0){
      if( (millis() - ms5) > ms_time){
         ms5 = 0;
      }
  }
}
void checkCoin10()
{
  long sensorValue = capSensor10.capacitiveSensor(30);

  Serial.println(sensorValue);

  if (sensorValue > threshold)
  {
    if( ms10 == 0){
      ms10 = millis();
      count_c10++;
      sum = sum + 10;
    }
      digitalWrite(ledPin, HIGH);
 
  }else{
      digitalWrite(ledPin, LOW);
  }

  if( ms10 != 0){
      if( (millis() - ms10) > ms_time){
         ms10 = 0;
      }
  }
}


ขอบคุณค่ะ
นี้รูปที่ออกแบบ3Dไว้ค่ะ
ถ้าสงสัยหรือติดตรงไหนจะมาสอบถามอีกนะคะ

1 Likes

เอาลิ้งค์ 3D มาแปะก็ได้นะครับ

คือตอนนี้ยังไม่ได้ออกแบบระบบแยกเหรียญใช่ไหมครับ หรือว่ามีอยู่แล้วเหลือแค่จับยัดลงไปในนี้

ยังเลยค่ะ ที่คิดเอาไว้ก็จะใช้เป็นจานหมุน หมุนเหรียญลง แต่ละช่องจะนับเหรียญได้ 100 บาท ช่องนันจะหยุดจ่ายเหรียญ เมื่อหยุดจ่ายช่องนั้น ก้จะซีลปากถุงค่ะ และจะมีเสียงและไฟแจ้งแตือนเมื่อช่องนั้น ทำการซีลเรียบร้อย
ที่คิดว่าจะใช้เซอร์โว เป็นตัวปิดการไหลของเหรียญ เซอร์โวจะเอาอยู่ไหมคะ

อยู่ครับ แต่รูปแบบการซีนจะเป็นแบบไหน ใช้กระแสไฟปล่อยเข้าไปผ่านลวด หรอครับ

จะซื้อเครื่องซีนสำเร็จรูปมา แล้วเอาเฉพาะ ตัวซีนมาติดมอเตอร์อ่ะค่ะ

1 Likes

ก็ดีครับ ตัดส่วนที่ยุ่งยากออกไปบ้าง ไปเน้นส่วนที่เป็นหัวใจหลักดีกว่า

พี่พอจะ ออกแบบวงจรให้ได้ไหมคะ

ผมออกแบบให้ไม่ได้ครับ แต่ถ้าน้องออกแบบเองแล้วเอามาปรึกษา อันนี้ได้ ลองพยายามดู ไม่ได้ยากเลย น้องต้องหัด เวลาเราไปทำงานจริงๆ เขาก็ต้องให้เราคิดและออกแบบเพื่อแก้ปัญหาในงานนั้นๆ ออกแบบผิดถูกไม่ว่ากัน เอามาถามเอามาคุย ผมยินดีตอบ ทุกครั้งครับ