Designing Arduino Projects With ChatGPT | Cirkit Designer

by AustinS89 in Circuits > Arduino

2799 Views, 5 Favorites, 0 Comments

Designing Arduino Projects With ChatGPT | Cirkit Designer

Front Isometric View (Closed).JPG
Exploded Diagram.JPG
blog_8.PNG

By Austin Small - Founder of Cirkit Design, ex-Google Software Engineer, BSE in Electrical Engineering and Computer Science from the University of Pennsylvania


Diving into the world of electronics can be exciting but also very overwhelming, particularly for those just starting out. My journey began in Eighth grade, with a problem that might sound familiar to many pet owners: my one cat, Tabitha, would always eat the food of my other cat, Joey. Tabitha was overweight while poor Joey was starving!

The solution to my problem seemed simple — I would build an RFID pet feeder that would only open for Joey. I had dreams of not only solving this problem at home, but maybe even pitching a product to Mark Cuban on Shark Tank. However, without the necessary skills in software and electrical engineering, I was completely overwhelmed and had no concrete way of getting started. Fortunately, my Dad was able to offer guidance to help me get a basic prototype working, but at this point in my engineering career, I only understood how bits and pieces of this prototype worked, which was very frustrating. Despite my frustration, it did feel amazing to have a first working prototype. I fed off this momentum, and spent the next several years learning the concepts, and refining and iterating on the design until I had managed to develop a polished prototype that was ready for some real pet owners to try out.

Over this multi-year journey, I learned a lot and was very proud of the product that was eventually developed. However, I’m pretty sure that without my Dad’s guidance and support, a working prototype would have never come together, and I may have never become an engineer and entrepreneur. In addition, in the years that it took for me to learn fundamental electronics and refine my prototype, a company beat me to market with their own RFID pet feeder.

This experience was eye-opening. It highlighted the significant barriers enthusiasts, hobbyists, students, and inventors face: a steep learning curve and a lack of accessible tools that guide individuals from an initial idea to a tangible prototype. It sparked the conception of Cirkit Designer.

Downloads

The Inspiration Behind Our AI-Integrated Circuit Design Application

Cirkit Designer was born out of the need to make electronics design more accessible. I envisioned a platform where the journey from “What if?” to “Here it is” was not just possible but intuitive and guided every step of the way by an AI assistant. Whether choosing the right components, figuring out component wiring, or writing code, Cirkit Designer is designed to simplify what once seemed like insurmountable challenges.

How Our Application Works: AI-Powered Features

blog_1.PNG

When a user approaches Cirkit Designer with an idea, like an RFID pet feeder, the AI assistant kicks into gear.

For my RFID pet feeder project, I can start by asking Cirkit: “I want to build an RFID pet feeder that only opens when it reads the RFID tag of one of my cats. Otherwise, the feeder should be closed. What parts do I need?”

As you can see below, Cirkit AI first recommended a list of general electrical parts:

  • RFID Reader Module
  • Microcontroller
  • Servo Motor
  • RFID Tags
  • Power Supply

AI Help Picking Parts

blog_2_a.png
Blog_3_a.png

I then prompted Cirkit AI to find me the recommended parts from the Cirkit library that correspond to those general parts.

As you can see, Cirkit AI came up with an RFID-RC522 reader, an Arduino Uno, a servo motor, and a PowerBoost 1000 Basic Terminal USB from Adafruit to power the circuit.

It looks like the AI substituted an RFID ID12 reader for the RFID tag, which is a mistake. This is probably because there isn’t an RFID tag in the Cirkit parts library, and the AI wasn’t sure how to handle that.

More Help Picking Parts

blog_4_a.png
blog_5a.png
blog_6a.png

I’m not familiar with the PowerBoost 1000, so I asked the AI to clarify why it chose that part. Cirkit AI explains that the PowerBoost will draw power from a battery and output a stable 5V for the circuit.

From that explanation, it is clear that I also need a battery in my circuit, so I ask Cirkit AI to find me a battery.

More Help Picking Parts

blog_7.PNG

Now that I’m happy with the parts list, I click the “Add Part” buttons, which adds all of the parts that Cirkit AI recommended. Here are all of the parts added to the circuit:

Wiring Up RFID Reader

blog_8.PNG

My next task is to wire this up. I could head over to Google and tediously read through tutorials for each part that I’ve chosen, or I could just ask Cirkit AI!

As you can see, I asked the AI for help wiring up the RFID reader, and followed the instructions.

AI Double Checking My Wiring

blog_9.PNG

I was even able to ask the AI to double check my work to make sure I didn’t make any mistakes.

Finish Wiring

blog_10.PNG

Following these same steps, I get help from the AI to wire up the rest of the circuit:

Writing Code

blog_12.png

My next task will be writing code.

Side note: the first time I prototyped the RFID pet feeder, writing code was a huge challenge. There were plenty of examples online, but it felt like reading a foreign language, and I didn’t know enough to understand and make use of those examples.

So now I can ask Cirkit AI to spin up some code for me. I ask Cirkit AI to “write the full code for my circuit.”

Here is the full code that the AI drafted for me.


#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10 // RFID-RC522 SDA pin connected to Arduino pin D10
#define RST_PIN 9 // RFID-RC522 RST pin connected to Arduino pin D9
#define SERVO_PIN 6 // Servo control pin connected to Arduino pin D6

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
Servo myServo; // Create servo object to control the servo

// The UID of the tag that will open the pet feeder
const byte authorizedTag[4] = {0xDE, 0xAD, 0xBE, 0xEF}; // Replace with your tag's UID

void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
myServo.attach(SERVO_PIN); // Attach the servo on pin D6 to the servo object
myServo.write(0); // Set servo to closed position
}

void loop() {
// Look for new cards
if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {
delay(50);
return;
}

// Check if the detected card's UID matches the authorized tag
if (memcmp(mfrc522.uid.uidByte, authorizedTag, 4) == 0) {
Serial.println("Authorized tag detected!");
openFeeder();
} else {
Serial.println("Unauthorized tag detected.");
}

// Halt PICC and stop encryption on PCD
mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();
}

void openFeeder() {
myServo.write(90); // Rotate servo to open position
delay(5000); // Keep the feeder open for 5 seconds
myServo.write(0); // Rotate servo back to closed position
}

Compiling Code

blog_13.PNG

I add this code to the IDE inside Cirkit Designer, and attempt to compile, but I receive a nasty warning:

Compilation Error

blog_14a.png
blog_15a.png

Yet again, Cirkit AI is here to help.

It tells me that I’m missing an include for the Servo library. After I add this include, the code is compiling!

Thank You for Reading!

My next steps will be to order the parts to test out this circuit… updates coming soon. It would be awesome if Cirkit was able to simulate my circuit to test it out, and if I could order the parts at the click of a button. These are some things that may be added to Cirkit soon…

So there you go. Cirkit Designer got me to an initial design in around 10 minutes. This would have been a game-changer if I had this tool back in Eighth grade.

We’re putting a lot of hard work into building this tool, and I’m really hoping our tool will help many students, hobbyists, and innovators to pursue their passion and build cool things.

If you’re interested in Cirkit Designer, come check us out at www.CirkitDesigner.com.

Also we’re always interested in exploring partnerships, so is you have any ideas or proposals, please reach out!

You can also reach me personally at austin@cirkitdesign.com.

Until next time.

Austin