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.

  1. Wanna make a DrawBot?
  2. DrawBot Resources and Links
  3. DrawBot, the Adventure Begins
  4. DrawBots for the slow learner
  5. DrawBot - What would you draw?
  6. DrawBot - The Plan!
  7. DrawBot - The Hacks
  8. DrawBot - Giant Unicorn?
  9. DrawBot – The Assembly, Part I
  10. DrawBot – The Software, Part I (and an existential conversation)
  11. DrawBot – The Assembly, Part III
  12. DrawBot – The Assembly, Part IV
  13. i find i want to add more posts in some random series, just so i can use my new plugin
  14. My first published WordPress plugin! Simple Series!
  15. This is a test of the Simple Series post system... This is only a test
  16. DrawBot – The Delivery, Part VI
  17. DrawBot – Printed Parts
  18. DrawBot – The Assembly, Part VIII
  19. DrawBot – The Breakdown, Part II
  20. DrawBot – Printing!
  21. DrawBot – Why are you crying?
  22. DrawBot – Calibration
  23. DrawBot – Pen Selection
  24. DrawBot – How to Recover from a Stalled Print!
  25. DrawBot – Drawing Success(ish)!!!
  26. DrawBot – Onwards and Upwards!
  27. Speedier DrawBot Drawings
  28. Two new DrawBot links! And an update!
  29. DrawBot Practice Tip: A Watched Pot
  30. All New Polargraph on the way!!!
  31. Ideas for improving my DrawBot
  32. The Eagle Has Landed
  33. Every Body Needs a Skull
  34. I think I know what I want to draw next...
  35. DrawBot - A Preview
  36. Arduino Powered Drawing Robot Poll
  37. Building an Arduino Drawing Robot - On The Cheap
  38. DrawBot - Printed Parts Tour
  39. DrawBot, now ACTUALLY wall mounted!
  40. How to add a custom button to the WordPress Visual TinyMCE Editor
  41. A Study of Drawing Robot Pen Holders and Design Considerations
  42. Drawing Robot Pen Holders, Calligraphy Pens, and Thought Experiments
  43. Ideal Qualities in a Drawing Robot Pen Holder
  44. 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>