I have a posted a couple of threads around this forum and the help I have received has helped me to successfully build my Robot.
Here is the not yet finished Instructable:
It is a Raspberry Pi / Arduino Hybrid, the Arduino (Nano AT-Mega328P) drives the Motors, Ultrasonic Sensor and a Servo that the Sensor is mounted on. The Nano is connected to a Raspberry Pi as a Slave receiving commands via an i2c Serial Interface. The Raspberry Pi acts as the i2c Master and serves a Web Page using WebIOPi on which is a control panel to control the Robot wirelessly over WiFi. The Robot also has a USB Web Camera mounted on it which streams video using MJPG-Streamer at about 20fps to the control panel web page.
I have recently changed the Sketch code so that the Robot also has a timer function that puts it into Autonomous mode if does not receive any commands after a given time period and it detects movement (not confirmed that this is working yet).
Problems / Required Upgrades
What I need help with now is:
Forward and backwards works fine (could be a little more incremental) but I need to fine tune turning left and right, currently when clicking left or right the Robot spins almost 180 degrees, how do I adjust this (In Arduino Sketch).
For debugging how do I get the Serial messages in Sketch to appear on my Web Page, later they may be pushed to an onboard LCD panel.
My AutonomousMode and Auto_Navigate modules in Sketch have been created without any external assistance and may be wrong? Such as sending serial data back to the Pi when movement is detected, the code on the python end to play an audio message has not yet been added.
I appreciate most of this is Arduino Sketch questions but I thought I'd throw it out there.
Thanks
I have created a repository on GitHub to hold the code as it is now to big to post here.
Here is the link:
This is my first time using GitHub so let me know if I have set it up wrong?
if does not receive any commands after a given time period
You mean "within a given time frame"?
Forward and backwards works fine (could be a little more incremental)
What does "a little more incremental" mean?
but I need to fine tune turning left and right, currently when clicking left or right the Robot spins almost 180 degrees, how do I adjust this (In Arduino Sketch).
What does "clicking left or right" mean?
For debugging how do I get the Serial messages in Sketch to appear on my Web Page
Whatever application is reading the serial data needs to make that happen (whatever it means). The Serial Monitor application can't.
After 10 seconds if the Arduino does not receive any data from the Raspberry Pi telling it to move it calls a function Autonomous_Mode() which then waits for any movement and reacts, at the moment this is not working, when it is I hope to send a signal from the Nano to the Pi to play audio and the Nano will probably move.
PaulS:
What does "a little more incremental" mean?
When the Nano receives an integer 1 - 4 which is sent by the Pi when the user click Forward, Left, Right or Backwards on the web interface control panel served by the Pi, it runs the corresponding module. The problem is that even if you do an short click of the movement button it runs the module for about a second which when turning left or right causes the robot to spin almost 180 degrees. I need this to be more controllable?
PaulS:
What does "clicking left or right" mean?
The Raspberry Pi serves a Web Page which has a control panel on it along with a video stream from the web camera mounted on the robot. The control panel has buttons marked left, right, forward and backwards.
PaulS:
Whatever application is reading the serial data needs to make that happen (whatever it means). The Serial Monitor application can't.
So I guess I need to send the serial data back to the Pi and set up a window on the web page to show this data?
Thanks cyclegadget, that's a tutorial that I followed when I first used this robot chassis as an autonomous obstacle avoiding robot.
For some reason though, whilst the demos worked when the robot was first set up with only an Arduino, since then PWM has been problematic, one of the motors is either on or off (no speed control) regardless of adjusting the PWM?
For driving over carpets I need full speed but for shorter duration when turning?
JonnyAlpha:
When the Nano receives an integer 1 - 4 which is sent by the Pi when the user click Forward, Left, Right or Backwards on the web interface control panel served by the Pi, it runs the corresponding module. The problem is that even if you do an short click of the movement button it runs the module for about a second which when turning left or right causes the robot to spin almost 180 degrees.
Why not have a slider on your web page and send something like R,23 or R,172 to indicate different amounts to turn right ? Or (perhaps better) send 0,23,0,0 to indicate no Left movement, 23 Right, and no Forward or Reverse
Another option might be to detect buttonPressed and buttonReleased (mouseDown and mouseUp) events and send start and stop codes to the Arduino. That way it will keep turning while the button is pressed.