

Core automatic robot raspberrypi extension pcb
# Uncomment some or all of these to enable the optional hardware interfaces #dtparam=i2carm=on #dtparam=i2s=on dtparam=spi=on
- Size
- 56.5 × 65 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 26
- Nets
- 52
- Pads
- 118
- Tracks, vias
- 252, 19
- Pours
- 1
- Routed
- Yes
- KiCad
- KiCad 7 (file 20221018)
- Created
- 18 Sep 2023
- Updated
- 7 Mar 2025
Overview
Core automatic robot raspberrypi extension pcb is an open-source printed circuit board by scramble-robot, from the scramble-robot/CoRE_AutoRobot_2024_raspberrypi repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 56.5 × 65 mm with 26 parts on 52 nets, routed with 252 tracks and 19 vias.
It is built around the TJA1051T/3/1 and B2P-VH. Its parts include 10 connectors, 5 capacitors, 3 resistors, 2 ICs and 1 crystal. It belongs with the robots and motor control boards of this library.
Main components
2README
README.mdSDカード
- Raspberry Pi ImagerでRaspberry Pi OS Lite (64-bit,bullseye)をMicro SDに書き込む。Imagerの設定でユーザ名piとパスワードを予め設定すること。
- Micro SDに作成された"bootfs"ドライブ直下に
sshという名前のファイルを配置してSSHを有効化する。 - OS起動後、本レポジトリの
ros2_ws及びserviceディレクトリをホームディレクトリ(/home/pi/)にコピーする。
C620とのCAN通信
MCP2515を用いてSPIからCANを制御
ハードウェア
1Mbpsの通信を行うために、水晶振動子を16MHzに交換すること
CAN-BUSの有効化
-
/boot/config.txtを編集してSPIとMCP2515を有効化するbash sudo vi /boot/config.txttext # Uncomment some or all of these to enable the optional hardware interfaces #dtparam=i2c_arm=on #dtparam=i2s=on dtparam=spi=on # MCP2515 dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay -
初期化できているか確認
text dmesg | grep mcp251x
can-utilsのインストール
sudo apt install can-utils通信テスト
1Mbpsでlink up
sudo ip link set can0 type can bitrate 1000000 loopback off
sudo ip link set can0 up
sudo ifconfig can0 txqueuelen 1000
sudo ifconfig受信テスト
candump can0C620と通信できていると、以下のようなデータが受信される。
can0 201 [8] 0E 16 00 00 FF FD 21 00
can0 201 [8] 0E 16 00 00 FF FD 21 00
can0 201 [8] 0E 16 00 00 FF BE 21 00
can0 201 [8] 0E 16 00 00 FF FD 21 00
can0 201 [8] 0E 16 00 00 00 3D 21 00送信
モータ回るはず
cansend can0 200#0200000000000000systemdによるCANバスの自動有効化
-
systemdの設定
bash sudo vi /etc/systemd/network/80-can.networktext [Match] Name=can* [CAN] BitRate=1000000設定後、以下コマンド実行
bash sudo systemctl enable systemd-networkd sudo systemctl start systemd-networkd -
txqueuelenの自動設定
bash sudo vi /etc/udev/rules.d/71-can-txqueuelen.rulestext SUBSYSTEM=="net", ACTION=="add|change", KERNEL=="can*", ATTR{tx_queue_len}="1000" -
再起動後、
ifconfigでlink upしていることを確認text can0: flags=193<UP,RUNNING,NOARP> mtu 16 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Pythonからの制御
pip install python-canimport can
import struct
import time
bus = can.interface.Bus(bustype="socketcan", channel="can0", bitrate=1000000)
def set_current(bus, currents):
d = [0]*8
raw_array = [0]*4
for i in range(4):
v = int(round(currents[i]/20 * 16384))
v = min(v, 16384)
v = max(v, -16384)
raw_array[i] = v
b = struct.pack('>4h', *raw_array)
msg = can.Message(arbitration_id=0x200, is_extended_id=False, data=b)
bus.send(msg)
def parse_c620_data(msg: can.Message):
data = struct.unpack('>hhhbb', msg.data)
degree = data[0]/ 8192 * 360
rpm = data[1]
current = data[2]/16384*20サーボモータ
ハードウェア
- 信号線はGPIO17に接続
- サーボモータの5Vは外部電源から取ること
requirements
sudo apt install -y pigpio python3-pigpio
sudo pigpiod
sudo systemctl enable pigpiod動作確認
import pigpio
output_pin = 12 # 12 or 13
def setServoDegree(pi, output_pin, degree):
min_width = 500
max_width = 2500
deg_range = 270
output = degree / deg_range
output *= max_width - min_width
output += min_width
output = int(output)
pi.set_servo_pulsewidth(output_pin, output)
pi = pigpio.pi()
pi.set_mode(output_pin, pigpio.OUTPUT)
pi.set_servo_pulsewidth(output_pin, 0)
while True:
print("input Duty Cyle (0 - 270)")
degree = float(input())
setServoDegree(pi, output_pin, degree)ROS2のインストール
Raspbian OS用の、非公式のdebパッケージを使ってインストールする
wget https://github.com/Ar-Ray-code/rpi-bullseye-ros2/releases/download/ros2-0.3.1/ros-humble-desktop-0.3.1_20221218_arm64.deb
sudo apt install ./ros-humble-desktop-0.3.1_20221218_arm64.deb
sudo pip install vcstool colcon-common-extensions
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source ~/.bashrcROS2パッケージのビルド
cd ~/ros2_ws
colcon build --symlink-install
source install/local_setup.bash
echo "source ~/ros2_ws/install/setup.bash" >> ~/.bashrcROS2ノードの実行
ros2 launch scramble_auto_robot hardware.launch.py- この段階で下記のようなエラーが出る場合は,Raspberry piのOSのバージョンが誤っているためSDカード作成からやり直す必要がある.OSのバージョンはbullseyeを指定すること(何も指定しないと最新版のbookwormがインストールされる)
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [py]: No module named 'rclpy._rclpy_pybind11'
The C extension '/opt/ros/humble/lib/python3.9/site-packages/_rclpy_pybind11.cpython-311-aarch64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions確認
ros2 topic pub /can_node/c620_0/target_current std_msgs/Float64 "{data: 1.0}"
ros2 topic pub /can_node/c620_0/target_current std_msgs/Float64 "{data: 0.0}"
ros2 topic pub /servo0/degree std_msgs/Float64 "{data: 0}"
ros2 topic pub /servo1/degree std_msgs/Float64 "{data: 0}"
ros2 topic echo /can_node/c620_0/rpm自動起動
sudo ln -s /home/pi/service/scramble_auto_robot_ros2.service /etc/systemd/system
chmod 755 /home/pi/service/ros2_launch.sh
sudo systemctl enable scramble_auto_robot_ros2.service
sudo systemctl start scramble_auto_robot_ros2.service
systemctl status scramble_auto_robot_ros2.service起動オプションの変更
- ターミナルで
sudo raspi-configを実行 - "1. System Options"を選択
- "S6 Network as Boot"でネットワーク確率までBootを待つように設定
- "S5 Boot / Auto Login"で"Console Autologin"を選択
SDカードのRead only化
SDカードへの書き込み中に電源を抜くとSDカードが壊れる可能性があるので、read-onlyに設定する。
参考: Raspberry Pi で Overlay File System (read-only file system) を試す
- ターミナルで
sudo raspi-configを実行 - "4 Performance Options Configure performance settings"
- "P3 Overlay File System Enable/disable read-only file system"
- 有効化して再起動
その他
- ros2_launch.shにて
ROS_DOMAIN_ID=0に設定しています。 - デフォルトの設定ではIPアドレスの割当はDHCPで行われます。
Third-party license
本手順で作成した場合、以下のサードパーティ製ソフトウェアがインストールされます。 (本レポジトリに直接は含まれていません)
- Raspbian OS
- ROS2 Humble
- rpi-bullseye-ros2 (MIT License)
- python-can (LGPL v3)
- pigpio (Unlicense)
デバッグ用
Parts
26| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | Conn_01x04_Pin | Connector_JST:JST_XH_B4B-XH-A_1x04_P2.50mm_Vertical | J7, J8, J9, J10 |
| 4 | MountingHole | MountingHole:MountingHole_3.2mm_M3 | H1, H2, H3, H4 |
| 3 | 0.1u | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | C3, C4, C5 |
| 2 | 22p | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | C1, C2 |
| 2 | 4.7k | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R1, R2 |
| 2 | Conn_01x03_Pin | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Horizontal | J3, J4 |
| 2 | PH_B2B | Connector_JST:JST_PH_B2B-PH-K_1x02_P2.00mm_Vertical | J5, J6 |
| 1 | 120 | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R3 |
| 1 | 16M | Crystal:Crystal_HC49-U_Vertical | Y1 |
| 1 | B2P-VH | Connector_JST:JST_VH_B2P-VH-B_1x02_P3.96mm_Vertical | J2 |
| 1 | Conn_02x20_Odd_Even | Connector_PinHeader_2.54mm:PinHeader_2x20_P2.54mm_Vertical | J1 |
| 1 | MCP2515-xSO | Package_SO:SOIC-18W_7.5x11.6mm_P1.27mm | U1 |
| 1 | SolderJumper_2_Open | Jumper:SolderJumper-2_P1.3mm_Open_Pad1.0x1.5mm | JP1 |
| 1 | TJA1051T-3 | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U3 |
Similar boards
- 4 layers152.4 × 152.4 mm

- 4 layers76.2 × 50.8 mm

- 4 layers100 × 100 mm

Smc power
efebasol/StepperMotorController
Rev A — single-motor bench prototype power board. Feeds the driver board (48 V), the stepper motor brake (24 V) and the logic (5 V / 3V3).
104 parts - 2 layers99.1 × 63.6 mm

- 6 layers7.5 × 1.3 mm

- 2 layers65 × 56 mm

Teamc carrier
SantiBarrios2002/mtp-f26-teamc
MTP F26 (UPC) Team C workspace: radio link budget, RFM69 firmware, protocol simulator
94 parts - 2 layers

- 4 layers198.9 × 130 mm

640A PowerAmp
SSSound13/Cambridge_640A_PowerAmp
Replacement 4-layer KiCad PCB for the Cambridge Audio Azur 640A (V1) power amp board AP12707/6
296 parts
Questions
How big is the Core automatic robot raspberrypi extension pcb PCB?
It measures 56.5 × 65 mm and has 2 copper layers, 1.6 mm thick.
What parts does the Core automatic robot raspberrypi extension pcb use?
26 parts, built around the TJA1051T/3/1 and B2P-VH. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Core automatic robot raspberrypi extension pcb KiCad files?
From the scramble-robot/CoRE_AutoRobot_2024_raspberrypi repository on GitHub, at the commit this page was made from: the board is kicad/core_automatic_robot_raspberrypi_extension_pcb.kicad_pcb and its schematic kicad/core_automatic_robot_raspberrypi_extension_pcb.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Core automatic robot raspberrypi extension pcb design in my own project?
Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).