Shop OBEX P1 Docs P2 Docs Learn Events
2D digitiser help needed — Parallax Forums

2D digitiser help needed

As the title suggests I need help to build the code for a 2D digitiser, this will consist of two quadrature encoders, one on X axis and one on Y, with some kind of pen or stylus. The stylus is moved by hand to a point to be recorded, a button is pressed and the coordinates stored in memory, it is then moved to another point, store those coordinates and so on. Eventually the data needs to be uploaded to a PC somehow and ideally converted to a DXF file or at least something that can be used by a CAD program.
I want to use the prop since it will store and manipulate 32 bit numbers and this will easily be enough for full sheet measurements to a couple of decimal places.

I am no programmer and while I would be more than happy for somebody to completely write the program and post it here I think that may possibly be asking a bit much.
What I would appreciate is a process overview so I can break the program into chunks and get to work.
My plan so far is as follows:

1. Use the Quadrature encoder object already written, this will handle encoder reading and position updating, will also support 16 encoders so I could make this a 3D digitiser (2.5D from a CNC machining perspective) without a great deal of effort in the future.

2. Incorporate a push button to store the position, simple enough, shouldn't lose too much hair on that one.

3. I guess a serial LCD displaying the coordinates would be a good idea.

4. Store the data somewhere, this I am unsure about, I was thinking of no more than 255 positions would be required for x and y combined, so 127 coordinates (I was originally going to use an 8 bit avr)
I am not sure of the best way to do this, would appreciate suggestions, keeping in mind the plan is to upload these (probably serially) to a PC.

5. Format the data so it can be used, I am thinking of using CSV to keep things simple, can be imported into a spreadsheet easily, hopefully from there a CAD program. This may have to be done on the PC, or find some open source software to to the job.

That's about it, any tips/suggestions would be appreciated.

Cheers.

Russell.

Comments

  • It is unclear as to weather you are building the digitizer or using one already constructed. Also how big will the drawing area be that is going to be used.

    I would think you are going to use some kind of rail system that the encoders will be attached to and they will be read as to where they are currently being positioned. Like a two dimensional caliper.

    Mike
  • epineh wrote: »
    will also support 16 encoders

    If you intend to support 16 quadrature encoders, you'll likely need some additional chips. The Propeller 1 has 32 I/O pins are four of these are used to program the device. It's certainly possible to use all 32-I/O pins after boot up but it's more common to leave the four pins used for programming as UART and I2C interfaces.

    Do you really want to use 16 quadrature encoders or is that a typo?

    Make sure you thoroughly test the any encoder object you use. There's at least one quadrature encoder driver which can get confused by backwards motion.

    Saving coordinate values to a csv file SD card shouldn't be a problem. You can save many thousands (maybe millions) or coordinates to a SD card.
  • Duane Degn wrote: »
    Saving coordinate values to a csv file SD card shouldn't be a problem. You can save many thousands (maybe millions) or coordinates to a SD card.

    A 16 GB SD card (smallest reasonably bought size these days) will store over 800 million values, assuming 18 bytes per coordinate (2*8 chars + comma + newline). However, you will run into the FAT32 4GiB file size limit at around 238 million.
  • The digitiser is being built, this is a project of a friend, I volunteered to help with the electronics side.
    It will consist of linear rails and encoders/belts. That's the easy part. Size is about 2.5m by 1.5m

    It will be a 2d setup for the most part so only 2 encoders required, maybe a third if he wants to use a height (Z) in the future. I only mentioned the 16 encoders to say the encoder object has it covered, sorry for the confusion.

    I guess I could use an SD card, it is serious overkill, I was thinking more of just using a second eeprom for the coordinates, 1K would be plenty.

    Thanks for the comments.

    Russell.
  • kwinnkwinn Posts: 8,697
    First off, I would suggest using a laser pointer in place of a pen or stylus. More flexible and easier to use. I am assuming you only need 4 pins for the 2 quadrature encoders and one for the push button, so there are lots left.

    Next, I would suggest using the four port serial object so you have the option of having the PC and the LCD connected at the same time. It costs no more in resources than the single object does so I use it all the time.

    Format the data on the Propeller. Converting 32 bit integers to a 10 digit numeric string is built in to the serial object. All that is left now is adding the decimal points and the commas before storing them.

    Store them on an SD card on the Propeller board and send them to the LCD and the PC. That way you do not have to have the PC connected to take measurements, but can do so if you need the redundancy. Lots of free open source programs for the PC to receive ascii characters and store them as text files.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2020-10-30 15:57
    epineh wrote: »
    It will consist of linear rails and encoders/belts.

    Are you aware of the linear encoders used with Digital ReadOuts on milling machines?
    EncoderLinear.PNG
    They have a piece of glass with lots of fine lines. As the sensor slides over the glass, it outputs quadrature encoder pulses.
    I was really curious about these things myself so I purchased one of the encoders without the display. I was able to get quadrature output pretty easily. It might be easier to use one of these gizmos rather than setting up a belt with a rotary encoder.
    epineh wrote: »
    I only mentioned the 16 encoders to say the encoder object has it covered
    Do you know how often you'll have encoder transitions? There's a tradeoff between the number of encoders one cog can monitor and how many pulses per second the Propeller can monitor. It's unlikely you'll have more encoder transitions than one cog can handle but you'll want to make sure you have an appropriate encoder driver for the number of encoders you'll be using. I also doubt this will be a problem.

    Depending on what sort of interface you plan to use, you might want to add one more encoder as an user input device.

    About the same time I purchased the linear encoder I linked above, I also purchased one of these pendants.
    EncoderPendant.PNG
    It's possible to purchase just the cool encoder wheel if you don't want the full pendant. I thought the large encoder wheel looked so cool that I had to incorporate it into one of my projects.
    EncoderWheel.PNG
    I posted some of my quadrature encoder objects in this thread. At least one of the objects let you define a constant to any arbitrary number of encoders. As mentioned earlier, the more encoders used, the greater the minimum transition period it can read. There are plenty of good encoder objects available so you likely won't have trouble finding something to suit your needs.

    In case you're not aware, a PCB with a SD card reader are available for just a few dollars. I personally think adding a SD card is just about as easy as adding a second EEPROM. Using a SD card will make it easy to transfer the generated files to a PC.

    In case it's not obvious, I'm a big fan of quadrature encoders.
    471 x 871 - 331K
    698 x 668 - 355K
    1587 x 803 - 691K
  • Like the encoder wheel. Reminded me of a prank I pulled a while back. We have a lead lined room for working on portable x-ray stuff. Really big pots used to have knobs like this. I pulled one we had laying around and glued it to the outside of the door above the handle. You can imaging the rest....... And yes, I am still there 16 years later.

    There is also a linear scale that Sony makes also. Have not seen the optical, but one of the CT tables I maintain uses the Sony Magnascale. Also checking on this, there a number of sellers fleabay and others selling entire kits for various machine tools. The magnascale scale strip can be damaged by magnetic fields to close to it. (magnetized tools)

  • kwinn wrote: »
    First off, I would suggest using a laser pointer in place of a pen or stylus. More flexible and easier to use. I am assuming you only need 4 pins for the 2 quadrature encoders and one for the push button, so there are lots left.

    Next, I would suggest using the four port serial object so you have the option of having the PC and the LCD connected at the same time. It costs no more in resources than the single object does so I use it all the time.

    Format the data on the Propeller. Converting 32 bit integers to a 10 digit numeric string is built in to the serial object. All that is left now is adding the decimal points and the commas before storing them.

    Store them on an SD card on the Propeller board and send them to the LCD and the PC. That way you do not have to have the PC connected to take measurements, but can do so if you need the redundancy. Lots of free open source programs for the PC to receive ascii characters and store them as text files.

    Good ideas, it may get a laser pointer, I'm actually not sure what the plan is for that.
    I like the idea of multiple serial, will check that out.
    I have very little experience with PC connections other than tuning my CNC servo drives, so I hope to copy/paste my way through that one.
    Ordered a couple of SD boards, very cheap, will use them for storage.

    Cheers.
    Russell.
  • Duane Degn wrote: »

    In case it's not obvious, I'm a big fan of quadrature encoders.
    Haha I am getting that impression.
    I have seen those DRO kits, must say they are getting fancier every year. This machine will be at least 2.5 metres long so it needs a custom setup.
    I will use the CUI capacitive encoders(they still output quadrature pulses), the great thing about those is the ability to change the CPR using DIP switches, from 48 to 2048 from memory.
    This machine only needs about one decimal place accuracy so the encoders can be set quite low, probably 200 CPR or maybe lower, this will reduce the overheads of the micro.
    I actually have one of those MPG wheels from a pendant, yes they are very nice and I hope to use it for testing my code.
    The machine lives about 2000km from me, I may not get to see it in real life so I will post the setup to its owner after I'm happy with it.

    Cheers.
    Russell.

  • We have a lead lined room for working on portable x-ray stuff. Really big pots used to have knobs like this. I pulled one we had laying around and glued it to the outside of the door above the handle. You can imaging the rest....... And yes, I am still there 16 years later.

    Nice one, we recently did an electrical fittout of such a place, you've given me some ideas if we go back for extra work !

    Cheers.
    Russell.

  • kwinnkwinn Posts: 8,697
    epineh wrote: »

    Good ideas, it may get a laser pointer, I'm actually not sure what the plan is for that.
    I like the idea of multiple serial, will check that out.
    I have very little experience with PC connections other than tuning my CNC servo drives, so I hope to copy/paste my way through that one.
    Ordered a couple of SD boards, very cheap, will use them for storage.

    Cheers.
    Russell.

    Connecting to the PC should not be a problem. If your propeller board has an on board USB to serial chip all you need is a cable the same as you have to program it. If it has no USB on board you will need a Prop plug to program it and a prop plug or USB to serial cable to communicate with the PC.
    As for the PC software there are many terminal programs for Windows and Linux that you could use to receive and store the data from the Prop. I have used several ones for Windows and Linux over the years. The other option is sneaker net, where you take the sd card from the Prop, walk to the PC, plug it in, and transfer the data.
  • Per Kwinn's suggestion, you could output right to PST and then copy-and-pasted into a text file on your PC. I've done this a couple times.
Sign In or Register to comment.