Results 1 to 15 of 78

Thread: Automatic Target Project

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2005
    Location
    Grantham
    Posts
    1,384
    Just a quick bump for this thread.

    I have just bought some parts to start looking at this project again.

    2 DFrobot Mega boards
    2 DFrobot Mega I/O shields ver1.1 with Xbee sockets
    2 Xbee Radio units
    1 Serial LCD Display 16x2

    My progress so far with the code, is I can now send information from the master to the slave unit. I can send information to the LCD. I can drive the servos to fixed positions on the slave unit.

    I now need...

    1.) A proper menu system
    2.) Up / Down menu and a start push buttons
    3.) Several mode selections in the slave unit for the different sequences
    4.) Timing software in the slave unit

    In use the idea will be to select the mode on the LCD.

    Rapid Fire 8 Sec
    Rapid Fire 6 Sec
    Rapid Fire 4 Sec
    All targets To Front

    Then pressing start sends the mode and go signal to the slave which will the run the servos.

    Thanks

    Mark
    Last edited by Cones; 21-01-2011 at 12:46 PM.

  2. #2
    Join Date
    Apr 2010
    Location
    blackburn
    Posts
    69
    Hi,

    Glad its going well.
    I havent done a lot to mine recently, mainly due to the weather but I havent forgotten about it and am collecting odds and sodds that might come in handy for it. I plan to redo a lot of the mechanical part and I may change the movement system to use a stepper motor rather than counting holes - I had nothing around at the time and made use of what I had. I will also redo the up/down mechanism as its sort of cobbled together and me still use a method like your one. Im going to have mine run from a phone or PDA rather than a laptop as its less hassle to move about, I've just this week as it happens connected my Combro to my PDA and written a program to display the FPS etc, Ive also connected one of my wireless devices to the combro, just waiting on a bluetooth adaptor and a cable to arrive then I can have a go with it on with my phone too, my phone needs a hacked cable to access the serial port directly and I only have the one which I need so I'll have to wait. Couple of pics of my PDA at the end, software not 100% finished, just needs tidying up a bit but it does the job.

    On to your one

    First off, I would have gone for a larger LCD, simply because it would mean less scrolling up and down for the menus, which would in turn make using it easier and also make the coding a bit easier. But not to worry, I used a 2 line on my camera controller at first and it was fine once you got used to going through the menus.

    Do you have a breadboard or some stripboard? I would get both as it makes it easier to keep things a bit organised whilst plugging things in and out, making changes etc.

    I always find it tricky doing anything with "2 parts" as its difficult to try and get just one right initially without the other, then just when you get one part right it always turns out that it needs changing to make it work with the other, then vice versa and round in a circle we go lol.

    I would try and start with one or the other, probably the target part as this can be tested easily and once you can get the arduino to control the targets in a set routine then its just a matter of sending a command to the slave telling it what to do. For eg, if you had say 2 led's on the slave, and 2 parts of your program called "void led1" and "void led2" both worked fine and what they did was flash the led 5 times. You would then have in your void loop a piece of code that basically waited for a signal down the xbee (I would initially test plugged into the usb and send down the arduino serial monitor). So you would have something like: (not in proper code but you will hopefully get the idea)

    void loop()
    whilst no data in


    do nothing


    If data in = "LED1" then


    led1 ' call your LED1 part of the program as mentioned above


    If data in="LED2" then


    led1 ' call your LED2 part




    Thats the basic way I would go about it, all you need to do then is send "LED1" or "LED2" down the serail/xbee or whatever and it should do its thing.

    I would go a step further though, rather than just rely on one way communication I would have then "talk" to each other, for eg.

    from master (pc initially), send "ABCDE"
    slave waits for "ABCDE" to be recieved and does nothing till it is, perhaps have an LED come one once it has been recieved.
    Once ABCDE has been recieved by the slave, it then sends back "OK, THANKS", the master (pc for now) doesnt send anything else until it has recieved the reply. (again an LED to indicate)
    I would then go a little further and have them do the above every few secs to confirm that the connection is there and have your program take action accordingly.

    If you dont have some sort of 2 way communication you wont know if the connection is lost, and also in theory but not likely, if someone else nearby is playing with an xbee it could confuse things as you can imagine.

    Thats basically how I would do the slave part, I keep saying this but do it plugged into the pc initially so that you can see whats going on.

    Ok, slave bit sone and can respont to commands it recieves from the pc its on with the master unit.

    First thing, send and recieve as above to make sure it works !!!, it will of course. Once it is confirmed they can talk to each other I would first off program the part that I mentioned where a signal is sent back and forth every few secs to confirm connection, its easy to do, use "serial.available" since the wireles modules are basically a serial port without wires.

    Then the menu, I hate these - because my C skills are not too good I struggle a bit but the basic idea is:

    eg if we have 5 menu options, but only 2 lines of LCD we obviously need to scroll up and down.

    have an array or a list of sorts with each menu item in it

    1.MENU ITEM 1
    2.MENU ITEM 2
    3.MENU ITEM 3
    4.MENU ITEM 4
    5.MENU ITEM 5

    and a counter, say 'x'

    so x = 1, menu item 1 and menu item 2 need to be displayed
    x = 2, then 2 and 3 need to be displayed and so on.

    have a routine in your program (eg, "void display (x)" to display the menu according to the value of x, and call this void when the display needs updating, do this rather than manually change the display here there and everywhere in your program whenever a button is pressed.

    a button to scroll up (B1), and one to scroll down (B2) (one to "accept" would be handy too lol)

    so in our program we start with x = 1, and call "display(x)" this will pass the value of x to the display part of the program (obviously) and it can then be processed, not sure how your lcd works but the sample below in half C half english should explain !

    void display(x)

    LCD.writeto line 1, menuitem (x) - x would be 1
    LCD.writeto line 2, menuitem (x+1) x + 1 would be 2


    so if x =1 as above, menuitem1 is displayed on the 1st line, and menuitem2 on the second line (x+1 =2)

    programming the buttons is easy, if button A is pressed, increase x by 1, if B is pressed, decrease x, obviously check that it doesnt go below 1 or above the amount of items in your menu.

    So, we press button A to increase x, so x is now 2. We then call our display routine again as above

    void display(x)

    LCD.writeto line 1, menuitem (x) - this time x is 2 so menuitem2 is on line 1
    LCD.writeto line 2, menuitem (x+1) - and x +1 is 3 so menuitem3 is on line 2


    so, it has now "scrolled". as there are 2 lines and only 1 line the "current" one, I would put an indicator at the beginning of the selected line such as a ">" and only scroll up when that is at the bottom, and likewise only scroll down when it is on the top line.

    I hope that all makes sense !! Its a bit difficult to explain in writing but it should hopefully give you something to go on. Any probs just yell and I'll try and help.

    Calv

    http://www.calvsplace.co.uk/gun_stuff/dell_1_xs.jpg

    http://www.calvsplace.co.uk/gun_stuff/dell_2_xs.jpg
    Last edited by eggplant; 23-01-2011 at 03:55 PM.

  3. #3
    Join Date
    Apr 2005
    Location
    Grantham
    Posts
    1,384
    Hi Calv,

    Thanks for all the tips. Bit late though.

    I've not updated my post since the other day as I have been busy with the code.

    I now have a fully working system.

    The master unit has all the menus and modes. I did use an array as you suggested above. I had to use debounce and edge detection for the button presses.

    The slave receives the program number from the master then takes care of itself.
    So there is only a couple of bytes of data to send. I can have feedback but don't really need it.

    I'll do some pictures and maybe a video later and post up the code for you to look at.

    The next stage is to do a couple of boxes and get the servos mounted on a frame. Then cobble together some wire frame target holders.

    Many Thanks

    Mark

  4. #4
    Join Date
    Apr 2005
    Location
    Grantham
    Posts
    1,384
    A few pictures of the bits so far.

    http://s699.photobucket.com/albums/v...get%20Project/

    Along with a video of the operation.

    http://www.youtube.com/watch?v=2kGE5euLceg

    Thanks

    Mark

  5. #5
    Join Date
    Apr 2010
    Location
    blackburn
    Posts
    69
    Glad you are making progress, I was going to ask if you had managed to sort anything out prior to me trying to explain a way to do it but I knew I wouldnt get back on here till later so I figured I should post it anyway. Forgot about deboincing switches.

    Looking good so far, I'll be interested to see how you do the targets.
    The Xbees, do they not have an antenna ? what is the range on them ? They look much smaller than the wireless thingys I have.

    Calv

  6. #6
    Join Date
    Apr 2005
    Location
    Grantham
    Posts
    1,384
    Hi,

    Yes the Xbee units come in several models. These are 2mw in power and are good for 100m line of sight. The others go up to 50mw and work over 1 mile (1600m). But the bigger ones use 295mA of juice.

    These are the type I used. They only consume 50mA of power so better for battery powered equipment. http://www.coolcomponents.co.uk/cata...roducts_id=242

    All versions are pin compatible. So you can upgrade to more power as required.

    You can do one master to several slave units as well if you know what you are doing with the comms. That is a bit beyond what I need at the moment though.

    I could see the above used with falling plate type hit detection reactive targets and feedback of the score to the master controller. I suspect that could make for an interesting additional project.

    Thanks

    Mark

  7. #7
    Join Date
    Apr 2005
    Location
    Grantham
    Posts
    1,384
    Another small update.

    I've now ordered the Hi-Tec HS-325HB Servos to drive the rotation of each target.

    Specifications as below. I think with a 6V power supply they should be fast enough to be well within the 0.3 seconds to turn requirements of the ISSF rules. Although this target is for 10m and not 25m.

    Control System: +Pulse Width Control 1500usec Neutral
    Required Pulse: 3-5 Volt Peak to Peak Square Wave
    Operating Voltage: 4.8-6.0 Volts
    Operating Temperature Range: -20 to +60 Degree C
    Operating Speed (4.8V): 0.19sec/60° at no load
    Operating Speed (6.0V): 0.15sec/60° at no load
    Stall Torque (4.8V): 42 oz/in (3.0 kg/cm)
    Stall Torque (6.0V): 51 oz/in (3.7 kg/cm)
    Current Drain (4.8V): 7.4mA/idle and 160mA no load operating
    Current Drain (6.0V): 7.7mA/idle and 180mA no load operating
    Dead Band Width: 5usec
    Operating Angle: 40 Deg. one side pulse traveling 400usec
    Direction: Clockwise/Pulse Traveling 1500 to 1900usec
    Motor Type: Cored Metal Brush
    Potentiometer Drive: 4 Slider/Direct Drive
    Bearing Type: Top Ball Bearing
    Gear Type: Heavy Duty Karbonite
    360 Modifiable: Yes
    Connector Wire Length: 11.81" (300mm)
    Dimensions: See Schematics
    Weight: 1.52oz (43g)


    The target holder was tricky. But in the end I decided that I may as well just use a proven design. So I have ordered 5 of the Rika holders that are used on their World Champion target changers.

    http://www.schiesssport-buinger.de/Z...ben--1170.html

    It should be reasonably easy to just bolt these onto the servo arms with some 2 or 3mm nuts and bolts.

    Thanks

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •