Who is here? 1 guest(s)
 Print Thread
Testing Arduino UNO with bitwisetech / popc and MAX6675
renatoa
An error occured during modbus reading or decoding.
Check modbusport.py, in 2.4.x src\artisanlib folder
 
zamunda

Quote

renatoa wrote:

An error occured during modbus reading or decoding.
Check modbusport.py, in 2.4.x src\artisanlib folder


Thanks for your reply. I am on Mac OS x and can't find such a folder.

I am a bit lost: I tried several configs also this from:
https://www.home-barista.com/roasting/getting-artisan-to-talk-to-arduino-t58234-20.html

Behaviour is the same for all of them, over USB, temp is read and passed to Artisan, no problem, once connected over BT, I get the Modbus error, that is, RX = none.

I am quite sure the BT is ok, did several tests via basic scripts and I can communicate over BT from the module to me laptop.

Is there another point I am missing here maybe? Over BT I power Arduino via USB to an iPhone adapter (5V, 1A). Could that be critical? Should I power Arduino by the dedicated power inlet and not over USB?

Any other suggestions are welcome!
Thanks
 
zamunda
Hello,

Finally, I achieved to connect over Modbus/Bluetooth, I had to change the sketch by assigning PINs to RX/TX other than the dedicated PINs on the Arduino and use SoftwareSerial.

The following sketch worked for me:


#include <max6675.h>
#include <ModbusRtu.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8); // RX, TX

// data array for modbus network sharing
uint16_t au16data[16] = {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1
};

/**
    Modbus object declaration
    u8id : node id = 0 for master, = 1..247 for slave
    u8serno : serial port (use 0 for Serial)
    u8txenpin : 0 for RS-232 and USB-FTDI
                 or any pin number > 1 for RS-485
*/
Modbus slave(1, mySerial, 0); // this is slave @1 and RS-232 or USB-FTDI

// Pins for thermocouple MAX6675
int thermoDO = 6;
int thermoCS = 5;
int thermoCLK = 4;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

// declare variable for Arduino pin connected to solid state relay (SSR)
int relay = 9;

// declare variables for Arduino pins connected to fan controller (L293N)
int fan = 10; // ENA of L239N
int in1 = 11; // IN1 of L239N
int in2 = 12; // IN1 of L239N

// declare variables for Arduino pins to power MAX6675:
int vccPin = 3; // 5v power of MAX6675
int gndPin = 2; // gnd of MAX6675

// slew rate limitations for fan control
#define SLEW_STEP 10 // increase in steps of 10% for smooth transition
int target = 0;
int current = 0;

void slew_fan() { // limit fan speed increases
  target = ((au16data[5] / 100.0) * 255);
  if ( target < current ) { // ramping down, so check rate
    uint8_t delta = current - target;
    if ( delta > SLEW_STEP ) // limit the step size
      delta = SLEW_STEP;
    analogWrite(fan, (current - delta ));
    current = current - delta;
  }
  else if ( target > current ) { // ramping up, so check rate
    uint8_t delta = target - current;
    if ( delta > SLEW_STEP ) // limit the step size
      delta = SLEW_STEP;
    //write current fan value for air control
    analogWrite(fan, (current + delta ));
    current = current + delta;
  }
}


void setup() {
  mySerial.begin(19200); // Soft Serial used for communication through Bluetooth module HC-06
  slave.start( ); // 19200 baud, 8-bits, even, 1-bit stop
  // use Arduino pins
  pinMode(relay, OUTPUT);
  pinMode(fan, OUTPUT);
  //fan direction can be reversed by interchanging values for in1 and in2
  pinMode(in1, OUTPUT); digitalWrite(in1, HIGH);
  pinMode(in2, OUTPUT); digitalWrite(in2, LOW);

  pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
  delay(500);
}

void loop() {
  //write current thermocouple value
  au16data[2] = ((uint16_t) thermocouple.readCelsius() * 100);

  //write current fan value for air control
  // analogWrite(fan, (au16data[5] / 100.0) * 255);
  slew_fan();

  //poll modbus registers
  slave.poll( au16data, 16 );

  // heater control:
  digitalWrite(relay, HIGH);
  delay(au16data[4] * 10);
  digitalWrite(relay, LOW);
  delay((100 - au16data[4]) * 10 - 1);
}
 
zamunda
Hello,

Based on the sketch above, I did some roasting with batches of 100gram. I think the result comes out quite nice, from Artisan I can control heat and air conveniently. I mounted the roaster on a wooden box which I can open later to check wirings etc. Bluetooth also works well.
Also built a simple chaff collector which sits on top of the roaster which can be emptied from time to time.

BTW: I disabled the "slew-function" withing the sketch for now since this "messed up" de loop-functionality within Arduino. So far, I did not experience overload problems (which was something this function should help to prevent)

Obviously there is much room for improvement but this was/is an (exciting) learning-by-doing-and-falling process.

Hardware used in this build:
- Princess Popcorn popper (1200W/220V)
- MAX6675 sensor for temp readings
- Arduino UNO (3)
- (Manual) DC voltage adapter for fan
- L298N DC-Motor Controller for slider-controlling the fan from Artisan
- Solid state relay for controlling the heat element
- Bluetooth module HC06 for wireless connection from Artisan to roaster
- DC-adapter iPhone for Arduino

Big thanks to everyone on this forum, if you have any questions/suggestions, please let me know.

Quote

zamunda wrote:

Hello,

Finally, I achieved to connect over Modbus/Bluetooth, I had to change the sketch by assigning PINs to RX/TX other than the dedicated PINs on the Arduino and use SoftwareSerial.

The following sketch worked for me:


#include <max6675.h>
#include <ModbusRtu.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8); // RX, TX

// data array for modbus network sharing
uint16_t au16data[16] = {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1
};

/**
    Modbus object declaration
    u8id : node id = 0 for master, = 1..247 for slave
    u8serno : serial port (use 0 for Serial)
    u8txenpin : 0 for RS-232 and USB-FTDI
                 or any pin number > 1 for RS-485
*/
Modbus slave(1, mySerial, 0); // this is slave @1 and RS-232 or USB-FTDI

// Pins for thermocouple MAX6675
int thermoDO = 6;
int thermoCS = 5;
int thermoCLK = 4;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

// declare variable for Arduino pin connected to solid state relay (SSR)
int relay = 9;

// declare variables for Arduino pins connected to fan controller (L293N)
int fan = 10; // ENA of L239N
int in1 = 11; // IN1 of L239N
int in2 = 12; // IN1 of L239N

// declare variables for Arduino pins to power MAX6675:
int vccPin = 3; // 5v power of MAX6675
int gndPin = 2; // gnd of MAX6675

// slew rate limitations for fan control
#define SLEW_STEP 10 // increase in steps of 10% for smooth transition
int target = 0;
int current = 0;

void slew_fan() { // limit fan speed increases
  target = ((au16data[5] / 100.0) * 255);
  if ( target < current ) { // ramping down, so check rate
    uint8_t delta = current - target;
    if ( delta > SLEW_STEP ) // limit the step size
      delta = SLEW_STEP;
    analogWrite(fan, (current - delta ));
    current = current - delta;
  }
  else if ( target > current ) { // ramping up, so check rate
    uint8_t delta = target - current;
    if ( delta > SLEW_STEP ) // limit the step size
      delta = SLEW_STEP;
    //write current fan value for air control
    analogWrite(fan, (current + delta ));
    current = current + delta;
  }
}


void setup() {
  mySerial.begin(19200); // Soft Serial used for communication through Bluetooth module HC-06
  slave.start( ); // 19200 baud, 8-bits, even, 1-bit stop
  // use Arduino pins
  pinMode(relay, OUTPUT);
  pinMode(fan, OUTPUT);
  //fan direction can be reversed by interchanging values for in1 and in2
  pinMode(in1, OUTPUT); digitalWrite(in1, HIGH);
  pinMode(in2, OUTPUT); digitalWrite(in2, LOW);

  pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
  delay(500);
}

void loop() {
  //write current thermocouple value
  au16data[2] = ((uint16_t) thermocouple.readCelsius() * 100);

  //write current fan value for air control
  // analogWrite(fan, (au16data[5] / 100.0) * 255);
  slew_fan();

  //poll modbus registers
  slave.poll( au16data, 16 );

  // heater control:
  digitalWrite(relay, HIGH);
  delay(au16data[4] * 10);
  digitalWrite(relay, LOW);
  delay((100 - au16data[4]) * 10 - 1);
}
zamunda attached the following images:
4_17.jpg 1_21.jpg 2_25.jpg 3_21.jpg

Edited by zamunda on 09/10/2021 10:26 AM
 
renatoa
Congrats !

Actually, the slew feature can be implemented human side, being careful to not move the Artisan slider in big steps. All you have to do is to refrain handling the fan slider with the mouse, is the only way to jump from 0 to 100% in a single step. With the keyboard, and up/down keys, the slider steps in small increments, even finer than the slew step from software solution.
With a bit of discipline, it could become a habit.
 
zamunda
Hello Renatoa,

Thanks for your reply and tip on using the keyboard, wasn't aware of this, tried it and is indeed very handy!

Another potential risk with modded popcorn machines is that if you leave the heater on for some reason without running the fan, after 5-10 seconds the coil burns the fan housing or worse. This happened to me once and I guess I am not the only oneGrin

Is there a way to prevent this? I thought of adding a condition in the void loop:

"if value from fan slider >50 {
start heater

} else {
...
}"

But I do not know whether this is good practice? Or are there other common solutions (besides from paying attention while roasting)?

Regards!
Edited by zamunda on 09/11/2021 10:38 AM
 
renatoa
Yep, this is the logic in TC4 too...

For any attempt to change heater level, the check below:


   if (FAN_DUTY < HTR_CUTOFF_FAN_VAL) {
      new_levelot1 = 0;
   }
   else {
      new_levelot1 = levelOT1;
   }


And reciprocal, when fan change attempt...


  if( pac_level < HTR_CUTOFF_FAN_VAL ) { // if new levelOT2 < cutoff value then turn off OT1
    output_level_icc( 0 );
 }
 else {  // turn OT1 back on again if levelOT2 is above cutoff value.
    output_level_icc( levelOT1 );   
 
zamunda
Hello Renatoa,

Thank you for this snippet, I rewrote my sketch like this based on that:


// Define minimal airflow setting
#define HTR_CUTOFF_FAN_VAL 50  // stop heater if airflow goes below this value

void loop() {
  //write current thermocouple value
  au16data[2] = ((uint16_t) thermocouple.readCelsius() * 100);

  if ( au16data[5] < HTR_CUTOFF_FAN_VAL ) { //set air to minimal value to avoid overheating
    analogWrite(fan, (HTR_CUTOFF_FAN_VAL / 100.0) * 255);
  }
  else {  // set new air value
    analogWrite(fan, (au16data[5] / 100.0) * 255);
  }

  //poll modbus registers
  slave.poll( au16data, 16 );

  if ( au16data[5] < HTR_CUTOFF_FAN_VAL ) { //stop heater to avoid overheating
    digitalWrite(relay, LOW);
    delay(500);
  }
  else {  // set new heater value
    // heater control:
    digitalWrite(relay, HIGH);
    delay(au16data[4] * 10);
    digitalWrite(relay, LOW);
    delay((100 - au16data[4]) * 10 - 1);
  }

}


Does this make sense?

Within TC, there is a var "FAN_DUTY" which holds the ACTUAL value of the fan, however, within my project, I do not know whether/how this value is stored or can be obtained from Artisan. I only know of the DESIRED value which is "au16data[5]".
Am I right here?

Thanks!
 
renatoa
Why are you operating changes on fan before the modbus poll and not after ?
This way you introduce one second delay between the slider change and fan speed change... without any benefit I can detect.
 
miyankizu

Quote

zamunda wrote:

Hello,

Based on the sketch above, I did some roasting with batches of 100gram. I think the result comes out quite nice, from Artisan I can control heat and air conveniently. I mounted the roaster on a wooden box which I can open later to check wirings etc. Bluetooth also works well.
Also built a simple chaff collector which sits on top of the roaster which can be emptied from time to time.

BTW: I disabled the "slew-function" withing the sketch for now since this "messed up" de loop-functionality within Arduino. So far, I did not experience overload problems (which was something this function should help to prevent)

Obviously there is much room for improvement but this was/is an (exciting) learning-by-doing-and-falling process.

Hardware used in this build:
- Princess Popcorn popper (1200W/220V)
- MAX6675 sensor for temp readings
- Arduino UNO (3)
- (Manual) DC voltage adapter for fan
- L298N DC-Motor Controller for slider-controlling the fan from Artisan
- Solid state relay for controlling the heat element
- Bluetooth module HC06 for wireless connection from Artisan to roaster
- DC-adapter iPhone for Arduino

Big thanks to everyone on this forum, if you have any questions/suggestions, please let me know.

Quote

zamunda wrote:

Hello,

Finally, I achieved to connect over Modbus/Bluetooth, I had to change the sketch by assigning PINs to RX/TX other than the dedicated PINs on the Arduino and use SoftwareSerial.

The following sketch worked for me:


#include <max6675.h>
#include <ModbusRtu.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8); // RX, TX

// data array for modbus network sharing
uint16_t au16data[16] = {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1
};

/**
    Modbus object declaration
    u8id : node id = 0 for master, = 1..247 for slave
    u8serno : serial port (use 0 for Serial)
    u8txenpin : 0 for RS-232 and USB-FTDI
                 or any pin number > 1 for RS-485
*/
Modbus slave(1, mySerial, 0); // this is slave @1 and RS-232 or USB-FTDI

// Pins for thermocouple MAX6675
int thermoDO = 6;
int thermoCS = 5;
int thermoCLK = 4;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

// declare variable for Arduino pin connected to solid state relay (SSR)
int relay = 9;

// declare variables for Arduino pins connected to fan controller (L293N)
int fan = 10; // ENA of L239N
int in1 = 11; // IN1 of L239N
int in2 = 12; // IN1 of L239N

// declare variables for Arduino pins to power MAX6675:
int vccPin = 3; // 5v power of MAX6675
int gndPin = 2; // gnd of MAX6675

// slew rate limitations for fan control
#define SLEW_STEP 10 // increase in steps of 10% for smooth transition
int target = 0;
int current = 0;

void slew_fan() { // limit fan speed increases
  target = ((au16data[5] / 100.0) * 255);
  if ( target < current ) { // ramping down, so check rate
    uint8_t delta = current - target;
    if ( delta > SLEW_STEP ) // limit the step size
      delta = SLEW_STEP;
    analogWrite(fan, (current - delta ));
    current = current - delta;
  }
  else if ( target > current ) { // ramping up, so check rate
    uint8_t delta = target - current;
    if ( delta > SLEW_STEP ) // limit the step size
      delta = SLEW_STEP;
    //write current fan value for air control
    analogWrite(fan, (current + delta ));
    current = current + delta;
  }
}


void setup() {
  mySerial.begin(19200); // Soft Serial used for communication through Bluetooth module HC-06
  slave.start( ); // 19200 baud, 8-bits, even, 1-bit stop
  // use Arduino pins
  pinMode(relay, OUTPUT);
  pinMode(fan, OUTPUT);
  //fan direction can be reversed by interchanging values for in1 and in2
  pinMode(in1, OUTPUT); digitalWrite(in1, HIGH);
  pinMode(in2, OUTPUT); digitalWrite(in2, LOW);

  pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
  delay(500);
}

void loop() {
  //write current thermocouple value
  au16data[2] = ((uint16_t) thermocouple.readCelsius() * 100);

  //write current fan value for air control
  // analogWrite(fan, (au16data[5] / 100.0) * 255);
  slew_fan();

  //poll modbus registers
  slave.poll( au16data, 16 );

  // heater control:
  digitalWrite(relay, HIGH);
  delay(au16data[4] * 10);
  digitalWrite(relay, LOW);
  delay((100 - au16data[4]) * 10 - 1);
}


hello zamunda , renatoa I appriciate for your effort. I also try to apply for solutions to my system. Also I have get modbus connection problem. when I check connection baudrate for HC-06 it has written as 9600 and I am not able to change it. I tried another solution to change baudrate in skecth as "9600" instead of "19200". Do you have any solution for it ?
miyankizu attached the following image:
1_22.jpg
 
zamunda
Hello,

I just recently how to work with Arduino and how to change baudrates of the HC-06 so I am not that experienced but this video helped me a lot



In short, you have to connect the RX and TX-pins of the HC-06 to the TX and RX-pin of the Arduino.
Then go to the serial monitor of the IDE and send fe the command 'AT'...it should respond with 'OK'
If you do not get a response you have to tweak settings:
- set baudrate of serial monitor to '9600' if you have not changed initital rate of HC-06
- set "No line ending" in the serial monitor as well
- interchange RX and TX connection cables from HC-06 to Arduino and try again...

Once you get an 'OK' you can change baudrate with command 'AT+BAUD5' if I recall well.

As said, the mentioned video was very helpfull for me.

Hope this helps!

Regards
 
miyankizu

Quote

zamunda wrote:

Hello,

I just recently how to work with Arduino and how to change baudrates of the HC-06 so I am not that experienced but this video helped me a lot



In short, you have to connect the RX and TX-pins of the HC-06 to the TX and RX-pin of the Arduino.
Then go to the serial monitor of the IDE and send fe the command 'AT'...it should respond with 'OK'
If you do not get a response you have to tweak settings:
- set baudrate of serial monitor to '9600' if you have not changed initital rate of HC-06
- set "No line ending" in the serial monitor as well
- interchange RX and TX connection cables from HC-06 to Arduino and try again...

Once you get an 'OK' you can change baudrate with command 'AT+BAUD5' if I recall well.

As said, the mentioned video was very helpfull for me.

Hope this helps!

Regards


thank you very much , I will check and if I found which works for me , I will update this topic
 
miyankizu
Updated info : I changed my skecth again 19200 to 9600 and make same updates on MODBUS connection also in Artisan. And changed jumper cables in case of any problem. Now it works
it reads values well. I haven't test it with popper , till now it goes good. Thanks to zamunda and renatoa smile
 
zamunda
Hello,

Showing some results from Artisan....

I roasted 80grs and 100 grs today playing with Air and Heater...works quite well technically I think...Normally I start with full air and 80% heat and after 3-4 minutes I lower the air a bit and increase some heat. Depending on ambiente temperature, I get first crack at 6-8 minutes, then leave the beans a minute after FC and finally cool them down in the roaster, cooling down to 30-40 degrees goes quite fast (< 1min).
Happy with the result so far...Any comments are highly appreciated!

Did a quick test with PID control but got quite confused with so many parameters to set, in fact, do not know how to start there...
The settings shown in the image copied them from another project without really understanding how it worksGrin
Could some of you help me a bit in explaining the basic concept of PID-control?

Thanks!
zamunda attached the following images:
80grs.png 100grs.png aaa_1.png pid_1.png

Edited by zamunda on 10/06/2021 12:42 PM
 
miyankizu
It is nice to hear that well done ThumbsUp I think you can roast more grams by chaning your power supply of fan. Also adding a tin can at the top of chamber. Because I can swirl 150 grams in my system with 24v 5A.

By the way I built up your system. I can read temperature , but I'm not able to give a control from Artisan. I'm not sure that I can send the data to L298N from Arduino. Can you please share your circuit connection. I try to make my connections over your sketch and picture as I can see Grin

Here is my circuit.



Quote

zamunda wrote:

Hello,

Showing some results from Artisan....

I roasted 80grs and 100 grs today playing with Air and Heater...works quite well technically I think...Normally I start with full air and 80% heat and after 3-4 minutes I lower the air a bit and increase some heat. Depending on ambiente temperature, I get first crack at 6-8 minutes, then leave the beans a minute after FC and finally cool them down in the roaster, cooling down to 30-40 degrees goes quite fast (< 1min).
Happy with the result so far...Any comments are highly appreciated!

Did a quick test with PID control but got quite confused with so many parameters to set, in fact, do not know how to start there...
The settings shown in the image copied them from another project without really understanding how it worksGrin
Could some of you help me a bit in explaining the basic concept of PID-control?

Thanks!
miyankizu attached the following images:
img_2894.jpg inkedimg_2895_li.jpg
 
zamunda
Hello

Yesterday I created a project on Github to make sharing easier:
https://github.co...daroaster/

Haven't uploaded a circuit though but will try to do that shortly.

What is it that you can not control from Artisan? Have you created a slider for both heater and air?

Maybe you could download the settings from the Artisan folder and load these into yours and see how I have configured things (obviously adjust it according your setup, USB or BT, etc):
https://github.co...in/artisan

Hope this helps for now...
 
zamunda
Hello,

Updated the sketch for this project (with a big help of a friend) since I felt this could be done more efficiently within the loop separating controls for air, temperature and heater. Within the previous version, delays for air and temperature depended on the heater-delay.

Did some roasts with this setup and there is evidently less delay in response when moving sliders within Artisan for air, also temp changes are shown at a higher frequency.

https://github.co...Heater.ino

Please let me know if you have any comments.

Regards,
Bert
########################
### A lot can happen over coffee ###
########################
 
zamunda
Hello,

In order to test the minimal 'delay' (=conversion time) for the MAX6675 to be set within the loop, I added a temporary slider within Artisan. Its value is send to Arduino, this way I could determine by increasing/diminishing airflow that using '200ms' is still ok, '150ms' freezes the temperature showing within Artisan...



'20' = 200ms
'15' = 150ms
etc.
zamunda attached the following image:
whatsapp_image_2021-12-03_at_135025.jpeg

Edited by zamunda on 12/05/2021 8:24 AM
########################
### A lot can happen over coffee ###
########################
 
renatoa
Chip specs say 250 ms, better stay on the safe side.
 
Golfkung
Help me please. I follow coding reference below. and I big thank first.
But I found problem from this .Please refer tu attached figure for my problem.


Quote

zamunda wrote:

Hello Renatoa,

Thanks for explaining how to work with the fan and MODBUS. I did a quick test with a separate fan and this works...
Only thing I noticed is that the fan reacts only after 2-3 seconds when moving the air slider...

This is the sketch I have used right now (see below), tomorrow I will test it with a roaster...

Also will try to look into the TC4 code regarding the big current issue.

A big thanks again and I'll keep you posted!


#include <max6675.h>
#include <ModbusRtu.h>

// data array for modbus network sharing
uint16_t au16data[16] = {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1
};

/**
    Modbus object declaration
    u8id : node id = 0 for master, = 1..247 for slave
    u8serno : serial port (use 0 for Serial)
    u8txenpin : 0 for RS-232 and USB-FTDI
                 or any pin number > 1 for RS-485
*/
Modbus slave(1, 0, 0); // this is slave @1 and RS-232 or USB-FTDI

// Pins for thermocouple MAX6675
int thermoDO = 6;
int thermoCS = 5;
int thermoCLK = 4;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

// declare variable for Arduino pin connected to solid state relay (SSR)
int relay = 9;

// declare variables for Arduino pins connected to fan controller (L293N)
int fan = 10; // ENA of L239N
int in1 = 11; // IN1 of L239N
int in2 = 12; // IN1 of L239N

// declare variables for Arduino pins to power MAX6675:
int vccPin = 3; // 5v power of MAX6675
int gndPin = 2; // gnd of MAX6675

void setup() {
  slave.begin( 19200); // 19200 baud, 8-bits, even, 1-bit stop
  // use Arduino pins
  pinMode(relay, OUTPUT);
  pinMode(fan, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
   
  pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
  delay(500);
}

void loop() {
  //write current thermocouple value
  au16data[2] = ((uint16_t) thermocouple.readCelsius() * 100);

  //write current fan value for air control
  analogWrite(fan, (au16data[5] / 100.0) * 255);
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);

  //poll modbus registers
  slave.poll( au16data, 16 );

  // heater control:
  digitalWrite(relay, HIGH);
  delay(au16data[4] * 10);
  digitalWrite(relay, LOW);
  delay((100 - au16data[4]) * 10 - 1);
}

Edited by Golfkung on 04/11/2023 9:08 AM
 
renatoa
Which figure ? You only quoted a post...
 
Golfkung

Quote

renatoa wrote:

Which figure ? You only quoted a post...


I have alreaady attached picture.
 
Golfkung

Quote

renatoa wrote:

Which figure ? You only quoted a post...


For serial log====>
version = 2.8.2

24 22:02:29.027 MODBUS readSingleRegister : 0.0ms => /dev/cu.wchusbserial140,19200,8,N,1,0.6 || Slave = 1 || Register = 2 || Code = 3 || Rx = None || retries = 0
================================================================================f
For Artisan platdorm
version = 2.8.2 (f525b16)
Architecture = ('64bit', '')
Mac = ('13.3.1', ('', '', ''), 'x86_64')
Machine = x86_64
Platform name = macOS-13.3.1-x86_64-i386-64bit
Processor = i386
Python Branch =
Python Build = ('main', 'Dec 8 2022 16:43:53')
Python Compiler = Clang 12.0.0 (clang-1200.0.32.28)
Python Implementation = CPython
Python Revision =
Python version = 3.11.0
Release = 22.4.0
System = Darwin
Version = Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103
 
Golfkung

Quote

Golfkung wrote:

Quote

renatoa wrote:

Which figure ? You only quoted a post...


For serial log====>
version = 2.8.2

24 22:02:29.027 MODBUS readSingleRegister : 0.0ms => /dev/cu.wchusbserial140,19200,8,N,1,0.6 || Slave = 1 || Register = 2 || Code = 3 || Rx = None || retries = 0
================================================================================f
For Artisan platdorm
version = 2.8.2 (f525b16)
Architecture = ('64bit', '')
Mac = ('13.3.1', ('', '', ''), 'x86_64')
Machine = x86_64
Platform name = macOS-13.3.1-x86_64-i386-64bit
Processor = i386
Python Branch =
Python Build = ('main', 'Dec 8 2022 16:43:53')
Python Compiler = Clang 12.0.0 (clang-1200.0.32.28)
Python Implementation = CPython
Python Revision =
Python version = 3.11.0
Release = 22.4.0
System = Darwin
Version = Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103


Sorry for many tiom. I would like re attach picture.
Golfkung attached the following image:
image_11-4-2566_be_at_2037.jpg
 
Jump to Forum: