匿名
未登录
登录
丢石头百科
搜索
查看“树莓派智能车AlphaBot教程10:刷LEDE(OpenWRT)系统”的源代码
来自丢石头百科
名字空间
页面
讨论
更多
更多
页面选项
查看
查看源代码
历史
←
树莓派智能车AlphaBot教程10:刷LEDE(OpenWRT)系统
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
1.下载镜像,这个lede好像是openwrt的一个分支,openwrt本身还没有支持pi3 https://downloads.lede-project.org/snapshots/targets/brcm2708/bcm2710/lede-brcm2708-bcm2710-rpi-3-ext4-sdcard.img 2.刻录到tf卡,windows使用Win32DiskImager,linux使用dd命令。 [[File:173131xa4i8g395mii3i46.jpg]] 3.树莓派接电,使用网线连接电脑。系统启动后可以通过串口登录,此时还不能通过SSH登录。 [[File:091942yuffxsjdwao7fdf7.jpg]] 4.修改/etc/config/network <syntaxhighlight lang="python"> config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config globals 'globals' option ula_prefix 'fd11:8629:b448::/48' config interface 'lan' option type 'bridge' # option ifname 'eth0' option proto 'static' option ipaddr '192.168.8.1' option netmask '255.255.255.0' option ip6assign '60' config interface wan option proto dhcp option ifname eth0</syntaxhighlight> [[File:171603ntus9t4tpv0yuui5.jpg]] IP地址可改为其他IP,避免和局域网内其他路由器冲突。 5.修改/etc/config/wireless <syntaxhighlight lang="python"> config wifi-device radio0 option type mac80211 option channel 11 option hwmode 11g option path 'platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1' option htmode HT20 # REMOVE THIS LINE TO ENABLE WIFI: option disabled 0 config wifi-iface option device radio0 option network lan option mode ap option ssid OpenWrt_RPI3 option encryption psk2 option key yourwifikey</syntaxhighlight> [[File:171602akwkkurzkpkwm8tb.jpg]] 6.输入passwd修改root用户密码后,重启,网线连接路由器dhcp获取ip,电脑用wifi连接树莓派。此时可通过SSH登录树莓派。 [[File:171602mxna8jzx2qe68egj.jpg]] 7.安装luci界面,可以通过浏览器访问路由 <syntaxhighlight lang="python"> opkg install luci /etc/init.d/uhttpd start /etc/init.d/uhttpd enable</syntaxhighlight> [[File:091140uvitza8j8vjtjj3j.jpg]] 在浏览器中输入对应的IP地址,输入密码登录。 [[File:091503nag82qbbzgbpks64.jpg]] 8.可以开始折腾了。在System->Software中点击Update lists后可以通过路由器界面Luci安装对应的软件,也可以继续在命令行下通过opkg安装软件。 同理很多设置也可以在Luci界面修改,也可以在命令下修改。 [[File:092258adzh2e4ih2kmwp2d.jpg]] 首先可以更改一个酷炫的皮肤。输入主题“theme”搜索对应的包,在可用包中找到"luci-theme-material"并安装。 [[File:093037zyubzubwuflyn4re.jpg]] 可以在System->System 中选择对应的主题“Material”. [[File:093430gpofdsdzkttnrmes.jpg]] 同理可以按照刚才的方法安装luci-i18n-base-zh-cn,设置中文显示或者在命令行下输入如下命令安装。 <syntaxhighlight lang="python"> opkg install luci-i18n-base-zh-cn</syntaxhighlight> 语言设置的位置在:System-System- System Properties- Language and Style- Language 通过下拉菜单选择。 [[File:094243fhim9aahbmrztbaz.jpg]] 9.通过mjpg-stream实行网络监控 首先安装以下摄像头的驱动。 <syntaxhighlight lang="python"> opkg kmod-usb2 opkg install kmod-video-core opkg install kmod-video-uvc #免驱uvc摄像头 opkg install kmod-input-core</syntaxhighlight> 如果能找到 /dev/video0 的设备文件,就说明驱动已经安装成功。 树莓派专用的摄像头可能要需要安装如下包。事实上本人弄了很久都没有找到/dev/video0,希望有哪位大神找到使用树莓派专用摄像头的方法能告知本人。 <syntaxhighlight lang="python"> opkg install kmod-video-bcm2835</syntaxhighlight>下面使用USB接口的摄像头继续讲解。 安装mjpg-streamer <syntaxhighlight lang="python"> opkg install mjpg-streamer opkg install luci-app-mjpg-streamer opkg install luci-i18n-mjpg-streamer-zh-cn </syntaxhighlight> 其中lui-app-mjpg-stream为luci界面上使用mjpg-streamer的插件,luci-i18n-mjpg-streamer-zh-cn为插件的中文包。 帧率设置为30.否则不能显示。摄像头支持YUYV格式,不支持MJPG,所以勾选启动YUYV格式。 [[File:110231gzxt4xyzo74z9vwt.jpg]] 此时在浏览器上输入192.168.8.1:8080即可看到摄像头上拍摄的图像。 10.以太网转串口输出。用路由器制作wifi视频小车时,通常是路由器作为视频串口,单片机作为小车主控。 手机发送信号到路由器,路由器将网络信号转为串口发送到单片机,单片机再控制小车。 Ser2net为以太网转串口软件,输入如下命令安装 <syntaxhighlight lang="python"> opkg install ser2net</syntaxhighlight> 输入如下命令配置ser2net <syntaxhighlight lang="python"> vi /etc/ser2net.config</syntaxhighlight> 配置格式: <*TCP端口号>:<状态>:<超时>:<设备>:<选项> TCP端口号:【host,】port,也就是说可以这样写localhost,2020 意思就是使用本机的2020端口作为映射端口 状态:可以填写raw,rawlp,tel*net或者off off禁止端口,但是可以从控制口唤醒 raw:在端口和串口设备之间双向通信 rawlp:端口想串口设备单向通信 telnet: 超时:指定一个数值用于超时,写0禁用超时 设备:必须这样写/dev/《设备名称》 选项:设置串口的参数如:波特率(300,1200,2400,4800,9600,19200,38400,57600,115200) 校验(EVEN,ODD,NONE) 停止位(1STOPBIT,2STOPBITS) 数据位(7DATABITS,8DATABITS) 开启(关闭)XON\XOFF :XONXOFF(-XONXOFF) 开启(关闭)硬件控制流:RTSCTS(-RTSCTS) 对于树莓派3B,串口为/dev/ttyS0,在/etc/ser2net.config 文件中可以找到如下语句,默认已经设置串口 <syntaxhighlight lang="python"> 2001:raw:600:/dev/ttyS0:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS</syntaxhighlight> 可以修改波特率为115200. <syntaxhighlight lang="python"> 2001:raw:600:/dev/ttyS0:115200 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS</syntaxhighlight> 启动ser2net <syntaxhighlight lang="python"> ser2net -c /etc/ser2net.conf</syntaxhighlight> 由于串口默认作为shell 控制端,古为了避免干扰需禁止。 <syntaxhighlight lang="python"> vi /etc/inittab</syntaxhighlight> 删掉或者注释掉后面两句。重启后串口不能再作为shell控制端,但是系统启动时,串口仍然会输出系统信息。 <syntaxhighlight lang="python"> ::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K shutdown #::askconsole:/usr/libexec/login.sh #tty1::askfirst:/usr/libexec/login.sh</syntaxhighlight> 设置ser2net 开机启动。 命令vi /etc/rc.local 打开它,i进入编辑,在exit0的上一行添加一条ser2net 输入命令vi /etc/init.d/ser2net,新建文件编辑 <syntaxhighlight lang="python"> #!/bin/sh /etc/rc.common # /init.d/my-ser2net START=99 start() { ser2net –c /etc/ser2net.conf }</syntaxhighlight> 保存重启。此时通过以太网发送给192.168.8.1:2001端口的信号会通过串口转发出去。
返回至
树莓派智能车AlphaBot教程10:刷LEDE(OpenWRT)系统
。
导航
导航
首页
最近更改
随机页面
MediaWiki帮助
首页
首页
树莓派
主机
配件包
外壳
键鼠
电源
扩展板
显示屏
墨水屏
摄像模块
通信模块
继电器
电机驱动板
游戏机
产品分类
树莓派
Arduino
micro:bit
STM32
Espressif
WiFi模块
蓝牙模块
无线模块
LoRa模块
4G模块
GSM
GPRS
以太网
导航模块
北斗卫星
GPS
LCD
墨水屏
OLED
摄像头
USB模块
串口模块
RS232
RS485
CAN
传感器
温度模块
湿度模块
气压模块
继电器
电机模块
指纹模块
电平转换
音频模块
编程器
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志