UDP Camera project is finished

Discussion in 'Modding' started by fref99, Jun 6, 2004.

  1. fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    Hi All,

    I've been off work for some months now due to health problems, nothing that 3 operations couldn't fix. To keep my brain active I decided to have a go at building a new mobile webcam, and it's now finished :D

    It consists of a Atmel Mega8515 CPU, a NE2000 network card, 2 RC servo motors, a serial VFD display and some LEDS.

    Anyway the camera can now be controlled from a java app (thanks psiteddy for helping with the java code) that sends UDP packets to the atmel.

    You can see the results/project design here

    I already had a mobile camera using a AT90S2313 and a serial connection to my server, but that's abit "old hat".

    Regards
    FREF99
     
  2. CREDO

    CREDO Member

    Joined:
    Feb 2, 2004
    Messages:
    747
    Location:
    Perth, 6027
    Damn thats cool.

    :thumbup: :leet: :thumbup:

    Very impressive.
     
  3. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    Thanks CREDO,

    The code is actually really simple, it consists of about 200 lines of Bascom AVR basic code. I know alot of people hate basic but I wrote it in about 16 hours, try doing that in C or assembler.

    The actual driver for the NE2000 card is a machine code LIB available (for free!) from the mcselec (Bascom AVR developer) web site.

    Alot of people say that basic creates "bloated code" but the whole project (including the NE2000 lib) is only 3398 bytes in size (A MEGA8515 has 8Kb code space), where the NE2000 lib is about 1.5Kb in size.

    Regards
    FREF99
     
  4. alxx

    alxx Member

    Joined:
    Jun 21, 2003
    Messages:
    431
    Location:
    Northern Beaches
    Great design.

    Put a link on avrfreaks yet ?
    www.avrfreaks.com

    Hope your health improves.
    I was on crutches for nearly 12 months back in 98
    after motorbike accident.
     
  5. khendar

    khendar Member

    Joined:
    Apr 3, 2004
    Messages:
    542
    Location:
    Adelaide
    Wow...thats very cool.

    How does it handle having more than one person controlling it at a time ? I mean, say I move it one way and someone else moves it the opposite way at the same time...how's it decide ?
     
  6. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    It doesn't. The last message received is used.

    The software just sits in a loop:-
    Is there new data on the NE2000
    If yes, read and decode it
    If the message is a "text" message, print to serial port
    If the message is a "servo" message, move the required servo
    If no new message has come in the last 5minutes reset servo to mid position
    Sleep for abit
    repeat forever.

    Hi alxx, not yet, I'm thinking about it, but I have to keep an eye on my bandwidth, I've already used 1/2Gb today.

    Hopefully my health will improve after the third operation.
    I had a hernia operation in December, but I had an allergic reaction to the net that they installed, and since then I keep on getting infections/swelling. The doctors have finally got the last piece of net on Friday so things should get better now.

    Regards
    FREF99
     
  7. DoMiNaTiOn

    DoMiNaTiOn Member

    Joined:
    Sep 21, 2003
    Messages:
    1,714
    Location:
    Gold Coast
    Wow, well done there mate thats very impressive:D

    Where can I get one:p ?
     
  8. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    It's a home built. You can't buy it anywhere, but if people are interested all, try and document the whole thing properly. At the moment the doku is minimal :).

    Regards
    FREF99
     
  9. alxx

    alxx Member

    Joined:
    Jun 21, 2003
    Messages:
    431
    Location:
    Northern Beaches
    Why not make it into a kit and sell a few ?

    just the hardware bits maybe ?
     
  10. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    Hi alxx,

    I'm not really interested in making money out of it, as I said I'll document the whole thing, so that most people with abit of programming/soldering experience would be able to build one.

    The hardest problem is getting hold of ISA plugs and NE2000 network cards that are based on the RTL8019AS chip. I have several cards, but I need them for other AVR projects.

    Most of the components used in this project, can be found for "no money" at flea markets (ISA plugs from an old 486 motherboard, NE2000 from same PC, VFD from a broken cashtil (ebay), RC servos from an old tamia (sp) RC car). The only parts that I have to purchase were :-
    MEGA8515 - 5Euro
    PCB - 2 Euro
    LEDS/Resistors/Voltage regulator etc 10Euro
    2 Perspex sheets - 15 euro

    I think the whole thing costed me about 50euro, not including the 90Euro for a full version of Bascom AVR.

    For smaller projects (I also have a serial version of the webcam) the demo version of Bascom is enough. With the demo version you can only compile 2Kb of code, but thats more than enough for smaller projects.

    Regards
    FREF99
     
  11. alxx

    alxx Member

    Joined:
    Jun 21, 2003
    Messages:
    431
    Location:
    Northern Beaches
  12. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    No, the demo version can't be used for the UDP camera code, as the program is about 3500bytes in size.

    The UDP/NE2000 code is already a lib. The routines should work with all RTL8019AS based cards if they are in 8bit mode at address 300.

    If you want I can send you a copy of the code/lib for you to look at.

    I've already played with the edtp board, nice but expensive, for what it is.

    Regards
    FREF99
     
  13. alxx

    alxx Member

    Joined:
    Jun 21, 2003
    Messages:
    431
    Location:
    Northern Beaches
    Thanks. I've pm'd my email address.

    Edtp are a bit expensive but can get you up and running quickly if you need it.
    Frank Eadys book is quite good
    as is Jan Axelsons on ethernet.

    Seen a few dodgy tricks people have done to get under
    compile limits on demo / eval versions.
    Things like compiling to multiple libraries.

    disassembling pic hex files produced by a compiler
    then adding extra subroutines :)

    That is why having versions of gcc are so nice
    for archs like avr, arm etc

    Have a few avrs sitting here but haven't had the time to use them, spend more time than I probably should
    with a subject I tutor.

    Introductory digital systems
    microchip pics(asm) and xilinx cplds(schematics)
     
  14. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    Hi All,

    Alxx email on the way.

    Thanks for all your comments/praises.

    Although I am not willing to make kits for this, if anyone needs help setting up/building their own, I am more than willing to help, I'm currently working on the documentation.

    I didn't expect that so many people would like this, I've had 150 hits in the last 24 hours, and my bandwidth usage is just over 1Gb in the same time.

    Thanks again
    FREF99

    and now on to the next project :)
     
  15. Mitchee

    Mitchee Member

    Joined:
    Aug 3, 2001
    Messages:
    652
    Location:
    Northern Beaches, Sydney
    Ive just been chatting to you via the LCD for the last 5 minutes or so.

    Friggin' amazing!

    :thumbup: :thumbup:
     
  16. driver

    driver Member

    Joined:
    Jun 28, 2001
    Messages:
    3,581
    Location:
    Brisbane
    That is truely impressive work! I like how it interfaces directly to the LAN card. How long did that take you to design/build?

    Any more info on how to interface to those old network cards would be great. I might wire some more christmas lights up that way :D
     
  17. <atomic_trojan>

    <atomic_trojan> Member

    Joined:
    Jan 13, 2003
    Messages:
    374
    Location:
    Melbourne
    Sorry im an electronics n00b,
    just wondering what this kit actually does..now i have picked up that it is a webcam that can be moved/rotated with the control of a pc via the serial port? is that correct? sorry this all sounds pretty cool but very complex too :p
     
  18. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    Hi driver,
    I designed the hardware in about 4 hours. A friend once said to be that it wouldn't be possible to get a network connection working with a CPU with only 8Kb code space, and as I have alot of spare time at the moment I decided to have a go.

    On my web page I have a simple circuit diagram for the card. All you need to do is wire up the 8 data lines,address line 0-4 and Reset,IOW and IOR (16 pins in total) to the ISA bus. Plus force some of the address lines High or Low to give base address 300.

    The actual NE2000/UDP driver is available from the mcselec web page. It should work on all atmel 90Sxxxx and Mega CPU's with atleast 4Kb code space and 16 digital I/O's.

    It took be about 8hours to write the first version of the software, including debugging the software only to find out that the problem was a dry joint on the circuit board.

    The code is written in Bascom AVR basic, which even though it's a basic dialect it produces very fast/small code. I once wrote a project in bascom and ran out of code space and then rewrote the code in assembler and only managed to reduce the code size by about 15%, but it took me 5 times longer. In the end I just bought a larger CPU, it worked out cheaper.

    Hi atomic_trojan
    No the new servo controller is actually directly connected to a network through a NE2000 network card. I have a version of the webcam that uses a very small CPU (2Kb code space) that uses a serial connection to a PC.
    This is not a kit, I designed and built it myself.:D

    Regards
    FREF99
     
  19. OP
    OP
    fref99

    fref99 Member

    Joined:
    Aug 11, 2002
    Messages:
    839
    Location:
    Switzerland
    Hi All,

    After a long break (I'm now back at work), I've finally got the last few bugs out of the code. Here are the improvements:-

    1) The scroll routine now works correctly.
    2) The buffer overflow problem is solved.
    3) The java code is abit tighter, it should produce less security exceptions

    I'm planning to modify the hardware/lib to use interrupts, so that the CPU can sleep between packets(At the moment the code polls the NE2000).


    Link in sig.

    Regards
    FREF
     
  20. Hebby

    Hebby Member

    Joined:
    Feb 4, 2003
    Messages:
    698
    Location:
    Rockhampton, Central Queensland
    very nice, ive looked at it before, but since its been brought up again, thought id ask a question, how do you control the servos? does the avr have its own servo routines or are you making up the timing with code?
     

Share This Page