Table of Contents
CFMEGA2
This is an Arduino Mega compatible CPU module. It is designed to be used for GPIO, communication, ADC, NTC (temperature), etc.
- The CPU module must be located on the far left. Connect the I/O module to the right.
- Up to 16 I/O modules can be connected to one CPU module.
MCU Details
- MCU: ATMega2560
- Program memory: 256KB
- SRAM memory: 8KB
- EEPROM: 4KB
Device Details
- Power supply: DC 12~24V1)
- CPU module current consumption: 0.5W
- Communication: CH1 : RS232C, CH2 : RS232C, CH3 : RS485
- I2C : 1 (Can connect QWIIC Modules)
- GPIO: 8 (7 x PWM) 5V input/output
- INT : 2 (External Interrupt Input, 5V input)
- ADC: 8 (0~20mA - 4 channels, 0~10VDC - 4 channels)
- STATUS LED : 13=LED, 22=RUN, 23=ERROR
- Temperature: 1 (NTC, measurement range -40~99℃, error +/- 1 degree)
Description of each part
* What is QWIIC? This is a product line of Arduino I2C peripherals sold by Sparkfun, USA. Reference link
About GPIO
The GPIO port is a port that can be used for 5V input/output or PWM output. In fact, it is the same as the I/O terminal on a regular Arduino. However, a TVS diode for surge blocking is installed internally.
About RS485 (Channel 3)
The RS485 port assigned to Channel 3 is a port that uses the MAX13487 chip, which automatically switches the transmission and reception directions. Therefore, there is no need for users to handle sending/receiving directly.
About Power Connection
Please connect a voltage between DC12 and 24V into one of the DC jack and terminal blocks. Determine the power capacity according to the total number of connected I/O modules. If there are less than five, 24V 1A is suitable. If it is more than that, choose a larger capacity.
Example program
- LED blinking : This is a program that blinks the LED.
const int StatusLED = 13; void setup() { pinMode(StatusLED, OUTPUT); } void loop() { digitalWrite(StatusLED, HIGH); delay(1000); digitalWrite(StatusLED, LOW); delay(1000); }
- ADC analog input: This is a program that receives current/voltage input. Additional logic is required to convert the raw digital value (0~1024) to units like milliamps or voltage.
void setup() { Serial.begin(9600); } void loop() { int current_raw_value = analogRead(A0); int voltage_raw_value = analogRead(A5); Serial.print(" Current Raw Value = "); Serial.print(current_raw_value ) ; Serial.print("\r\n" ); Serial.print(" Voltage Raw Value = "); Serial.print(voltage_raw_value ); Serial.print("\r\n" ); delay(200); }
- NTC Temperature: NTC temperature measurement program. (Measurement range -40 ~ 99℃ / error +/-1 degree)
- Use after registering “CFMEGA.h” library
- Read temperature value with
ntcRead_a4()function - NTC sensor sold separately
int16_t ntcRead_a4(void);
#include "CFMEGA.h" void setup() { Serial.begin(9600); } void loop() { int NTC_a4 = ntcRead_a4(); Serial.print(" TEMP = "); Serial.print(NTC_a4) ; Serial.print("\r\n" ); delay(1000); }
- RS232 communication: Eco communication program for channel 1 (Tx1, Rx1).
void setup() { Serial.begin(9600); Serial1.begin(9600); } void loop() { if (Serial1.available() > 0) { char rx_Byte = Serial1.read(); Serial.print("I received: "); Serial.print(rx_Byte); Serial1.print(rx_Byte); } }
Power Supply
If the total number of connected modules is 8 or less, a 24V, 1A SMPS is suitable. If the total number is 8 or more, use a 24V, 2A SMPS.
