Editing Arduino Laser Cannon
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= Arduino Laser Cannon = | = Arduino Laser Cannon = | ||
− | + | early draft, some text is mixed from another project, should be better updated in a few days | |
− | + | Before you get too excited: the armament is just a laser pointer, so nothing blows up. The arduino controls the aim of the laser. Using a terminal program you can aim the laser in a number of directions. Once aimed you can commit the position to memory and recall it later. | |
− | |||
+ | Name: Arduino Laser Cannon | ||
+ | Status: in fairly early development, but is working. | ||
+ | Technology: Arduino | ||
+ | Author: [[russ_hensel]] ( where you can find an email address to reach me ) | ||
+ | Summary: An Arduino controls two servo motors to aim a laser pointer. A terminal program is used to control the Arduino. | ||
− | + | Archive for the project will be posted. See download section below. | |
− | |||
− | |||
− | |||
− | |||
− | |||
This project can be used as is or may give you ideas for other similar projects: | This project can be used as is or may give you ideas for other similar projects: | ||
+ | Example code for stepper motor control and for RS232 communications ( interrupt driven on the receive end ) on the PIC16F877A. | ||
+ | Determining which drive wire is which on a unipolar stepper motor. This is the type of motor that I have most commonly found surplus or in salvage equipment | ||
+ | Determining angle per step or steps per revolution of a stepper motor. | ||
+ | Determining maximum speed of stepper motor. | ||
+ | Demonstrating the operation of a stepper motor. | ||
− | + | Platform: Arduino ( I used the bare bones board, but any should do ). Added an external 5 v regulator to power the servos and the laser pointer ( which I got from … ). Software done using arduino.ext. | |
− | |||
− | |||
− | Platform: Arduino ( I used the bare bones board, but any should do ). Added an external 5 v regulator to power the servos and the laser pointer ( which I got from … ). Software done using arduino. | ||
A laser pointer is connected to 2 Servos and the servos are connected to each other so one controls the azimuth while the other controls the altitude ( like most standard cannons ). ( controlled by the RS232 connection ): | A laser pointer is connected to 2 Servos and the servos are connected to each other so one controls the azimuth while the other controls the altitude ( like most standard cannons ). ( controlled by the RS232 connection ): | ||
− | |||
*Set azimuth | *Set azimuth | ||
*Set altitude | *Set altitude | ||
Line 32: | Line 32: | ||
Example: | Example: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Hardware | |
− | |||
− | |||
+ | |||
== Command Interface == | == Command Interface == | ||
− | All commands ( except stop should be terminated with a carriage return ) | + | All commands ( except stop should be terminated with a carriage return ) Note that the command interface is not very smart, giving parameters that are out of range my blow the whole program up. If so reboot the microcontroller . Do not send a new command ( except stop ) until earlier commands have been completed ( actually you can get ahead some if you are careful ). Commands may be either upper or lower case. The backspace key usually works. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 139: | Line 46: | ||
Most terminal programs can be set to treat a carriage return as a carriage return line feed. Do it. | Most terminal programs can be set to treat a carriage return as a carriage return line feed. Do it. | ||
− | + | Some terminal programs will not transmit in lower case ( all our commands are lower case ) unless specially set to do so. Set it to allow lower case. | |
== Program Design == | == Program Design == | ||
− | + | I no longer have the patience for assembly language. | |
− | |||
− | |||
− | |||
− | |||
− | + | Commands are received via an serial communications routine, the main loop checks each time around to see if a complete command has been received. Because commands are only interpreted in the main loop all commands are ignored until the program returns to the main loop. The exception to this is the stop command which will terminate a g or x command and return to the main loop quickly. RS232 transmission is not driven by an interrupt and so during transmission from the microcontroller no stepping takes place. Commands which do not result in motion execute very quickly, most of the time is for communications. | |
− | |||
− | |||
− | |||
== Other Things to Try == | == Other Things to Try == | ||
Line 159: | Line 59: | ||
*You can use the pointing feature of the system to implement an instrument with a very large scale: Put a temperature scale on one side of the room, the "cannon" on the other and have it point to the temperature. | *You can use the pointing feature of the system to implement an instrument with a very large scale: Put a temperature scale on one side of the room, the "cannon" on the other and have it point to the temperature. | ||
− | |||
*I have been thinking about a clock, each hour would be a piece of crystal and the laser would hit it on the hour. Minutes might use another laser or other sort of display. | *I have been thinking about a clock, each hour would be a piece of crystal and the laser would hit it on the hour. Minutes might use another laser or other sort of display. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | * | + | *Surely you can think of something. |
− | |||
− | + | == Additions/Changes == | |
− | + | These are changes I may or may not make: ( or you may take them on ) | |
+ | |||
+ | == Possibly useful links == | ||
− | + | This program uses my: [[Arduino Command Interpreter]] | |
− | + | [[RS232]] Discusses the sort of interface that is used by this project. | |
− | + | More information on serial communications with microcontrollers: [[Microcontroller Serial Communications Articles]] | |
− | http://www. | + | A free terminal program, I like this much better than hyperterminal: Welcome to our Free Download/New Products Page! http://www.rs485.com/psoftware.html |
== Download == | == Download == | ||
− | [ | + | email me to see if there have been some unposted revisions – which right now is all there is. [[russ_hensel]] |