emekbot - a PID controlled robot

Posted on 09/08/2012 by cambazz
Modified on: 13/09/2018
Project
Press to mark as completed
Introduction
This is an automatic import from our previous community platform. Some things can look imperfect.

If you are the original author, please access your User Control Panel and update it.

I have updated the code, and made a project page for it on github. PID now works nicely. This is my experiment. It has a LSM303 compass, an arduino nano. Compass is mounted at a tower. There is also a bluetooth module that will send data. I am using the arduino PID library to turn towards a heading. The results are much nicer then using if else type clauses to find the heading. There are however some jittering. I will be posting the source code also. The loop is designed such that it can accept ...


emekbot - a PID controlled robot

I have updated the code, and made a project page for it on github. PID now works nicely.

This is my experiment. It has a LSM303 compass, an arduino nano. Compass is mounted at a tower. There is also a bluetooth module that will send data. I am using the arduino PID library to turn towards a heading. The results are much nicer then using if else type clauses to find the heading. There are however some jittering. I will be posting the source code also. The loop is designed such that it can accept commands and do other things, while the bot is moving. I am a professional coder and this is my little experiment as to what can be done with a primitive platform such as arduino.

Here are code highlights:

1. non-obstrusive loop. for example, when the robot is executing a command, it can perform other tasks. this was hard to accomplish. in my first version, i could not send an emergency stop signal, while the robot was executing some task. but now, with each loop it will do whatever adj is necessary, and then go on to next task. for example if you send 's' over bluetooth, it can stop.

2.will accept commands over bluetooth serial. here are commands:

'c' will return current heading

'h180' will make it turn to 180

's' emergency stop

3. there is a PID control loop. what i have done is to set the target variable always to zero. process variable is angular difference between targetHeading, and currentHeading. the output is used to control motors. I can not say it is perfect yet, but it works. The heading algorithm now works perfectly. 

No delay statement is used while looping, and it samples the compass and adjusts motors at 200Hz.

Here is the project page on github

https://github.com/altineller/emekbot

turn towards given heading, accept some commands

  • Actuators / output devices: 1:120 ratio Tamiya gear
  • Control method: Bluetooth
  • CPU: Arduino
  • Power source: 7.2V helicopter battern
  • Programming language: C++
  • Sensors / input devices: LSM303
LikedLike this to see more

Spread the word

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post