0

So in computer engineering I've got to make a arduino based car, I've added a whole bunch of features such as IR tracking, obstacle avoidance(proximity sensor), optical tracking(follow a black line), and remote control through an android based phone.

Since I'm a total newbie to technology I'm having trouble. I would appreciate it if You guys can point me towards resources and arduino libraries(for coding) that will work for me. Right now for coding I've only got basic pseudo-code setup since I do not know what libraries to use. I have searched up many sketches online and looked at them but didn't really understand any of the code.

Here's the basic pseudo-code I got setup on the things that I've got to work on:

DC Motor (4 of em for the wheels) (I also plan to add a stepper motor for turning right and left so if you could direct me on that as well)

//Import necessary library //Setup the motors and pins

//If signal for forward received //Code for moving forward //Set speed

//Else If signal for backward received //Code for moving backward //Set speed

//Else If signal for right received (keep turning right till stop signal received) //Code for moving right //Set speed

//Else If signal for left received (keep turning left till stop signal received) //Code for moving left //Set speed

//Else If signal for stop is received (Should we slow down to a stop or just stop?) //Code for stop //Set speed

IR (I've got transmitting and recording diodes)

//Import Library

//Declare Pin for the IR Sensor

//While loop: Move Right //If IR signal is received //move forward //Else //Jump back to top of loop

Proximity Sensor (obstacle avoidance mode) (I might either use the one from Lego kit or buy a separate one )

//Import Library

//Declare Pin for proximity sensor

//While Loop: Send out sonar(echolocation or whatever) every second //Is there any obstacle? //Yes, turn right so many degrees, and go back to while loop //No, move on forward at set speed

//If you’re surrounded and cannot exit send out a message through flashing LED's


I'm not asking for the code or for any of you to do all my stuff for me, I'm just asking for direction and resources.

Thank You

1

1) start simple - adding extra features will not help you, especially if you have a deadline

2) implement and test code for each low level function separately - however, in case you use libraries and or snippets, make sure that if a library/snippet requires exclusive use of a certain feature (ex: a timer), others do not need it.

3) test the overall logic elsewhere, where it easier to debug (ex: on a PC), by replacing the actual function calls to low level actuators/sensors with mockup functions that do I/O through either a file or a console.

Said this, what do you mean that you didn't understand the examples you found? To understand most of them, you need at least to read the API/interface of the libraries they use. And also reading the reference manual of the ATMega328P for the HW blocks referred by each library will help getting an overall feeling of what the library does.

About the basic physical model: once you have 4 DC motors (but 2 plus a caster would be enough), why do you want to add a stepper? Youc could do all of it with just 2 stepper motors , which will give you a simpler way to control precisely the orientation of the robot.

I'd suggest you to get the basic movement sorted out, before worrying about the rest. Just make sure that it doesn't make exclusive use of the microcontroller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.