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 in the DrawBot Adventure Series
  1. Wanna make a DrawBot?
  2. DrawBot Resources and Links
  3. DrawBot, the Adventure Begins
  4. DrawBots for the slow learner
  5. DrawBot - Parts Ordered!!!
  6. DrawBot - The Breakdown
  7. DrawBot - Parts Shipped!!!
  8. DrawBot - What would you draw?
  9. DrawBot - The Plan!
  10. DrawBot - The Hacks
  11. DrawBot - Giant Unicorn?
  12. DrawBot - The Delivery?
  13. DrawBot - The Delivery, Part II
  14. DrawBot – The Delivery, Part III
  15. DrawBot – The Assembly, Part I
  16. DrawBot – The Software, Part I (and an existential conversation)
  17. DrawBot – The Delivery, Part IV
  18. DrawBot – The Assembly, Part II
  19. DrawBot – The Assembly, Part III
  20. DrawBot – The Assembly, Part IV
  21. DrawBot – Design Considerations
  22. DrawBot – Halp!!! No - seriously, a little help?
  23. DrawBot – The Face Palm
  24. DrawBot – The Delivery, Part V
  25. DrawBot – The Silver Lining of Failure
  26. DrawBot – The Delivery, Part VI
  27. DrawBot – The Assembly, Part V
  28. DrawBot – The Assembly, Part VI
  29. DrawBot – Printed Parts
  30. DrawBot – The Assembly, Part VII
  31. DrawBot – The Operation, Part I
  32. DrawBot – The Assembly, Part VIII
  33. DrawBot – The Breakdown, Part II
  34. DrawBot – Printing!
  35. DrawBot – Printing, Part II
  36. DrawBot – Why are you crying?
  37. DrawBot – Calibration
  38. DrawBot – Pen Selection
  39. DrawBot – How to Recover from a Stalled Print!
  40. DrawBot – Drawing Success(ish)!!!
  41. DrawBot – Pen Selection, Part II
  42. DrawBot – Onwards and Upwards!
  43. DrawBot – Another Successful(ish) Drawing!, and an Update
  44. Restarting a Stalled DrawBot Drawing
  45. TSP FTW!
  46. Speedier DrawBot Drawings
  47. Two new DrawBot links! And an update!
  48. Excellent DrawBot Slides
  49. Another Drawing Robot!!!
  50. DrawBot Practice Tip: A Watched Pot
  51. The biggest inkjet printer ever
  52. Why do DrawBots draw on walls?
  53. Maze Code + Polargraph?
  54. All New Polargraph on the way!!!
  55. Ideas for improving my DrawBot
  56. DrawBot Aesthetic Re-Design Ideas
  57. The Eagle Has Landed
  58. Every Body Needs a Skull
  59. I think I know what I want to draw next...
  60. This project is not going to overengineer itself
  61. Overengineered Spools
  62. Overengineered Stepper Motor Mounts, Filament Guides
  63. Overengineered Bolt Endcaps, Case Holder
  64. Sourcing DrawBot Parts
  65. DrawBot - A Tour!
  66. DrawBot - A Preview
  67. Arduino Powered Drawing Robot Poll
  68. Building an Arduino Drawing Robot - On The Cheap
  69. DrawBot - Printed Parts Tour
  70. Unidentified Foam Object
  71. Arduino Powered Drawing Robot - Take 2 (Or 3)
  72. DrawBot, now ACTUALLY wall mounted!
  73. A Study of Drawing Robot Pen Holders and Design Considerations
  74. Drawing Robot Pen Holders, Calligraphy Pens, and Thought Experiments
  75. Ideal Qualities in a Drawing Robot Pen Holder
  76. Enough talk! Finally a pen holder!
  77. DrawBot Pen Holder Post Mortem
  78. To Maker Faire!!!
  79. Skipping! How could I forget the skipping?!
  80. Drawing Robot Penmanship
  81. PlotterBot at Maker Faire Bay Area 2013!
  82. 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 class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">