-
Activities With ATMEGA328
10/30/2024 at 17:50 • 0 commentsGreetings all,
ATMEGA328P has to be one of the most popular microcontrollers on the market. Why so? Well this microcontroller is apart of the Arduino Uno which is a popular board of the Arduino lineup. In my opinion, I think starting with the learning of this exact chip is the way to go so you can learn what's the brain of the Arduino. Honestly, the board itself cannot function without the microcontroller so it's a must to learn. What's even better is that you can create projects without having the Arduino at all. Doing so will advance your projects in the world of Bare Metal. That's another topic, but don't worry. In the future you will learn more for I will drop those blog posts lol.Well... let's get deeper into the ATMEGA328P.
Before diving into the micro-controllers, let's speak briefly about the company that makes the ATMEGA328P. ATMEL is a company that created a family of micro-controllers called: AVR. AVR (Advanced Virtual RISC) micro-controllers primary focus is to be the "brain" of the electronic device like stated prior. After years of work, they decided to sell the company to Microchip later making what we see today. The primary focus is to provide control of the electronic device. For more insights about the company you can visit their website here: Microchip.
Key Features of the ATMEGA328P:
1. Processor: 8-bit
2. Clock Speed: Up to 20MHz
3. Flash Memory: 32KB
4. SRAM: 2KB internal
5. EEPROM: 1KB of internal
Here is the pinout of the ATMEGA328P. This is crucial because it shows the physical layout and assignment of the pins. The datasheet of a micro-controller is also very important and I highly advise you looking at it. Information about the features, memory and how it can be used in apps are all there. When getting in the habit of reading datasheets and pinouts, you can take your projects to the next level. Believe me.
Welp that's about all for this great micro-controller review. Take a moment to read about other AVR chips such as ATTiny85 and the ATMega16U. These are also incredible and I plan to use in the near future for projects.
Until next post...
-Odot!
Reference Links:
ATMEGA328P Datasheet: https://www.microchip.com/en-us/product/ATmega328?_ga=2.243107653.656835104.1721689312-1035414100.1721038452
Arduino Uno Pinout : https://docs.arduino.cc/resources/pinouts/A000066-full-pinout.pdf
-
5 Steps of Hardware Design
10/30/2024 at 17:47 • 0 commentsGreetings,
Welcome back to another blog post. While working hard on ideas within the electrical engineering world, I came across some great information in regards to hardware prototyping. I mean eh, it's always great to get the gems early in the hardware world. Especially if others have the knowledge due to traveling where you have or going to in the field.
Designing boards can be fun but there is always a direction to all things. In my case, I wanted to start building hardware solutions.. How can one achieve such? Welp, that's where YouTube University comes in handy. I took the time to research and came across 5 great things to think about when achieving hardware design. The 5 areas (not in any order) are the following ...
- Mechanical : which deals with how the entire hardware will be delivered. Will you have a case for the microcontroller? What will the end result look like? Things to focus on in this step would be screws, holes, cases, dimensions of board and all the physical "thangs" lol
- Electronics: Yes I know it sounds crazy for the field is such, but this is an area to focus. This deals with "proof of concept", schematics, Gerber files and BOM (bill of materials). What hardware are you using for the end result? Similar to area 1, but you get the picture of this area.
- Power Source: This area focus on the realm of exactly what it says... "POWER". What will keep the product powered on? Will it have a power off option? Things to consider in this step is quite crucial in addition would be what type of power. Will it be battery, USB, rechargeable lipo battery, etc.
- Software : Hehehe... This is where the good ole purpose of the product runs in focus. What the hell is this product going to solve? The instructions placed on the hardware is called Firmware and you must decide what angle you will approach. What I mean is that there are 2 ways that you interact with the software. Cloud based or BLE (Bluetooth). The firmware itself can run on the board and no interaction will be needed such as a LED just blinking on and off. Decide carefully good engineer.
- User Experience: is the last area of focus when it comes to Hardware Design. Will the product need Internet access or not? Hmmm a question that will easily be overlooked for we are connected daily for the most part. Some however aren't in which the product might to benefit them. Another would be a question of user having to press a button to review the info desired. This is HIGHLY important for you don't assume the user will understand the product.
So yep, I really hope that you can achieve greatness when thinking of this during the designing of your hardware. It really gave me an eye opener due to playing countless hours on Kicad. Certain things have to be thought about besides colors and lights. Think BIG.... LOL.
Until next post.
- Odot! -
Ard... Ard... Arduino
10/30/2024 at 17:42 • 0 commentsWhile working on the electronics, I've found that the world of Arduino programming is highly important. In my opinion it helps a great deal because much of the code behind the scenes is done with the syntax of Arduino. You don't need to have prior programming skills, however I highly advise you learn the basics of programming. Also I advise many to understand how the Arduino works as well as circuits. If you don't know where what should be programmed you may bring high risk of "frying" your Arduino board. Welp, let's get to it and speak tad about the Arduino programming language.
Tools Needed:
- Arduino Uno
- USB Cable for Arduino
- Computer
- Arduino IDE
As of many programming languages, they all have their own syntax. In regards of Arduino, they decided to create their own programming language. Not just the syntax of Arduino has been created, but also their own IDE. This is phenomenal for those who aren't familiar with other IDE tools like VSCode yet want to get started. The IDE includes all the tools needed to begin working with the Arduino boards as well as examples. You can download the IDE at their website Arduino.cc.
Once you download the IDE, let's take a look into a built-in example of Arduino IDE for a on-board LED blink.
Let's open the IDE and go to the following:
File > Examples > Basics > Blink
Now lets take a look at the example and break down the syntax. From the top you will see the information of the Author in green font. This is the way that Arduino presents it's comments. You can create a comment in Arduino by typing: "/*" . To close the comment simply type "*\". To do a single line comment, you simply type "//". Now you can understand comments and see that most of the code is showing such right?! Right! So let's go through the code and see what's going on here.
When working with the Arduino you will have the two setup functions in every program. The "void setup()" function and the "void loop()" functions are very important for it is the machine behind the Arduino in my opinion.
void setup() function runs only one time.
void loop() function runs multiple times.
If you notice, there is some code within the void setup() function. Let's take a deeper look into the syntax shall we?! Yesssir... ODOT should be the response. LOL.
pinMode(LED_BUILTIN, OUTPUT);
pinMode(pin, mode): Configures the specified pin to behave either as an input or output.
- pin: the Arduino pin number set the mode of.
- mode: INPUT, OUTPUT or INPUT_PULLUP.
- LED_BUILTIN: Built-in LED on the Arduino board itself.
- OUTPUT: mode in which the pin will be set.
So now when looking at the setup of the board program, we know that the pinMode() will be of the Built-in LED which will OUTPUT. For the output of power, it will typically be the 5V power of the USB cord connected to the PC. I mean eh, that's how you will upload the program once complete right?! Yep! Let's look a bit deeper into the void loop() function to see what's going on.
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(pin, mode): Turns on the LED pin to high.
- pin: the Arduino pin number set the mode of.
- mode: HIGH (ON), LOW (OFF)
delay(ms): Places a delay within the program action in milliseconds. (1000ms = 1 sec)
So let's look at this code in detail for this will be the void loop() function right?! The function that will run over and over and over until the program is set to stop overall. The code shows that the on-board LED will turn on for 1 second. Then the same on-board LED will turn off for 1 second after the prior delay was executed. Then it will go again and again until the Arduino is unplugged.
Hahaha! See... you now broke down your first Arduino program. That wasn't that bad was it. Okay, now let's get the program pushed to the Arduino. In order to do that you will want to verify the code first! This is very important in my opinion so you can make sure all mistakes are corrected. Again, you...
Read more »