CM3-Home

Serial port interface

A serial port interface at 3.3 volt is available on the CM3-Home to connect external microcontrollers like Arduino or ESP8266.

The signals are available on screw terminals as visible below and are at 3.3 volt level. The lines are not-tolerant to 5 volt.


How to use the serial port

This port is visible in Linux as /dev/ttyUSB3 device.

Example in Python

Install the Python serial library:

sudo apt-get update
sudo apt-get install python-serial 

This example sends a string on the serial port each 1 second at 115200,N,8,1 and checks if any character is received from a remote serial terminal.

#!/usr/bin/python
import serial
import time

ser = serial.Serial(
    port='/dev/ttyUSB3',
    baudrate=115200,
    timeout=1,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
)
ser.flushOutput()
ser.flushInput()

rx_counter=0
tx_counter=0
while True:
    tx_counter=tx_counter+1
    ser.write("Tx counter = %d | Rx counter = %d\n\r" % (tx_counter,rx_counter))
    print("Tx counter = %d | Rx counter = %d" % (tx_counter,rx_counter))

    a=ser.read(1)

    if a:
        rx_counter=rx_counter+1
        ser.write("Tx counter = %d | Rx counter = %d | Received: %s %02x\n\r" % (tx_counter,rx_counter,a,ord(a)))
        print("Tx counter = %d | Rx counter = %d | Received: %s %02x" % (tx_counter,rx_counter,a,ord(a)))

Listing ports

The command:

python -m serial.tools.list_ports 

will print a list of available serial ports.

Note

This serial port is slightly different from the Raspberry PI3 /dev/ttyAMA0. Some programs initialize pyserial in this way

def connect(self):
    """ Connects to the device and starts the read thread """
    self.serial = serial.Serial(dsrdtr=True, rtscts=True, port=self.port, baudrate=self.baudr$
                                timeout=self.timeout,*self.com_args,**self.com_kwargs)

This doesn't work correctly on the /dev/ttyUSB3, the hardware handshake criteria must be disabled, as is in the default configuration, they are not managed:

def connect(self):
    """ Connects to the device and starts the read thread """
    self.serial = serial.Serial(dsrdtr=False, rtscts=False, port=self.port, baudrate=self.baudr$
                                timeout=self.timeout,*self.com_args,**self.com_kwargs)

Links

eShop

EUR 130.00


CM3-HOME-B - CM3-Home board basic (only mother board)

CM3-Home is a Raspberry Pi Compute Module 3 motherboard designed to provide a reliable Home Automation hardware equipped with a wide range of electrical interfaces

  • NOT INCLUDED:
    • TP-BUS, LIGHT-BUS, RS485 (one instead of two), Yarm 868 MHz radio module (available on CM3-HOME-F)
    • Wifi module (Product # WIFI-2) amd antenna (Product # AN-WIFI-01)
    • The Raspberry Compute Module 3 or 3L (Product # CM3L)
    • MicroSD (Product # MICROSD8G-E)
    • Case (Product # CM3-HOME-CASE)
| Product description || CM3-Home catalog |

EUR 290.00


CM3-HOME-F - CM3-Home board full (only mother board)

CM3-Home is a Raspberry Pi Compute Module 3 motherboard designed to provide a reliable Home Automation hardware equipped with a wide range of electrical interfaces

  • NOT INCLUDED:
    • Raspberry Compute Module 3 or 3L (Product # CM3L)
    • Yarm antenna (Product # YARM-ANT-01)
    • Case (Product # CM3-HOME-CASE)
    • MicroSD (Product # MICROSD8G-E)
  • Included:
    • WiFi module (Product # WIFI-2)
    • WiFi antenna (Product # AN-WIFI-01)

For more info please visit the product description page

| Product description || CM3-Home catalog |

Sergio Tanzilli
System designer, software developer and company co-founder
tanzilli@acmesystems.it
Webpages: https://www.acmesystems.it and http://www.tanzolab.it
Github repository: https://github.com/tanzilli and https://github.com/acmesystems