Giter Site home page Giter Site logo

balance_bike's Introduction

概述

这是一个自平衡自行车,用买来的自行车模型改装。

balance_bike.jpg

视频:
https://www.youtube.com/watch?v=wNYvMlPewzI
http://www.bilibili.com/video/av11733477/

加入了电机,驱动后轮前进;
加入了舵机,控制转向。

通过控制转向使自行车能自己平衡前进。

详细原理和教程请看:http://nicekwell.net/pages/diy.html

广告

老婆做毕业设计,给我下了死命令,一定要找300个程序员研究一下,请各位同行做个调查问卷,可扫描下面二维码或者直接点击此链接:https://www.wjx.cn/jq/17710478.aspx,多谢!

ad.jpg

硬件和引脚

单片机: stm32f103c8t6

引脚 功能 备注
PA9 下载TXD
PA10 下载RXD 串口1
PA2 通信TXD
PA3 通信RXD 串口2
PB0 GY521 I2C SCL
PB1 GY521 I2C SDA
PA6 电机PWM TIM3 CH1,通过三极管驱动电机,高电平时导通电机,电机正极接的是升压模块的12V。
PB6 舵机PWM TIM4 CH1,通过两个三极管连接舵机,输出端电平是5v,高低电平状态和这里同相。

20ms定时器:TIM2

程序结构

核心算法部分是main/balance.c文件,控制部分是main/control.c文件,main/main.c文件里的主循环进行信息显示。

其他各个模块提供接口给以上三个部分:

模块 文件 接口
延时 main.c delay_init();mdelay();udelay();
测试脚 main.c test_pin_init();GPIO_WriteBits(GPIOB, GPIO_Pin_12, );
串口和printf uart/uart.c, include/uart.h uart_init(),printf(),disp()
i2c i2c/i2c.c, include/i2c.h
gy521 gy521/gy521.c, include/gy521.h
motor motor/motor.c, include/motor.h motor_init(), motor_setzkb()
angle angle/angle.c, include/angle.h angle_init(), angle_setangle()

balance_bike's People

Contributors

nicekwell avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.