久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 30927|回復(fù): 55
收起左側(cè)

T12白光洛鐵PCB原理圖開(kāi)源 Arduino源程序

  [復(fù)制鏈接]
ID:576039 發(fā)表于 2019-7-28 21:13 | 顯示全部樓層 |閱讀模式
給需要的的人,指證,點(diǎn)評(píng)。
Altium Designer畫(huà)的原理圖和PCB圖如下:(51hei附件中可下載工程文件)
2019-07-28_020343.png 2019-07-28_020314.png 2019-07-28_020103.png 0.png 0.png

Arduino源程序如下:
  1. // SolderingStation v0.6
  2. //
  3. // ATmega168/328-controlled Soldering Station for Hakko T12 Tips.
  4. // This version of the code implements:
  5. // - PID control of the heater
  6. // - Temperature measurement of the tip
  7. // - Temperature control via rotary encoder
  8. // - Boost mode by pressing rotary encoder switch
  9. // - Time driven sleep/power off mode according to handle movement
  10. // - Information display on OLED
  11. //
  12. // Future versions may implement:
  13. // - Measurement of input voltage and vcc
  14. // - Buzzer
  15. // - Setup menu
  16. // - Storing default values into the EEPROM
  17. // - Check if iron is connected
  18. //
  19. //
  20. // Clockspeed 16 MHz external.
  21. //
  22. // 2019 by Stefan Wagner
  23. //
  24. // based on the work of Jurgis Bal?iūnas (http://jurgis.me)



  25. // Libraries
  26. #include <PID_v1.h>
  27. #include <U8glib.h>

  28. // Pins
  29. #define SENSOR_PIN    A0        // temperature sense
  30. #define VIN_PIN       A1        // input voltage sense
  31. #define BUZZER_PIN     5        // buzzer
  32. #define BUTTON_PIN     6        // rotary encoder switch
  33. #define ROTARY_1_PIN   7        // rotary encoder 1
  34. #define ROTARY_2_PIN   8        // rotary encoder 2
  35. #define CONTROL_PIN    9        // heater MOSFET PWM control
  36. #define SWITCH_PIN    10        // handle vibration switch

  37. // Temperature control values
  38. #define TEMP_MIN      150       // min selectable temperature
  39. #define TEMP_MAX      400       // max selectable temperature
  40. #define TEMP_DEFAULT  320       // default start setpoint
  41. #define TEMP_SLEEP    150       // temperature in sleep mode
  42. #define TEMP_BOOST     50       // temperature increase in boost mode
  43. #define TEMP_STEP      10       // rotary encoder temp change steps

  44. // Timer values (0 = disabled)
  45. #define TIME2SLEEP     5        // time to enter sleep mode in minutes
  46. #define TIME2OFF      15        // time to shut off heater in minutes
  47. #define TIMEOFBOOST   30        // time of boost mode in seconds

  48. // Define the aggressive and conservative PID tuning parameters
  49. double aggKp=20, aggKi=0, aggKd=1;
  50. double consKp=20, consKi=1, consKd=1;

  51. // Variables for pin change interrupt
  52. volatile uint8_t a0, b0, c0, d0;
  53. volatile int count = TEMP_DEFAULT;
  54. volatile bool handleMoved;

  55. // Variables for temperature control
  56. double Setpoint = TEMP_DEFAULT;
  57. double Input, Output, CurrentTemp, ShowTemp;

  58. // Other variables
  59. bool inSleepMode = false;
  60. bool inOffMode   = false;
  61. bool inBoostMode = false;
  62. uint32_t sleepmillis;
  63. uint32_t boostmillis;
  64. uint8_t  goneMinutes;
  65. uint8_t  goneSeconds;

  66. // Specify the links and initial PID tuning parameters
  67. PID ctrl(&Input, &Output, &Setpoint, aggKp, aggKi, aggKd, REVERSE);

  68. // Setup u8g object (OLED 128x64, Fast I2C)
  69. U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST);



  70. void setup() {
  71.   // set the pin modes
  72.   pinMode(SENSOR_PIN,   INPUT);
  73.   pinMode(CONTROL_PIN,  OUTPUT);
  74.   pinMode(ROTARY_1_PIN, INPUT_PULLUP);
  75.   pinMode(ROTARY_2_PIN, INPUT_PULLUP);
  76.   pinMode(BUTTON_PIN,   INPUT_PULLUP);
  77.   pinMode(SWITCH_PIN,   INPUT_PULLUP);

  78.   // setup pin change interrupt for rotary encoder
  79.   PCMSK0 = bit (PCINT0);                // Configure pin change interrupt on Pin8
  80.   PCICR  = bit (PCIE0);                 // Enable pin change interrupt
  81.   PCIFR  = bit (PCIF0);                 // Clear interrupt flag

  82.   // prepare and start OLED
  83.   if      ( u8g.getMode() == U8G_MODE_R3G3B2 )   u8g.setColorIndex(255);
  84.   else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) u8g.setColorIndex(3);
  85.   else if ( u8g.getMode() == U8G_MODE_BW )       u8g.setColorIndex(1);
  86.   else if ( u8g.getMode() == U8G_MODE_HICOLOR )  u8g.setHiColorByRGB(255,255,255);

  87.   // tell the PID to range between 0 and the full window size
  88.   ctrl.SetOutputLimits(0, 255);

  89.   // start PID
  90.   ctrl.SetMode(AUTOMATIC);

  91.   // set initial temperature to default value and clear rotary encoder values
  92.   count = TEMP_DEFAULT;
  93.   a0 = PINB & 1;
  94.   b0 = PIND>>7 & 1;

  95.   // reset sleep timer
  96.   sleepmillis = millis();
  97. }


  98. void loop() {
  99.   BOOSTCheck();       // check and activate/deactivate boost mode
  100.   SLEEPCheck();       // check and activate/deactivate sleep modes
  101.   ADCSample();        // reads temperature and vibration switch of the iron
  102.   PIDUpdate();        // updates the PID and sets the PWM duty cycle for the heater
  103.   OLEDRedraw();       // updates the OLED
  104. }




  105. // check and activate/deactivate boost mode
  106. void BOOSTCheck() {
  107.   // check rotary encoder switch
  108.   uint8_t c = digitalRead(BUTTON_PIN);
  109.   if ( !c && c0 ) {
  110.     inBoostMode = !inBoostMode;
  111.     if (inBoostMode) boostmillis = millis();
  112.     handleMoved = true;
  113.   }
  114.   c0 = c;

  115.   // check timer when in boost mode
  116.   if (inBoostMode) {
  117.     goneSeconds = (millis() - boostmillis) / 1000;
  118.     if (goneSeconds >= TIMEOFBOOST) inBoostMode = false;
  119.   }
  120. }


  121. // check and activate/deactivate sleep modes
  122. void SLEEPCheck() {
  123.   if (handleMoved) {                    // if handle was moved
  124.     handleMoved = false;                // reset handleMoved flag
  125.     inSleepMode = false;                // reset sleep flag
  126.     inOffMode   = false;                // reset off flag
  127.     sleepmillis = millis();             // reset sleep timer
  128.   }

  129.   // check time passed since the handle was moved
  130.   goneMinutes = (millis() - sleepmillis) / 60000;
  131.   if ( (TIME2SLEEP > 0) && (goneMinutes >= TIME2SLEEP) ) inSleepMode = true;
  132.   if ( (TIME2OFF   > 0) && (goneMinutes >= TIME2OFF  ) ) inOffMode   = true;
  133. }


  134. // reads temperature and vibration switch of the iron
  135. void ADCSample() {
  136.   // shut off heater in order to measure temperature and vibration switch
  137.   // this also allows the bootstrap capacitor to recharge
  138.   analogWrite(CONTROL_PIN, 255);
  139.   delayMicroseconds(300);
  140.   
  141.   // read temperature and filter ADC by multisampling
  142.   uint16_t adc = 0;
  143.   for (uint8_t i = 0; i < 32; i++)
  144.     adc += analogRead(SENSOR_PIN);
  145.   adc >>= 5;

  146.   // check handle vibration switch
  147.   uint8_t d = digitalRead(SWITCH_PIN);
  148.   if (d != d0) {
  149.     handleMoved = true;
  150.     d0 = d;
  151.   }
  152.   
  153.   // turn on again heater
  154.   analogWrite(CONTROL_PIN, Output);

  155.   // apply quadratic equation to get temperature
  156.   double temp = -0.0013*adc*adc + 1.696*adc - 59.284;
  157.   
  158.   // additional temperature filtering
  159.   CurrentTemp += (temp-CurrentTemp)*0.05;
  160. }


  161. // updates the PID and sets the PWM duty cycle for the heater
  162. void PIDUpdate() {
  163.   if      (inOffMode)   Setpoint = 0;
  164.   else if (inSleepMode) Setpoint = TEMP_SLEEP;
  165.   else if (inBoostMode) Setpoint = count + TEMP_BOOST;
  166.   else                  Setpoint = count;
  167.   
  168.   Input = CurrentTemp;
  169.   double gap = abs(Setpoint-Input); //distance away from setpoint
  170.   if (gap < 20) ctrl.SetTunings(consKp, consKi, consKd);
  171.   else ctrl.SetTunings(aggKp, aggKi, aggKd);
  172.   ctrl.Compute();
  173.   analogWrite(CONTROL_PIN, Output);
  174. }


  175. // updates the OLED
  176. void OLEDRedraw() {
  177.   u8g.firstPage();
  178.   do {
  179.     // draw setpoint temperature
  180.     u8g.setFont(u8g_font_9x15);
  181.     u8g.setFontPosTop();
  182.     u8g.drawStr( 0, 0,  "SET:");
  183.     u8g.setPrintPos(40,0);
  184.     u8g.print(Setpoint, 0);

  185.     // draw status of heater
  186.     u8g.setPrintPos(82,0);
  187.     if      (inOffMode)    u8g.print("  OFF");
  188.     else if (inSleepMode)  u8g.print("SLEEP");
  189.     else if (inBoostMode)  u8g.print("BOOST");
  190.     else if (Output < 180) u8g.print(" HEAT");
  191.     else                   u8g.print(" HOLD");

  192.     // draw current temperature in big figures
  193.     u8g.setFont(u8g_font_fub42n);
  194.     u8g.setFontPosTop();
  195.     u8g.setPrintPos(15,20);
  196.     u8g.print(CurrentTemp, 0);
  197.   } while(u8g.nextPage());
  198. }


  199. // Pin change interrupt service routine for rotary encoder
  200. ISR (PCINT0_vect) {
  201.   uint8_t a = PINB & 1;
  202.   uint8_t b = PIND>>7 & 1;

  203.   if (a != a0) {              // A changed
  204.     a0 = a;
  205.     if (b != b0) {            // B changed
  206.       b0 = b;
  207.       count = constrain(count + ((a == b) ? TEMP_STEP : -TEMP_STEP), TEMP_MIN, TEMP_MAX);
  208.       handleMoved = true;
  209.     }
  210.   }
  211. }
復(fù)制代碼

所有資料51hei提供下載:
T12 文件夾.zip (1.15 MB, 下載次數(shù): 556)


評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

ID:272625 發(fā)表于 2019-8-6 20:00 | 顯示全部樓層
好資料,希望樓主能上傳些成品圖片看看。
回復(fù)

使用道具 舉報(bào)

ID:598522 發(fā)表于 2019-8-9 18:43 | 顯示全部樓層
很好,好資料,51黑有你更精彩!!!
回復(fù)

使用道具 舉報(bào)

ID:598522 發(fā)表于 2019-8-16 18:13 | 顯示全部樓層
好資料,終于有黑幣可以用了
回復(fù)

使用道具 舉報(bào)

ID:590584 發(fā)表于 2019-8-17 20:33 | 顯示全部樓層
  謝謝分享。
回復(fù)

使用道具 舉報(bào)

ID:297381 發(fā)表于 2019-8-20 09:40 來(lái)自觸屏版 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報(bào)

ID:600360 發(fā)表于 2019-8-22 12:38 來(lái)自觸屏版 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報(bào)

ID:198286 發(fā)表于 2019-9-7 18:01 | 顯示全部樓層
很好,吧你做好的圖片發(fā)來(lái)欣賞下
回復(fù)

使用道具 舉報(bào)

ID:609112 發(fā)表于 2019-9-15 14:14 | 顯示全部樓層
謝謝分享,這個(gè)真牛逼
回復(fù)

使用道具 舉報(bào)

ID:432073 發(fā)表于 2019-9-15 18:16 | 顯示全部樓層
很好,好資料,51黑有你更精彩!!!
回復(fù)

使用道具 舉報(bào)

ID:436736 發(fā)表于 2019-9-23 22:03 | 顯示全部樓層
做的很好,開(kāi)元很徹底。
回復(fù)

使用道具 舉報(bào)

ID:609801 發(fā)表于 2019-10-10 10:06 來(lái)自觸屏版 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報(bào)

ID:599349 發(fā)表于 2019-10-14 15:44 | 顯示全部樓層
感謝樓主的分享,學(xué)習(xí)中
回復(fù)

使用道具 舉報(bào)

ID:79544 發(fā)表于 2019-10-16 08:04 | 顯示全部樓層
感謝分享!贊。
回復(fù)

使用道具 舉報(bào)

ID:622823 發(fā)表于 2019-10-31 13:44 | 顯示全部樓層
感謝分享,非常不錯(cuò)的資料。
回復(fù)

使用道具 舉報(bào)

ID:622823 發(fā)表于 2019-10-31 16:27 | 顯示全部樓層
不錯(cuò) 的資料  這個(gè)版本 的少見(jiàn)
回復(fù)

使用道具 舉報(bào)

ID:436736 發(fā)表于 2019-11-4 16:25 | 顯示全部樓層
很實(shí)用的例子 多謝分享。
回復(fù)

使用道具 舉報(bào)

ID:638374 發(fā)表于 2019-11-9 09:33 | 顯示全部樓層
謝謝分享。
回復(fù)

使用道具 舉報(bào)

ID:347654 發(fā)表于 2019-11-12 15:51 | 顯示全部樓層
感謝分享,抽空試制,如成功也會(huì)分享給大家
回復(fù)

使用道具 舉報(bào)

ID:649577 發(fā)表于 2019-11-30 01:53 | 顯示全部樓層
感謝分享,非常不錯(cuò)的資料
回復(fù)

使用道具 舉報(bào)

ID:651779 發(fā)表于 2019-12-1 00:16 來(lái)自觸屏版 | 顯示全部樓層
摩拜大神,根本看不懂[em19
回復(fù)

使用道具 舉報(bào)

ID:607710 發(fā)表于 2019-12-4 15:35 | 顯示全部樓層
肯定有些伸手黨傻眼了
回復(fù)

使用道具 舉報(bào)

ID:279787 發(fā)表于 2019-12-13 11:17 | 顯示全部樓層
這個(gè)圖用的MP2307,輸入24V很危險(xiǎn)啊
回復(fù)

使用道具 舉報(bào)

ID:477892 發(fā)表于 2019-12-19 21:12 來(lái)自觸屏版 | 顯示全部樓層
感謝樓主分享!
回復(fù)

使用道具 舉報(bào)

ID:642926 發(fā)表于 2019-12-20 08:32 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報(bào)

ID:150151 發(fā)表于 2019-12-22 19:34 | 顯示全部樓層
我打了五塊板。。
回復(fù)

使用道具 舉報(bào)

ID:150151 發(fā)表于 2019-12-24 09:40 來(lái)自觸屏版 | 顯示全部樓層
打板5塊
6E839266-CDC8-4C0E-903D-6F6B094A868A.jpeg
回復(fù)

使用道具 舉報(bào)

ID:677234 發(fā)表于 2019-12-30 10:43 | 顯示全部樓層
感謝,感謝。
回復(fù)

使用道具 舉報(bào)

ID:407499 發(fā)表于 2020-1-18 20:40 | 顯示全部樓層

感謝分享
回復(fù)

使用道具 舉報(bào)

ID:76671 發(fā)表于 2020-1-27 11:16 | 顯示全部樓層
謝謝分享,改一下可以用esp8266
回復(fù)

使用道具 舉報(bào)

ID:150151 發(fā)表于 2020-2-19 15:28 | 顯示全部樓層
51hei圖片_20200219152830.jpg 51hei圖片_202002191528301.jpg 51hei圖片_202002191528302.jpg 我做了,屏不顯示,是什么問(wèn)題?有誰(shuí)做成功過(guò)的說(shuō)一下。
回復(fù)

使用道具 舉報(bào)

ID:471632 發(fā)表于 2020-2-19 17:11 | 顯示全部樓層
Arduino在哪里呢?怎么上傳程序?
回復(fù)

使用道具 舉報(bào)

ID:150151 發(fā)表于 2020-2-21 09:09 | 顯示全部樓層
tigerzq 發(fā)表于 2020-2-19 17:11
Arduino在哪里呢?怎么上傳程序?

ICSP接口。
回復(fù)

使用道具 舉報(bào)

ID:430492 發(fā)表于 2020-3-10 13:00 | 顯示全部樓層
這款確實(shí)有點(diǎn)創(chuàng)新,很少有人用Arduino寫(xiě)T12的控制。
回復(fù)

使用道具 舉報(bào)

ID:705985 發(fā)表于 2020-3-10 19:37 來(lái)自觸屏版 | 顯示全部樓層
謝謝,好資料!開(kāi)源的很好
回復(fù)

使用道具 舉報(bào)

ID:702957 發(fā)表于 2020-3-13 18:20 | 顯示全部樓層
下載看一下 謝謝
回復(fù)

使用道具 舉報(bào)

ID:150151 發(fā)表于 2020-3-15 01:35 | 顯示全部樓層
鏈接:https://pan.baidu.com/s/1lC2Y5Sn7U_L-oxWhTOjhNA
提取碼:gxat改成中文了的文件,原程序已經(jīng)加了注釋,打包有需要的自己下載,附上u8g2自定義字庫(kù)的相關(guān)文件和工具。20200305已備份

原版英文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面

新版中文界面

新版中文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面

原版英文界面
回復(fù)

使用道具 舉報(bào)

ID:230374 發(fā)表于 2020-3-29 20:40 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報(bào)

ID:230374 發(fā)表于 2020-4-7 17:58 | 顯示全部樓層
我參考此列有制作成,其中一項(xiàng)樓主不太明白,X4  KP-301  2P  EARTH看了圖紙是空腳位,沒(méi)有找到和那個(gè)腳位連接,手柄自動(dòng)沒(méi)有成功,忘賜教;
回復(fù)

使用道具 舉報(bào)

ID:725307 發(fā)表于 2020-4-9 09:27 | 顯示全部樓層
樓主厲害
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 亚洲一区免费 | 国产精品一区二区三区在线 | 亚洲综合一区二区三区 | av一级毛片 | 欧美激情精品久久久久久变态 | 国内精品视频免费观看 | 国产精品久久久久久久久久 | 亚洲精品一区二区三区在线 | 五月激情婷婷网 | 欧美日韩久久精品 | 成人国产精品色哟哟 | 欧美成人免费在线视频 | 久久久久久久综合 | 黄色免费在线观看网站 | 一级片aaa| 国产在线a | 精品视频免费 | 天天久| 在线婷婷| 精品一二 | 99伊人| 亚洲欧美久久 | 久久精品小视频 | 蜜桃视频麻豆 | 一区二区三区四区在线免费观看 | 日日艹夜夜艹 | 亚洲福利精品 | 亚州精品天堂中文字幕 | 欧美精品网站 | 国产女人与拘做视频免费 | 亚洲欧美网 | 欧美a在线看 | 99精品一区二区三区 | 午夜理伦三级理论三级在线观看 | 91在线免费观看网站 | 中文字幕一区在线 | gogo肉体亚洲高清在线视 | 精品国产不卡一区二区三区 | 男人久久天堂 | 日韩精品一区二区三区 | 毛片在线视频 |