Author
Topic: ARDUINO PROGRAMMING (Read 1206 times)

Hello,I'm from Belgium,and new here and also new in programming.I have a arduino to programI want to make a robot with it2 motor (left right)2 bumpersensorsbuttons: START STOPWhen the robot hit something he has to stop for 2 seconds and than changing from direction turned under a angle.Does anyone has experience with it, or can give me a good start to complete my gool?Manny thanks.

Sorry if I make mistakes in my English writing, it's not my local language.

Well, I would first look a the arduino.cc webpage they have all kinds of helpful tutorials.

But what I would do is use two n-channel mosfets (if you don't know what they are look on youtube there are plenty of tutorials) to turn on and off the motors, you would need two 100k resistors to keep the mosfet in the "off" state. Then when a "bumpsensors" is turned to HIGH digitalWrite where one wheel rotates and the other doesn't this will give you a turn. Just set delay times so that the robot car will turn 90 degrees and be off on its merry way again =)

Use Arduino IDE and their C Libraries, which are very handy, however somewhat restricted to Arduino devices only.

Use Atmel Studio 6 IDE and their C Libraries. This way gives You more flexibility later on if You don't want to use Arduino as this approach works for all Atmel microcontrollers

Personally, I never had MCU (augmented board like Arduino). What I did was bought ATmega48 microcontroller for £3 and used Atmel Studio to program it. I didn't get all ready made sockets/connections/pins (as You do with Arduino/Axon/other MCUs), but to start learning all I needed was prototyping board, few resistors, LEDs and caps to get everything connected to my microcontroller. This way, I learnt not only how to program microcontrollers, but also how to setup all hardware.

To drive motors You need to have motor controller or H-bridge that exceed power requirements of motors. DON'T TRY CONNECTING MOTORS DIRECTLY TO MICROCONTROLLER - IT WILL RUIN IT!!! If You post motors specs, we might be able to guide You towards proper driver for them. There are many choices for motor drivers starting with ready built drivers, with all bells and whistles, like Sabertooth, going to IC H-bridges like L298, ending with custom/DIY built transistor H-bridges.

Regarding programming related to driving motors - You need to learn how timers and PWM work. Link to timer/PWM tutorial is provided in the post I link You to above.

Well if you need to learn the basics for Arduino you can watch for tutorial on youtube. You can find almost everything there. I have learnd arduino and C programming just with Google and Youtube's tutorial and I have recently build a robot that does something like the one you are building.Here is a link to a series of tutorial that teaches you the basics of Arduino that i would recommand.

Before starting building a robot I would suggest getting to know your platform, I started by playng with the arduino starter kit (that you can buy on the arduino store or any electronic webstore) that had almost everything inside to learn how it all works, then i realized i had a more clear idea of how I could do it and it just tooke few tiem for building the robot.