ATTiny Project Guidance

Hello! I’d like to start my first arduino mini project but I’ve got a few questions.

First of all, I’d like to share that I have a bit of electronics knowledge since I am a first year Electronic Engineering student and have been part of a FTC team for a few years.

The problem is that I wanted to explore the wonders of arduino boards and such but I find myself spending hours and hours of browsing the internet with no almost no result, because I have no ideea where to start.

So as my first project I want to make an automated food dispenser for my dog. The principle is simple: a gate actioned by a MG90s servo every 24 hours.

For this I’d like to use an ATTINY85 Digispark board, a micro servo as mentioned above, a DS1307 RTC and a power bank since the dispenser will be placed in a remote area.

How can I put all those components together? How do I wire them? Do you guys have any suggestions regarding the components or the plan’s flow? Also, do you guys have any tips on programming? I’ve been programming FTC robots for a few years, but this is the first time I try to get out of the safe place created by the already already wired Robot Controller I used to work it and barely have any ideea on how to operate with theese new tools.

Thanks in advance!

If you are a beginner, projects like this need to be done in steps. Buy the ATtiny85 board, and learn the basics by trying out the servo sweep and DS1307 Arduino example programs.

If you want the feeder to keep reasonably accurate time, avoid the DS1307 and use a DS3231 module.

That's a common project. Please do a search for "food dispenser" and You will find several projects doing that.

It is much easier to use a larger Arduino board for development. The ATTiny is cute, but using an UNO or a Nano will be way more comfortable.

Then if you still care, do the heroic struggle which might be moving the project to the smaller microprocessor.

To have a huge advantage and leave all real life issues for a different day, you can completely develop the code and wiring without buying a single item. And write code starting form examples that are included with the documentation of the parts that are available for use with the

simulator, currently the best of the lot.

It has an ATTiny chip, but even here I suggest it will be easier to develop on a simulated UNO.

a7

I made an ATtiny85 widget for testing servos that might help.

Files for WOKWI.COM

click for sketch.ino
int servoChan[] = {PB0, PB1};
#define angle0  450
#define angle180 2450

void setup() {
  pinMode(servoChan[0], OUTPUT);
  pinMode(servoChan[1], OUTPUT);
}

void loop() {
  gotoZRO(servoChan[0]);
  goto180(servoChan[1]);
  goto180(servoChan[0]);
  gotoZRO(servoChan[1]);
}

void gotoZRO(int servo) {
  digitalWrite(servo, HIGH);
  delayMicroseconds(angle0);
  digitalWrite(servo, LOW);
  delayMicroseconds(20000 - angle0);
  delay(300);
}

void goto180(int servo) {
  digitalWrite(servo, HIGH);
  delayMicroseconds(angle180);
  digitalWrite(servo, LOW);
  delayMicroseconds(20000 - angle180);
  delay(300);
}
click for diagram.json
{
  "version": 1,
  "author": "Kaushal Shah",
  "editor": "wokwi",
  "parts": [
    {
      "type": "wokwi-attiny85",
      "id": "tiny",
      "top": -12.1,
      "left": 6.1,
      "rotate": 90,
      "attrs": {}
    },
    {
      "type": "wokwi-servo",
      "id": "servo1",
      "top": -173.8,
      "left": -36.6,
      "rotate": 270,
      "attrs": {}
    },
    { "type": "wokwi-gnd", "id": "gnd1", "top": 28.8, "left": -10.2, "attrs": {} },
    { "type": "wokwi-vcc", "id": "vcc1", "top": -66.44, "left": 124.8, "attrs": {} },
    {
      "type": "wokwi-servo",
      "id": "servo2",
      "top": -173.8,
      "left": 11.4,
      "rotate": 270,
      "attrs": {}
    }
  ],
  "connections": [
    [ "servo1:GND", "tiny:GND", "black", [ "v9.6", "h-38.4", "v39.6" ] ],
    [ "servo1:PWM", "tiny:PB0", "green", [ "v19.2", "h0.2", "v40.9" ] ],
    [ "tiny:VCC", "servo1:V+", "red", [ "h0" ] ],
    [ "vcc1:VCC", "servo1:V+", "red", [ "v19.2", "h-28.9" ] ],
    [ "gnd1:GND", "tiny:GND", "black", [ "v0" ] ],
    [ "tiny:PB1", "servo2:PWM", "green", [ "h0" ] ],
    [ "vcc1:VCC", "servo2:V+", "red", [ "v19.2", "h28.8" ] ],
    [ "gnd1:GND", "servo2:GND", "black", [ "v-48", "h86.4" ] ]
  ],
  "dependencies": {}
}

The following connection diagram (Fig-1) may be helpful. Note that you have only 6 KB Flash Memory available to accommodate your whole sketch. So, try to use all those Tiny Libraries.


Figure-1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.