Speedier DrawBot Drawings

When using my DrawBot to draw pixelated drawings (versus TSP or vectors)1 I don’t really notice a pause from the machine between each pixel.  It takes a few seconds to shade each pixel, then it moves to the next spot and starts over again.  However, when trying to draw TSP art I discovered that the time spent shading a picture obscured the amount of lag time that occurred between each drawing point!  As I tried to draw a TSP portrait of my family I found it was taking about 3 seconds between each little point – which translated to a VERY VERY long time for a VERY small drawing.

When I asked Sandy about this, he suggested that this lag would be eliminated by drawing from an SD card.

Sandy’s current setup, which allows for computer free printing, consists of an Arduino Mega 2560 R32 , a MicroSD card breakout board3 , and an Adafruit Motor Shield4 .  Thus, the electronics setup would cost about $100 if you were starting from scratch, or another $80 if you have been following along at home and have a similar setup to mine.  Apparently the problem is you can’t just shove a MicroSD card into an Arduino.  If you try to add one to an Arduino, then the card shield will end up taking up the pins necessary to use the Motor Shield.  Since the Arduino Mega has a lot of extra pins, some of those can be used towards accessing the MicroSD card.

However, I thought I had seen an Arduino that had a MicroSD slot on board. 5  When I searched around Adafruit, I found this Ethernet Shield R3 with MicroSD connector6 .  Not only does this little shield fit my existing Arduino Uno, have a MicroSD slot, and have an Ethernet port, but it also has input pins so that it can be stacked!  This makes me then wonder…  Could I just pop this $45 board between my Arduino Uno and Motor Shield, add some software and get cooking?  I have to admit, the idea of spending $45 more, rather than $80 more for a Mega and MicroSD breakout board appeals to me.  I suppose there’s the added benefit that I might be able to run a REALLY long ethernet cable to the ‘bot if I so desired since it would have a built-in ethernet port on the Ethernet Shield.

Now, I’m the first to admit that I know next to nothing at all about programming Arduinos or fiddling with such things.  I’m just a fair hand at slavishly following some other person’s excellent directions.  Please do me a favor and let me know whether you think adding this Ethernet shield between my Uno and the Motor Shield will or will not work.

”Posts
  1. Wanna make a DrawBot?
  2. DrawBot Resources and Links
  3. DrawBot, the Adventure Begins
  4. DrawBot - Parts Ordered!!!
  5. DrawBot - The Breakdown
  6. DrawBot - Parts Shipped!!!
  7. DrawBot - What would you draw?
  8. DrawBot - The Plan!
  9. DrawBot - The Hacks
  10. DrawBot - Giant Unicorn?
  11. DrawBot - The Delivery?
  12. DrawBot - The Delivery, Part II
  13. DrawBot – The Delivery, Part III
  14. DrawBot – The Assembly, Part I
  15. DrawBot – The Delivery, Part IV
  16. DrawBot – The Assembly, Part II
  17. DrawBot – The Assembly, Part III
  18. i find i want to add more posts in some random series, just so i can use my new plugin
  19. Simple Series WordPress Plugin
  20. This is a test of the Simple Series post system... This is only a test
  21. Now Simple Series will also add the series list to RSS feeds too!
  22. ZOMG! Simple Series is going viral!
  23. Simple Series with SEO! after just one day
  24. DrawBot – The Operation, Part I
  25. DrawBot – The Assembly, Part VIII
  26. DrawBot – Printing!
  27. DrawBot – Printing, Part II
  28. DrawBot – Why are you crying?
  29. DrawBot – Calibration
  30. DrawBot – Pen Selection
  31. DrawBot – Drawing Success(ish)!!!
  32. DrawBot – Onwards and Upwards!
  33. Restarting a Stalled DrawBot Drawing
  34. TSP FTW!
  35. Speedier DrawBot Drawings
  36. Two new DrawBot links! And an update!
  37. The biggest inkjet printer ever
  38. Why do DrawBots draw on walls?
  39. DrawBot Aesthetic Re-Design Ideas
  40. The Eagle Has Landed
  41. I think I know what I want to draw next...
  42. This project is not going to overengineer itself
  43. Overengineered Spools
  44. Overengineered Stepper Motor Mounts, Filament Guides
  45. Sourcing DrawBot Parts
  46. Arduino Powered Drawing Robot Poll
  47. Building an Arduino Drawing Robot - On The Cheap
  48. DrawBot - Printed Parts Tour
  49. Unidentified Foam Object
  50. DrawBot, now ACTUALLY wall mounted!
  51. How to add a custom button to the WordPress Visual TinyMCE Editor
  52. A Study of Drawing Robot Pen Holders and Design Considerations
  53. Drawing Robot Pen Holders, Calligraphy Pens, and Thought Experiments
  54. PlotterBot.com - a new site dedicated to drawing robots

  1. Actually, the TSP drawings ARE vector graphics… []
  2. $65 at Adafruit []
  3. $15 at Adafruit []
  4. $20 at Adafruit []
  5. Spoiler alert: I was wrong []
  6. $45 at Adafruit []

3 Responses to “Speedier DrawBot Drawings”

  1. Michael Cook says:

    I’ve been following your blog for a while, and I took a quick look at this. If you read the documentation for the SD reader you’ll find this:

    “Because SD cards require a lot of data transfer, they’re really only good when connected up to the hardware SPI pins on a microcontroller”

    The motor shield uses the SPI pins on the Arduino Uno (10, 11, and 12), so you couldn’t use the hardware SPI to access the SD card. This leaves you with two options (on the Uno). First, you could rewire the motor shield. If you switched which pins went where and modified the software appropriately, you would be able to use the SD card. It looks like the motor shield just uses the pins as generic digital pins (from a quick look).

    Option two would be to use different pins for the SD card. The motor shield leaves 2, 9, 10 and 13 free for your use. That’s enough to use the SD card. The problem here is that you have to use software SPI. It exists in the code for the SD reader, but it will use up more CPU time. I don’t know if it would be faster than USB though.

    I hope this helps. Email me if I can try to help further.

  2. Sandy Noble says:

    Yep, Michael describes the main issue exactly as I see it too. I _did_ get around this pin problem to a certain extent by doing the opposite of Michael’s suggestion – that is, I kept the SD card on the SPI pins on 10-13, and modified the Adafruit library so it used different pins (http://code.google.com/p/polargraph/source/browse/#svn%2FAFMotor%2Fbranches%2FAFMotorSPI). I moved pin D11 to pin D9, and pin D12 to pin D14 It needed a little bit of hardware pin-bending and re-patching (http://www.flickr.com/photos/euphy/6062195091/in/set-72157626497662024) but it seemed to work. Servo motor stopped working properly, because it is wired to use the PWM on pin 9 normally, but I think there’s probably a way around that – I never tried. My journey is http://forums.adafruit.com/viewtopic.php?f=31&t=22422.

    The second thing I ran into is that the code needed to access the sd card is pretty big, so I ran out of memory to use any libraries anyway. The SD library on it’s own (that can read an SD card as a FAT volume) is 12k or so, and the polargraph server code is bulky, so there’s only 3 or 4k leftover. Again, I partially solved it by abandoning the idea of having FAT formatted cards and just reading and writing raw bytes to the card. The last version of the server code with this stuff in is http://code.google.com/p/polargraph/source/browse/embedded/trunk/drawbot_server_big.pde?spec=svn11&r=11 but it’s rudimentary. It’s based on Didier Longueville’s code here: http://arduino.cc/playground/Code/SDCARD. And so I ran into the final issue of running out of SRAM space, and eventually decided that it wasn’t worth the stress of trying to maintain such a highly optimised codebase. I don’t know much about C so it’s a job for someone far smarter than I.

    In retrospect, Michael’s solution of using the softwareSPI is probably the more sensible route – even dead slow it will still be magically instantaneous compared to USB, but you will still need to figure out a way to do I/O to the card. I kinda gave up on the idea – but I would be dead keen to find a solution. Bear in mind that ada are not the only fruit though, there are other drivers (though none quite so affordable) that use other pins or work in a different way. I can see that a limited function machine could still work – it wouldn’t do anything fancy, just the bare minimum.

  3. […] Speedier DrawBot Drawings Blog this! Digg this post Recommend on Facebook Share on FriendFeed Share on Linkedin Share via MySpace Share on Orkut Share with Stumblers Share on technorati Tumblr it Subscribe to the comments on this post Bookmark in Browser Tell a friend Pin It […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>