Files
ElecScalesMeasur/README.md
2025-09-30 14:57:14 +08:00

77 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 密胺计量
[TOC]
![img.png](rk3506扩展IO引脚图.png)
一、接线
1、在图rk3506扩展IO引脚图.png
驱动器rk引脚9接脉冲+rk引脚19接脉冲-引脚9对应代码pin8
振动平台rk引脚7接振动平台12(GND)rk引脚11接振动平台10rk引脚11对应代码pin9
舵机rk引脚
步进电机方向控制rk引脚17接驱动器方向+rk引脚17对应代码pin12驱动器方向-接rk引脚19。
二、使用方法:
1、开启服务python main.py
2、发送称量重量、获取重量、置零 python send_target1.py 或 测试控制振动平台 python send_vibration_control.py
三、发送端配置 send_target.py
cmd_set_target = {
# 称量
"command": "set_target",
"payload": {
"target_weight": 200, # 称量的目标重量
"algorithm": "pid",
"direction_control": False # 控制步进电机的方向 True:给驱动器方向+ 输入高电平
}
}
数据返回:
{"measuring": false, "error": null, "current_weight": 239, "target_weight": 0, "": "pid", "set_tare": false,
"set_tare_num_time": 0, "get_weight": false, "set_vibrate":true, "set_vibrate_time": 30}
四、秤资料
链接 https://3121226.ma3you.cn/static/tourguide/content_show_v2/index.html?v=20250115&article_id=A022Emr#/
五、配置固定IP可修改/oem/usr/user_init.sh文件
```python
#!/bin/sh
# 自动配置固定 IP 和 DNS
# 配置网络
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up
route add default gw 192.168.1.1
# 配置 DNS
echo "nameserver 8.8.8.8" > /userdata/resolv.conf
# 动态覆盖只读文件 /etc/resolv.conf
mount --bind /userdata/resolv.conf /etc/resolv.conf
```
六、设置开机自启动某程序,可修改/oem/usr/user_init.sh文件官方留给用户添加程序自启动的地方
```python
python /userdata/helloword.py > /userdata/helloword.log 2>&1 &
```
执行结果保存在/userdata/helloword.log
## 可能会出现的问题
1、如果RK3506并没有出现运输的过程存在撞件的问题但是却出现如网口、串口等识别不了的情况
可能考虑重新刷一遍出厂固件(除了硬件坏了之外,其他的没有什么是不能通过刷机解决的)
## 测试3506上关于PWM设备树的引脚
```python
# 1. 查看系统中已注册的PWM控制器
ls /sys/class/pwm/ # 输出如pwmchip0、pwmchip1对应PWM0、PWM1控制器
# 2. 查看PWM0控制器的设备树配置需内核支持调试
cat /proc/device-tree/pwm@ff200000/pwm0_ch0/rockchip,pin # 查看PWM0_CH0绑定的引脚
# 输出可能类似“gpio0 0”对应GPIO0_A0参考文档2.6节引脚编号规则)
# 3. 查看引脚的功能复用状态确认是否为PWM功能
cat /sys/kernel/debug/pinctrl/pinctrl-rockchip:gpio0/pins | grep -A5 "gpio0-0"
# 输出中若有“function: pwm0_ch0”说明GPIO0_A0已复用为PWM0_CH0
```