Blog - Sketching with Hardware

Team 8 – auto_SOW_matic

Published on: | Author: Peter Gleixner | Categories: 2018a, Best Projects, Projects

Hello everyone,

this is Anja and Peter, Media – Informatics Bachelorette and Master, we finally made it and got our spot at the SWH-Practical Course, this year featuring the awesome topic: “ROBOTANICS: Machines that improve garden work or make staying outside more enjoyable” Wait… What?
Gardening and going outside? We are city kids playing video games all day. We don’t even know what the heck you can do on a  Wiesn except drinking beer. But alright, we are here for tinkering some nice gadgets right? Lets figure it out!

So since we established our lack of gardening knowledge, the project had to somehow revolve around our urbanism. So how does the city and gardening mix? Well there are those small green strips before my appartment where some of the residents planted a bunch of flowers. How is that called again? Ooh right, Guerilla Gardening! We got a starting point.


So what kind of Product could help spreading wild gardens all over the city? We shared our not yet developed idea “do something with Guerilla Gardening” to the group and got some amazing ideas and feedback.

The Idea

Why not build a machine which shoots seeds in a catapultish way whenever you walk close by a green area? Thats awesome!
Just attach a little device to your backpack and whenever you stroll around the city you help making it a bit more pretty and bee-friendly. I mean who doesn’t love colorful flower beds and humming bees?

We could use Open Street Map (OSM) on an android device to check for that and trigger our little trebuchet by proximity. The device would have to adjust to the direction and also run only when needed so you don’t pollinate the pavement.

Here is how the concept could look like:

 

 

The Solution

After some brainstorming the catapult idea got a bit refined and we decided to use a construct similar to sowing machines  instead, where seeds would fall on a centrifuge. The direction could be  controlled by the direction of the wheel.

Also it should be small enough to be mounted on a backpack or even an Dachshund (Author’s note: That’s basically the only dog with serious street credibilty in Munich).

Hardware

We started out by sketching our idea and concept possible solutions. With the sowing machine in mind it had to be clear that there has to be some sort of spinning wheel mounted beneath a funnel from which the seeds would be provided.

Sketches and Sowing Machine

It should have an wide enough opening to allow seeds to fall in two directions. Also we needed an opening mechanism for the funnel so that the seeds would only drop in small chunks. That could be done with a servo detached under a funnel to control the seed flow. And a motor underneath that to distribute the seeds. All put together in a nice looking box. We ended up with a pretty lean material list:

  1. Android Phone (Samsung S2)
  2. Arduino ONE
  3. Stepper Motor
  4. H-Bridge
  5. Servo
  6. USB On The Go – Adapter (USB-OTG)
  7. Some wires
  8. Some Lasercut plastic disc for the frame.
  9. Soft & thin plastic plate for the casing
  10. More of that plastic plate for the opener
  11. Propeller
  12. Funnel
  13. Zylinder shaped Box for the wrapping
  14. Velcro for the mounting
  15. Duct tape
  16. Some more Duct tape

The wiring was as you can see on the Fritzing Sketch also pretty straight forward. The Arduino is powered and controlled by the Smartphone.

At first we wired it all up, except for the Smartphone component, just to be able to test out if our construction would even work. If it would be enough to just change rotation of our Propeller to direct the seeds and how long the opening intervalls should be so enough seeds would fall out, but not too many since we don’t have the biggest container available. We decided to split our work after that: One member will be building the hardware, testing the opening mechanism and how to put all the parts together, the other one would quickly fix an Android App with some controls to start the motor and change direction using USB-OTG.  After that is done we could look at OMS-Interfaces for detecting green areas on the map. We thought…

On the pictures below you can see an early prototype, the opening mechanism and the finished neat looking box.

Early Prototype | Opening Mechanism | Finished Box

Software

Sadly the whole android part took longer than expected, so there was no time left for actually implementing the OSM bit of the app. But at least we managed to get it to run some commands on our Arduino.
Let me guide you through it, maybe you can learn from my mistakes on your own project.

Android

For the Arduino <-> Android connection we used this great tutorial by former SWHardwarers. It eventually worked after a Tuesday Night-session and some lessons learned the hard way:

  1. I really recommend following and building this more detailed version of the Connector to get a better understanding of the code and how the connection works. Really. Do it.
  2. Find out your Arduino’s Vendor- and Device-Id. (Windows, Mac). And especially: USE the DECIMAL VALUE for the vendor-id in your device-list !!1!11einself
  3. Use Wifi Debugging for Android. Really. Use it.
  4. Consider using Bluetooth instead. The wireless connection solves the debugging issue and it is just as easy to implement. I tried it at home.

We had a lot of problems establishing a connection. The main issue was the lack of debugging options, since you have to plug in the Smartphone to your Arduino and hope for the best. This was unbearabale so we decided to install Wifi debugging after a whole day of trying. Although this debugging method is pretty slow and inaccuarte, at least it we got some Exceptions and Logs  from which we finally made the connection happen. PRO TIP: Use an Usb Adapter without a slack joint, especially on presentation day…

After we managed the connection the rest was pretty easy to implement:

  1. Add Buttons for Connect, Disconnect, Start/Stop Motor, Left and Right
  2. Send an Char-m to our Arduino.

Out of convenience we used Chars not Strings since Arduino’s Serial.Read() reads bytewise and Chars are 1 Byte exactly.

Arduino

After we established what operations our machine should be able to execute (start, stop, left, right..) we needed to figure out how we want to coordinate it. In our testing session we rapidly found out that it’s neither a good idea to open the funnel without the motor running (clogging the rotor) nor its very smart to stop the motor too early when seeds might still be in the system. What we wanted to do was:

  1. Opening-meachnism has to run in an infinite loop, in a certain interval (open 500ms, closed 1000ms), until the stop command.
  2. Motor has to always start before opener-loop starts and has to run a few ms after it closes.
  3. When changing directions the motor has to shut down properly first, then change direction and then start again. Also: Keep the Opener in mind!

Still needs a bit of fine tuning

For Example the changing direction routine would look like:

  1. Get the “l” Signal
  2. Stop the Opener-Loop on closed
  3. Wait a bit
  4. Stop the motor and switch directions
  5. Start the motor
  6. Wait a bit
  7. Start the Opener-Loop

Therefore something like concurrency or multithreading had to be simulated in our Arduino Loop. One “Thread” waiting for inputs, and another Thread executing commands and running the opening-loop every other second. Of course the very simple Arduino board does not provide anything like that but there are ways to simulate it. Just calling delay() occasionally won’t do the trick.

We simply counted the current time, subtracted the last call and checked it by bigger than 1000ms. Whenever the timer hit we executed our function and reset the last call. Therefore we had the chance to wait for inputs, set a variable and then react to a state change in our loop which got executed once a second.

Check the arduino code here.

That is basically the same the TimerOne-Library does. It executes a function every x Milliseconds on the Timer1 of Arduino (check this to learn more about timers). The Problem was that we also used the Servo-Library which uses the same timer and therefore produces conflicts and weird behaviour. If you don’t use and external library which uses Timer1, I recommend using the TimerOne-Library for convenience.

That is how our finished project looks like (without the neat looking box). Beware to be amazed by the super slo-mo!

Conclusion

As in every project there will be some downsides, stuff will break or something simply just won’t work. Don’t get angry or frustrated. Set your time limit. Try your best and if it really doesn’t work try something different. Keep in mind:

There is always a workaround!

linked categories 2018a, Best Projects, Projects

|

Write a comment

Comment