Where is the zip libraries?

I am new on Arduino, I bought the Elegoo starter kit. It included what looks like the UNO R3 board. I downloaded the Arduina IDE 2.21 and installed on my Win 11 laptop. So far, I have the LED blinking and I can change the speed by changing the delay.

I am following the instruction by Elegoo, they talked about including zip library. I search and I could not find any zip library. Does IDE 2.21 comes with any zip library?

Does Arduino has working example of IDE 2.21 using UNO R3 board? I am using the instruction by Elegoo, I don't trust it as much as if it's from Arduino.

Thanks

1 Like

Welcome to the forum.

If you can blink a led, then the path from source code to a working Arduino board is okay. You are doing well :smiley:

But what you should not do is to drag in dirt into your Arduino environment. Keep it clean :broom:
Use the "Library Manager" on the left to find a library. Ask us which library is best to use.
The "Library Manager" is the picture with the books on a shelf.

That Elegoo starter kit comes with very old libraries. There is probably a zip file somewhere. Please stay away from it. Don't download it, don't use those old libraries.

The Arduino IDE has examples in the menu. If you install a library, then the examples from that library are also in that menu.

1 Like

Thanks Koepel

I found the library(like book on the shelf). There's a lot!!! So just ignore what Elegoo said the zip file.

While I have a thread, I have other questions.

  1. I read the schematic of the UNO R3, it actually using ATmega16 to interface with USB, then communicate to ATmega328 using the 2 wire serial interface. I just want to verify that.

  2. I am more the hardware person, is it true when I hit the "-->"(Upload) arrow, the IDE actually write into the programming Flash and run the program?

  3. In the blinking program, there are sub program like pinMode(LED_BUILTIN, OUTPUT), digitalWrite(LED_BUILTIN, HIGH) etc. There is no explanation where it came from. Where can I find more information of these? Like where they come from, I don't see any #include in the program.

Thanks

Elegoo distributes a large bundle of resources to accompany the starter kit. I seem to remember some users reporting the kit even includes a CD with the files.

The resources include ZIP files of the libraries required by the tutorial sketches. You can install those using Arduino IDE's "Add .ZIP Library..." feature, which is documented here:

https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries#importing-a-zip-library

(those instructions apply to Arduino IDE 2.x as well as 1.x)

I think Koepel gave you good advice. However, I will add that, in the specific case of following the Elegoo tutorials, it might sometimes make sense to install the libraries they provide via those ZIP files. The reason is that libraries can change over time due to ongoing development, so the latest version of the library might not be compatible with the Elegoo tutorial sketch that was written years ago for an older version of the library. The ZIP files should provide the versions of the libraries the tutorial sketches have been verified to work with. But using old versions of libraries should generally be avoided because it means you miss out on all the important fixes and advancements the library author might have made since. Library Manager will give you the latest version, and also allow you to easily keep the library updated as the developers make new releases.

2 Likes

I prefer that you ask us, and don't install old and outdated libraries. For example, if you have a I2C display or a sensor, then ask us for nice examples and good libraries. You don't have to follow the instructions by Elegoo. You are now in the Arduino world, use your imagination :wink:

The Arduino IDE has some libraries included and bugs are being fixed. It is better to always use the newest version of the Arduino IDE and the libraries, even though an old sketch might have to be fixed for the new situation.

Answers.

  1. Arduino is open-source. The schematic is here: https://store.arduino.cc/products/arduino-uno-rev3. The usb-serial chip is the ATmega16U2 (not a ATmega16). Clones have often other usb-serial chips. There are also Arduino boards that have usb hardware inside the processor, those don't need that usb-serial chip.
    The usb-serial chip is seen by the computer as a UART serial port. The usb-serial chip has RX and TX signals to the ATmega328P to upload a sketch and for the Serial Monitor.

  2. Yes. Correct.
    In the menu: "File / Preferences" you can turn on "verbose" mode for the compiler and for the uploading. That will show a lot of information. I keep it on, so I see the uploading process.

  3. Those are called "functions". The 'C' and 'C++' language have no function to make a pin high or low. The Arduino environment has a standard way to do that.
    Arduino is open-source, you can find it online.
    Reference: https://www.arduino.cc/reference/en/
    Click on a function to see what it does, many have a small example sketch.
    It might be a bit overwhelming, but if you know half of those functions, then Arduino is fun to use.
    In detail: Arduino has a pre-processor that adds the "#include <Arduino.h>" for you, among other things. You don't need any "#include" for the basic Arduino layer.

If you are a hardware person, then the servo motor would be nice to try. Arduino has a "Servo" library. Here is an simple example: https://docs.arduino.cc/learn/electronics/servo-motors

1 Like

Thank both for helping. I am going to spend time reading over this and experiment a little on library stuff. At the mean time one more question about this UNO R3 board:

This is only a kit, partly for me to get into writing firmware, but more importantly, I want to play with my grand daughter, she's going to college next yr. I want to let her have a taste on firmware. She's a straight A student, she has not have a CS class yet, but she's studying a lot of AP classes in Calculus, Physics. So this likely not too much for her.

As for myself, I have every intention to design circuits using the ATmega328. I will be doing my own pcb and all. I have a feeling that this Elegoo kit is not going to get me there. I need to be able to program the ATmega328 to do things not in the kit. I need to be able to program the chip, then plug into my pcb.

My question is what is the best way to program ATmega328? Do I need to buy a special pcb from Arduino to do it? Or do I just put in a SPI connector and just plug the cable onto the pcb to program the MPU?

If SPI programming is the way to go, what hardware I have to buy so I can program directly from my laptop. I assume it's through USB port also.

Thanks

1 Like

The best way is to use the Arduino board as it is. If you want something smaller, then there is the smaller "Nano" family of boards.

You don't have to create your own PCB, but you could make an add-on shield that you attach to the Arduino board, or a separate PCB board that you connect to the Arduino board.
We see a lot problems with own PCB designs on this forum. The most common problem is missing decoupling capacitors, or a missing diode at the reset pin or a long path from the crystal/resonator with its 22pF capacitors to the chip.

There are two ways to put firmware in the ATmega328P:

  1. Via the usb-serial chip (to RX and TX of the ATmega328P). We call that "uploading a sketch" or just "Upload". The Arduino IDE communicates with the bootloader in the ATmega328P and the bootloader programs the Flash with data from the usb-serial communication.
  2. Via the ICSP connector. You need a programmer for that, for example a USBasp stick. The Arduino IDE can use a programmer to put a sketch in the Arduino board, there is a "Upload Using Programmer" in the menu. The bootloader will be removed. You can put the bootloader back in the ATmega328P with "Burn Bootloader".

Please make your first project with a normal Arduino board. That makes a project so much easier and easier to maintain. If something goes wrong, then you can replace the Arduino board to check where the problem is.

I have used a ATmega chip on its own in a project, but that was wrong.
In one project, I have the RX and TX on a connector and I can upload a sketch with a usb-serial module. However, when I want to upload a sketch, then I can not find that usb-serial module.

Beginners tutorials by BasOnTech: https://www.youtube.com/watch?v=PcusGFga46U

2 Likes

Hi Koepel

I need the ATmega328 in specialize design. i did a lot of pcb, I was an analog/RF engineer for my whole life with a few yrs of designing mix signal using different MPUs before, this is nothing new hardware wise, I know all about signal integrity and all that, that's my specialty.

I just have to find a way either have a pcb to upload program and plug the chip into my real circuit. Or put a connector onto my circuit and program with a cable. We did these before. I had my engineer wrote the firmware after I design the whole circuit.

Now that I retired, I don't have an engineer to write it for me, so I have to learn the firmware part.

Thanks

It is either via the bootloader or the ICSP header.
A third option is uploading a sketch to Arduino Uno and then placing the ATmega chip on your PCB, but then it is not easy to make many changes.

The best option is up to you.

Thank you for the explanation, I have little knowledge about PCB design and even less about RF circuits. The ATmega328P runs only at 16MHz. You could show the schematic to us before making the PCB. There are bad examples online that have 5V connected to AREF, but that is wrong.

1 Like

Thanks Koepel

That is helpful, I have the schematic of UNO R3 board, the ICSP header is exactly what I am hoping. If you look at the signal connection, it's the SPI port with SCK, MISO, MOSI connections directly to the ATmega328 SPI port.

I cannot afford to put the whole UNO R3 board onto my circuit, my whole circuit is not bigger than the UNO and I have a lot more stuff on it. UNO is a demo board wasting a lot of space on all those connectors and LEDs and all that. ICSP connector is perfect.

Now the question is do they sell the interface board so I can connect to USB of my laptop on one side, then the ICSP cable to my pcb to program the ATmega328 on my board? I think Arduino sell this, just want to know the exact part I need to order and whether the ISP 2.21 can interface directly with that. These are the kind of info I have no idea and I never done this before.

Thanks

You need a "programmer".
I have a USBasp stick that I mentioned before. Together with a 10-pin to 6-pin adapter and a cable. It is often sold as a complete set.
They are cheap, and you get what you paid for. An old version did no longer work, and there could be trouble with timing.

You can see in the menu of the Arduino IDE which programmers are supported, menu: Tools / Programmer
Maybe you have already one of the programmers. It is even possible to use an Arduino Uno as a programmer with a special sketch. But that is clumsy.

There was a programmer called "ArduinoISP" once, but I can not find it.

1 Like

Thanks Koepel

I search, there are A LOT of them!!! Really cheap also. Are they all supposedly working with Arduino IDE 2.21? Just connect USB to the unit and 6pin connector to SPI port of the ATmega328?

On the UNO R3 there is an ICSP 6pin connector from the ATmega16U2(the USB receiver). Is that working as USB to ISP converter? That I can use that to program ATmega328 with 6pin ICSP connector? Then I don't even have to buy one!!

That would be too easy!!! :rofl: :rofl:

My first project is just to design a control unit for my hifi power amp. I design extreme high end hifi power amp as hobby. So far, I just buy the remote volume control on ebay. I am hitting the ceiling of the amplifier part, My next project is to design my own control using ATmega328. It should have volume control( just driving a motorized volume pot), switching inputs and mute and maybe some other experimental things. So I really just need to set up the B, C, D ports. Simple.

Now, I just go through the Elegoo kit to get familiar with it. I used to write assembly for Z80, I had to do everything. Looks like it's a lot easier today with all the libraries. Funny all these years working, now I am like a beginner starting all over from day one on this.

Thanks

Yes.

No, that is to put the firmware into the ATmega16U2.

The Arduino Uno as ISP (as programmer) is done by putting a sketch in the ATmega328P to make it act as a programmer. After that, it can be used as a programmer.

Using an Arduino Uno as a programmer is not easy, it is clumsy :face_with_raised_eyebrow: A mistake is easily made.
Here is the Arduino tutorial: https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP
I think that Nick Gammon's tutorial might be helpful as well: https://www.gammon.com.au/bootloader

Do you want to see something funny ? ServoOverdone.ino - Wokwi ESP32, STM32, Arduino Simulator
Start the simulation with the start button in the middle-upper of the screen.
The Wokwi simulator has a "Library Manager" just as the Arduino IDE and it uses the same list as the Arduino IDE. It can simulate the ATmega328P very good, the simulation is clock accurate and even the internal temperature sensor is simulated.

1 Like

Thanks Koepel

I was just asking about using the UNO R3 as programmer. I am not going to go through trouble to force to use it. It's so easy to buy one cheap.

This is all new for me, I have a full plate already, forget using the UNO.

I just play with the Elegoo kid to get familiar, then learn using the USB ISP programmer later for my project.

Thanks

Hi Keopel

The UNO R3 has ICSP connector to the ATmega328. Can I program it with a USB-ICSP board instead of using USB connect directly to the UNO R3? If so, I can just buy an USB-ICSP and work with that to get use to it.

Thanks

Sure, you can do that, but then you miss the Serial Monitor.
In a sketch you can send (debug) messages, and values of variables, to the Serial Monitor.

void setup()
{
  Serial.begin(9600);
  Serial.println("Barometer sketch");
  Serial.println("Version 523.4");
}

The Serial Monitor is part of the Arduino IDE. In the Arduino world it is almost essential for writing a sketch.
How can you tell if your Arduino board is in a reset loop due to something that draws to much current ? If you have the Serial Monitor and it keeps sending the messages from setup(), then you know that it is resetting.

1 Like

The Koepel

I don't mean to do everything with the programmer. I am just thinking when I work on the real project, I have to program with the USB-SPI programmer, I need to get familiar with it first. Or else, if things don't work, I have no idea whether I did something wrong with the programmer or something wrong with the program. I just need to do it to work out the kinks first.

I went to Tools/Programmer and picked "USBtinyISP". Somehow, it still can program the UNO from the USB cable. What is the default setting for connecting USB directly to the UNO board?

Thanks

The IDE ignores the selected programmer when you upload over USB. So it does not matter what you did select.

The settings that are used for upload over USB are read from file (boards.txt). It depends a little on how you installed the IDE where that file is.

On my Windows system (using IDE2.x), I can find boards.txt at C:\Users\Wim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\boards.txt; this path will also apply if you updated the AVR board package in IDE1.x.

If you want to buy a programmer, Pololu USB AVR Programmer v2.1 is one of the most flexible ones. Those that have one swear by it. Except for a programmer, it also provides you with a TTL-to-USB converter for e.g. use with e.g. Pro Minis or providing a second serial interface to a PC.

2 Likes

Thanks Sterretje

I can't find board.txt, where can I download this?

Also, how can I single step the program in IDE 2.21? Anyway to display the value of the Ports?

Thanks

It will be at the path already mentioned by sterretje, except the Wim folder in sterretje's path will instead be whatever your Windows username is:

C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\boards.txt

It is possible to do so with the Uno R3, but this would be a very advanced endeavor. If you really want to give it a try, you might be interested in the information provided here:

It is well supported for other boards though through the Arduino IDE 2.x integrated sketch debugger. You can learn about using it from this tutorial:

In addition to the official boards mentioned in that tutorial, debugger support is also available when using the boards of some 3rd party platforms, including:

2 Likes