Why buy the Arduino? - Page 1
Forum section: electronics / beginners

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 10, 2023, 10:55:14 pm
content: Hi, my experience in this world of electrons stops at some occasional repairs (any device...). My equipment is this: oscilloscope, multimeters, soldering iron, signal generator, component tester, assortment of SMS and THT components, breadboard, microscope.I've never dealt with microcontrollers, but I might start with them.I ask you: is it recommended to start studying Arduino for example to enter the world of microcontrollers?Could you help me make better repairs in the future?What Arduino model could I get? Arduino uno R3? R4?In addition to the Arduino, would it be necessary to purchase anything else to be able to use it? (components, jumkpers and breadboard I already have them).Thank you

author: BillyO
author_rank: Super Contributor
timestamp: November 10, 2023, 10:57:06 pm
content: What programming languages do you know?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 10, 2023, 11:00:39 pm
content: Quote from: BillyO on November 10, 2023, 10:57:06 pmUnfortunately none. I have never had to deal with any programming language. For example, an EPROM is a mystery to me for now. But I would like to start somehow, it could always help me in the future.Thanks

author: retiredfeline
author_rank: Frequent Contributor
timestamp: November 10, 2023, 11:09:41 pm
content: It's not a bad choice. It has a well-developed ecosystem. I'd go for the Uno or workalikes. You'd need some peripherals if you want to do anything more than blink the onboard LED. I'd recommend getting a breadboard and then wiring up the Arduino to whatever you like on the breadboard for experiments.C++, or just C is not bad as a programming language in many ways. It's close enough to the metal that you can see what's going on.Expect to outgrow it some day. That's not a bad thing.

author: BillyO
author_rank: Super Contributor
timestamp: November 10, 2023, 11:10:20 pm
content: Quote from: CharlotteSwiss on November 10, 2023, 11:00:39 pmWell, Arduinos and a host of others use C and/or C++. These are not the most beginner friendly languages and may just make what should be a pleasant experience a mire of frustration instead. For people that do not have a good programming background I usually recommend PICAXE microcontrollers. They use a language called BASIC that is easy to learn and will get you used to procedural programming and logic based control. The PICAXE microcontrollers themselves are plenty capable of dealing with a variety of sensors and actuators so that you can pick up the concepts quickly. If your requirements eventually go beyond their capabilities you will like have a good enough grounding in the fundamentals to decide which platform to up-grade to.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 10, 2023, 11:21:33 pm
content: Quote from: retiredfeline on November 10, 2023, 11:09:41 pmI already have the breadboard, for now I was only using it for experiments with components (except microcontrollers). Thanks for your suggestions.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 10, 2023, 11:27:16 pm
content: Quote from: BillyO on November 10, 2023, 11:10:20 pmI have already heard of the Basic language, and also of C++. I would have liked to start with Arduino, because here in my area I often hear about this programmer. The resources available are also countless. Of course, if it were too difficult, as you said, it could be an obstacle rather than an incentive to continue... I'm undecided. As always. Thank you

author: BillyO
author_rank: Super Contributor
timestamp: November 10, 2023, 11:40:34 pm
content: Here is the simplest example using possibly the most easy to understand construct in C and one of the more complex in BASIC. They do the same thing. See which you find easier to understand keeping mind BASIC get's no more complicated, but C can get very much more obfuscated.In C:Code:int i;for (i = 0; i < 5; i++) {printf("%d\n", i);}In BASIC:Code:For I=0 to 5Print INext I

author: brucehoult
author_rank: Super Contributor
timestamp: November 10, 2023, 11:52:18 pm
content: Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pmArduino is absolutely a great introduction to microcontrollers, especially for non-programmers.You can get up and running and blinking an LED or printing "Hello World!" to the IDE's built in terminal emulator in ... five minutes.An Uno R3 or cheaper clone (ELEGOO are good) will take you a long long way, and will work with the greatest range of tutorials and example code. The 32 KB code size and 16 MHz are seldom limiting, the 2 KB of RAM can be. A Mega2560 has the same ISA and works with pretty much all the same tutorials/code but increases RAM to 8 KB (and code size to 256 KB) and almost triples the number of I/O pins (from 19 to 54).There are other far more powerful chips/boards that are compatible with the Arduino IDE and code, up to e.g. the $20 600 MHz 1 MB RAM Teensy 4 (pretty old now ... probably supplanted) but with an Arm CPU instead of AVR a beginner will hit more snags following tutorials.You'll also want to have a good selection of LEDs, sensors, switches etc to connect to those I/O pins. There are starter kits with that stuff but it sounds as if you already have a lot of general electronic components."595" shift registers are handy for expanding the number of outputs.

author: retiredfeline
author_rank: Frequent Contributor
timestamp: November 10, 2023, 11:57:16 pm
content: Affinity with programming languages is idiosyncratic. Some people take to them like fish to water and learning yet another language is easy. Some people struggle with them. Give it a go and find out.

author: Manul
author_rank: Super Contributor
timestamp: November 11, 2023, 12:39:49 am
content: I think classic Arduino UNO is absolutely the way to go. Don't be scared of programming. It's true, that C programming language is not the most easy in the world, but it's not that hard either and it's still kind of a standard in the industry, so what you learn will be a good investment.Furthemore, there are so many Arduino examples and libraries available online, that it's possible to do many things almost with zero knowledge. Later you may play around, modify these examples, adapt to your needs. After some time you should be able to write code all by yourself. Not a rocket science.

author: donlisms
author_rank: Frequent Contributor
timestamp: November 11, 2023, 12:50:26 am
content: I would suggest, no matter what direction you, that you read lots of code. Read lots and lots and lots of code. Try to get to a point where you can read it, understand what it does, and evaluate it, to decide for yourself whether it's good code or bad code, and whether you can think of a better way to do it - because lots of the code you read will be... improvable! So... what makes good code?

author: xrunner
author_rank: Super Contributor
timestamp: November 11, 2023, 12:52:52 am
content: Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pmOh gosh you'll be just fine.Like others have said, yea go for an Arduino. With the equipment you have you can check voltages and view output signals. Once you wire up a simple LED and flash it, you will "get it" and then there's almost no limit to what you can do.

author: pqass
author_rank: Super Contributor
timestamp: November 11, 2023, 01:06:49 am
content: If you're totaly unfamiliar with C-language, you can start with an introductory tutorial and practice with a compiler for your PC (Windows, MacOS). Startherefor the C language primer.Then graduate to the Arduino IDE and the UNO hardware. Startherefor an Arduino primer. Also, there are a plethora of examples available via IDE menu: File->Examples->01 Basics, 02 Digital, etc.The PC C environment vs. the Arduino C environment differ in the built-in and installable libraries that are native to each. That is, which functions are available for your program to call. eg. You can blink an LED on an UNO but not* a PC.* without custom hardware

author: schmitt trigger
author_rank: Super Contributor
timestamp: November 11, 2023, 01:10:37 am
content: I also started first with the PICAXE. And still use it sporadically whenever one requires something very simple. But it uses interpreted BASIC, it is slow, compared to other platforms.The Arduino is a step forward.

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 01:26:10 am
content: PICAXE, even the faster chips, are much slower than an Arduino but even that can make things difficult for a fresh beginner.Anyway, it looks like "run" before you learn to "walk" is the advice here.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 01:31:19 am
content: Quote from: BillyO on November 10, 2023, 11:40:34 pmWithout a doubt, Basic is much more intuitive. But the question is: how widespread is the basic language on the platforms and how widespread is the C language?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 01:39:11 am
content: Quote from: brucehoult on November 10, 2023, 11:52:18 pmSo would it be appropriate to get an Arduino Mega instead of the Uno? I'd rather get the original, not a clone. I have hundreds of LEDs and switches, but I have practically none of the sensors. Thanks for the contribution

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 01:47:29 am
content: Quote from: CharlotteSwiss on November 11, 2023, 01:31:19 amThere are other things in play, The language is not a fundamental thing about embedded controllers. There are far more important concepts to become familiar with. Tripping over a cryptic language that gives you plenty of rope to hang yourself with is probably not the best approach to learning those fundamentals.This is the very reason we learn 1+1=2 before we jump into calculus and Reimann geometries.

author: Manul
author_rank: Super Contributor
timestamp: November 11, 2023, 01:48:30 am
content: C is widespread, basic - I don't know exactly, but not really, it was widespread in 80's and 90's. C is really a standard for any MCU programming. And it's not that hard. In the end of a day, language is not that important, it's the thinking that matters.https://medium.com/the-andela-way/forget-the-syntax-its-the-logic-that-really-counts-df722cdabe98But given that we all value our time, making good investments with our time is somewhat important, so I would choose to learn language which is popular, widely recognised and has future.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 01:49:27 am
content: Quote from: Manul on November 11, 2023, 12:39:49 amAs I had already said, my attention to the Arduino came from the many resources available. I see you recommend an Uno R3. Thank you

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 01:52:59 am
content: Quote from: donlisms on November 11, 2023, 12:50:26 amA lot of water will have to pass under the bridge before Charlotte can improve a code...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 02:01:20 am
content: Quote from: pqass on November 11, 2023, 01:06:49 amThanks for your suggestions. So if I understand correctly, the Arduino is the hardware, while when you talk about IDE it would be the software. I will read the resources you linked

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 02:08:36 am
content: Quote from: BillyO on November 11, 2023, 01:47:29 amIt's not my intention to run. My study in the world of microcontrollers will last a few years, without haste. Perhaps I should add the reason that approached me to Arduino. I would like, where possible, to be able to read some EPROM of some device, to be able to make easy changes. I read that the Arduino also allows this (as do many other programmers).

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 02:09:46 am
content: Quote from: CharlotteSwiss on November 11, 2023, 02:01:20 amArduino refers to the platform. This includes the IDE and the I/O mapping and some other concepts. It includes the hardware, but only if it has been adopted into the platform. Currently there is a bunch of varied hardware included in the Arduino platform.

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 02:12:54 am
content: Quote from: CharlotteSwiss on November 11, 2023, 02:08:36 amThere is not a MCU platform I am aware of that will prevent you from reading an EPROM. BTW, I think you mean serial EEPROMs. Unless you want to deal with ancient UV erasable chips and specific programmers.

author: Manul
author_rank: Super Contributor
timestamp: November 11, 2023, 02:20:32 am
content: Quote from: CharlotteSwiss on November 11, 2023, 01:49:27 amMega is also a fine board, but UNO R3 is the most popular and mainstream. Although there aren't many practical differencies. I would probably recommend to stay away from newer, more complex boards with ARM for now.At some moment you will run into a dilemma of IO voltage levels. UNO and Mega works on 5V and generally all periphery is required to run on 5V. There are boards which work on 3.3V. Depending on what you try to interface to, level translation might be a problem and it is really anoying. But for a beginner, 5V classic board is perfect.Quote from: CharlotteSwiss on November 11, 2023, 01:52:59 amWho knows, Charlotte seems to be able to write coherent posts, maybe she will also write good code. To be honest, some of Arduino code floating online is so crap, that it can be improved by cosmic rays randomly flipping bits.

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 02:22:45 am
content: Quote from: Manul on November 11, 2023, 02:20:32 amSo true.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 02:28:33 am
content: Quote from: BillyO on November 11, 2023, 02:12:54 amI wanted to be able to read the code of an integrated circuit. The idea came to me from a topic on this forum, where they had modified the display visibility of a UNI-T multimeter.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 02:34:39 am
content: Quote from: Manul on November 11, 2023, 02:20:32 amCharlotte had only opened that famous topic about choosing an oscilloscope for a woman. It was a long speech...

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 02:35:46 am
content: Quote from: CharlotteSwiss on November 11, 2023, 02:28:33 amOkay. That would either be a serial eeprom or serial flash memory. probably the later as each byte is independently alterable. These sorts of chips use either SPI or IIC serial interfaces. I don't know of an MCU that won't handle those so you are not hardware limited here.

author: Manul
author_rank: Super Contributor
timestamp: November 11, 2023, 02:45:17 am
content: Quote from: BillyO on November 11, 2023, 02:35:46 amAlthough in this case, a "universal programmer" thingy like TL866 with various adapter boards is much easier. It has different voltage levels, IC verification and all that jazz.

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 02:47:35 am
content: Quote from: Manul on November 11, 2023, 02:45:17 amTrue. And it will handle old UV erasable EPROMS ..

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 03:27:35 am
content: So guys, with Arduino it would still be possible to read the eeprom of an integrated circuit. Ok, with a programmer it will also be easier, but the Arduino also does other things... But out of curiosity, will you need particular adapters or sets mentioned above to read the eeprom of an integrated circuit via the Arduino? Thank you, goodnight (it's late at night here, almost morning)

author: themadhippy
author_rank: Super Contributor
timestamp: November 11, 2023, 03:28:22 am
content: Theres also the simulation option likehttps://sites.google.com/site/unoardusim/homei find it useful for getting the basics down and tested.

author: BillyO
author_rank: Super Contributor
timestamp: November 11, 2023, 03:38:54 am
content: Quote from: CharlotteSwiss on November 11, 2023, 03:27:35 amIt's getting complicated. If the eeprom/flash is soldered to a PCB, you will need to access it's serial pins. In some cases this requires you to cut traces on the PCB and re-connect them after alterations are done. I did this recently with a laptop to clear the security passwords. In other cases there may be programming/reprogramming headers or allowance for them on the PCB. Then you need a cable from whatever you are using as a programmer, whether that is and Arduino or a proper programmer, to the header on the PCB. Finally if the ROM (whatever kind it is) is in a socket it can be removed and put into a purpose built programmer adapter then into a programmer. However, if you are using an Arduino you'll need to fabricate something using a socket break-out board.G'night.

author: JeremyC
author_rank: Regular Contributor
timestamp: November 11, 2023, 04:13:04 am
content: Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pmCharlotte, you should check Paul McWhorter's Arduino tutorials:https://www.youtube.com/playlist?list=PLGs0VKk2DiYw-L-RibttcvK-WBZm8WLEPFor ~$35.00 (Amazon US) you can get "ELEGOO UNO Project Super Starter Kit", it includes everything what you need:https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4/ref=sr_1_3?keywords=arduino+starter+kit&qid=1699674949&s=electronics&sr=1-3I know you're in Switzerland, but the link may give you some ideas.

author: brucehoult
author_rank: Super Contributor
timestamp: November 11, 2023, 05:17:16 am
content: Quote from: CharlotteSwiss on November 11, 2023, 03:27:35 amA parallel bus eprom such as used with the 6502 or z80 can easily be read by an Arduino by outputting the desired address bits on (e.g) 12-16 I/O pins for the address, outputting signals for CS and R/W and clock on another few I/O pins, and reading the output from the eprom on 8 more I/O pins.This seems likely to stretch past at 19 I/O pins available on an Uno (without expanding I/O using e.g. 595s), but is well within the 54 I/O pin count of a Mega. Recall that the 6502 and z80 came in 40 pin DIPs.Perhaps watch this video to understand how to use an Arduino is this kind of way (here to read data from a 6502, not to supply data to one, though that is a small modification):He sensibly uses a Mega. You can substitute one for an Uno in 99.99% of cases. It's just got more flash, RAM, and IO but essentially the same CPU.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 11:49:17 am
content: Quote from: themadhippy on November 11, 2023, 03:28:22 amThanks, really interesting

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 11:54:31 am
content: Quote from: BillyO on November 11, 2023, 03:38:54 amVery clear and quite complicated. It might be enough to solder a cable to the serial tracks to be able to read the memory.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 11:56:33 am
content: Quote from: JeremyC on November 11, 2023, 04:13:04 amI've seen that kit on Amazon for a while. It seems very complete. I imagine the Arduino hardware is identical to the original, just rebranded.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 12:15:58 pm
content: Quote from: brucehoult on November 11, 2023, 05:17:16 amAfter seeing this video, I think I'm not up to the task of interfacing an eeprom with the Arduino. I envy the ease with which the author used the C language.At this point I'm not sure how useful the Arduino could be for my purpose. Ok I understand playing with kit sensors, but in reality?I will never program anything new, I was hoping to use it to solve some existing problem (in a repair for example).I felt like I was flying with my imagination, I came back with my feet on the ground...

author: Manul
author_rank: Super Contributor
timestamp: November 11, 2023, 12:17:02 pm
content: In you first post, there was no emphasis on chip reading. Now after the situation became more clear, I would suggest you get both the Arduino board and Universal Programmer. Arduino is really useful and educational, you can have lots of fun making various things with it. But for reading and writing memory chips, in many cases it's not really a tool of choice, espessially for a beginner. It's like when you use knife edge instead of a screwdriver, you know what I mean.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 12:21:55 pm
content: Quote from: Manul on November 11, 2023, 12:17:02 pmYou're right, I didn't mention the reason for the Arduino's involvement. It all started after seeing that in a topic here on the forum they had modified the eeprom of a Uni-T 139 multimeter, making the display more visible. As I wrote in the previous message, I still have to understand what use I could have from an Arduino.A universal programmer would perhaps be a good purchase, which I could use in the future. Would one programmer be better than another for a beginner? Thanks.However, the interest in the Arduino remains!

author: Manul
author_rank: Super Contributor
timestamp: November 11, 2023, 12:34:23 pm
content: Quote from: CharlotteSwiss on November 11, 2023, 12:15:58 pmYou simply got overwhelmed by seeing too many things you are not familiar with in rapid succession. Happens to all of us, no matter our level. Just relax and don't overthink, some things are not that difficult as they look at first glance, but you can't leap, you need to aproach things step by step. In any case, hobby electronics is meant to be enjoyed. Arduino board does no cost much, get it and play around.Quote from: CharlotteSwiss on November 11, 2023, 12:21:55 pmWell, I don't know, I have TL866II (from autoelectric), it worked great so far. There are newer models available. Beware that some might be counterfeit / clones, so look for a trusted seller.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 12:47:57 pm
content: Quote from: Manul on November 11, 2023, 12:34:23 pmThe Arduino will take it anyway, it has a low cost and will certainly be my step forward in the C language (obscure for me at the moment).The programmer I see that on Amazon they sell the tl866II plus model (even if the price is quite high, but it is complete with adapters). Thank you

author: RoGeorge
author_rank: Super Contributor
timestamp: November 11, 2023, 01:10:50 pm
content: - Why buy the Arduino?- To blink the LED.I like Arduino nano, cheaper and it occupies less space than UNO.https://duckduckgo.com/?q=arduino+nano&iax=images&ia=imagesNano cost only $2-3 or so, have the same MCU as an Arduino UNO, with a few extra IO pins. Another advantage is that Arduino nano can be inserted in a breadboard. Arduino Nano has the same features as an Arduino UNO.For more experiments, buy a sensor kit (e.g. the classic 37 in 1 Arduino sensors kit, the cheapest, without Arduino board).https://duckduckgo.com/?q=37+sensors+kit&iax=images&ia=imagesYou may need some DuPont patch wires, too, for interconnecting the modules with ease, and a laptop or a desktop, of course.Don't worry much about programming, at first you can run ready made programs and examples for that kit (or for other projects you may find online), then you can make small modifications to them while learning programing.

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 11, 2023, 01:30:44 pm
content: If you really want to use Basic, try the RP2040 and:https://github.com/bgolab/JustPicoBasic

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 03:05:04 pm
content: Quote from: RoGeorge on November 11, 2023, 01:10:50 pmNo, I had already flashed the LEDs on a broadboard without the Arduino ;-)The sensor kit is interesting.Maybe I would like more information on the cables needed with the Arduino: to carry voltage, what cables are needed? I don't think it's included with the card (I thought it was powered by 5V via the USB cable). If by Dupont cables you mean those used on breadboards, there are a few hundred of those. Thank you

author: RoGeorge
author_rank: Super Contributor
timestamp: November 11, 2023, 03:37:26 pm
content: Breadboard jumper wires usually have a round pin, and they are male-to-male only. Cheap version of them is to use the wires found inside CAT5 LAN cables:https://hackaday.io/project/7574-the-devil-is-in-the-details/log/25378-unlimited-free-supply-of-breadboard-jumping-wiresDuPont wires have a square pin, and they can be male-to-male, male-to-female, female-to-female.https://duckduckgo.com/?q=dupont+wires&iax=images&ia=imagesWhen aligned side by side, DuPont connectors have the standard 0.1 inch spacing.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 03:41:54 pm
content: Quote from: RoGeorge on November 11, 2023, 03:37:26 pmGreat, I already have the Duponts (a few hundred pieces, M-M, M-F, F-F).

author: rstofer
author_rank: Super Contributor
timestamp: November 11, 2023, 03:57:33 pm
content: I recommend starting the Arduino adventure with a Starter Kithttps://www.amazon.com/s?k=arduino+starter+kit+elegooCode is provided in a couple of languages and the kit is a giant tutorial for the most common attachments.I would definitely start with an R3. Using the same library functions and IDE, I can port most of my projects to an ARM processor like the Teensy 4.1 600 MHz ARM M7.https://www.amazon.com/s?k=teensy+4.1+breakout+board

author: adam4521
author_rank: Regular Contributor
timestamp: November 11, 2023, 04:57:53 pm
content: Arduino is a good choice because of the ‘ecosystem’. The R3 is ‘practical’. And there are a host of other boards designed to work with the Arduino IDE, but have specific features, speed, Wi-Fi, OLED displays etc, like Teensy and ESP32 boards. Other choices, not mentioned yet, are Raspberry Pi Pico, which can be programmed in micropython, and BBC micro bit, which has a number of sensors on board and possibly the easiest of them all for learning - although arguably the visual programming language ‘hides’ the event loop in a way that is not helpful for understanding how the program works.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 05:09:06 pm
content: Quote from: rstofer on November 11, 2023, 03:57:33 pmIs everything okay Rstofer?Oh yes, starter kit should be the first step into this new world

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 11, 2023, 05:11:52 pm
content: Quote from: adam4521 on November 11, 2023, 04:57:53 pmThanks for your analysis. Let's say there would be many alternatives, but I have to choose one. And perhaps Arduino was the most obvious.

author: RoGeorge
author_rank: Super Contributor
timestamp: November 11, 2023, 05:27:24 pm
content: Quote from: CharlotteSwiss on November 11, 2023, 05:09:06 pmWhat do you mean by that?You don't have to reply with something for each and every post, like it would be a chit-chat. Please keep it relevant and on topic. Also, talk about the ideas in the posts, not about the persons who posted them. If something looks unclear or way off, ask for clarifications.

author: MarkF
author_rank: Super Contributor
timestamp: November 11, 2023, 05:29:54 pm
content: I mostly agree with others here.- Start with the cheapest Arduino you can get.- Learn to program in C. Most microcontrollers are going to have a C compiler.- Get some of the basics under your belt.- Then quickly move away from ALL things Arduino if you really want to understand how microcontrollers work.The reason I say "leave Arduino behind" is because everything is wrapped with their libraries. Far from how the hardware works. You want the most direct path from line-of-code to MCU pin(s).I would suggest something like a 8-bit PIC from Microchip and a Pickit 3 to program it (maybe a pic16f886). There are other manufactures; but, you want the most basic microcontroller you can find. Here you will learn the basics of reading and writing to hardware registers. Their 8-bit MCUs are simple enough to understand the interaction between your program and the hardware functions.You will learn how to:- Setup the master clock- Simple read and write to I/O ports (blink that LED, read that switch)- Timers- Interrupts- ADC conversion- SPI and I2C protocols- PWM outputat a fundamental level.Sure. You can learn all these things with an Arduino. But, you will be talking to a bunch of libraries (not directly to any hardware) and the Arduino environment. You are shielded from the hardware. All the details of interfacing to a MCU are hidden from view allowing those with little knowledge to use them. Then when you move to a different microcontroller or FPGA, you will be in for a real shock.

author: themadhippy
author_rank: Super Contributor
timestamp: November 11, 2023, 05:34:26 pm
content: Arduino is the most common,and once you've got one you can easily build your own clones.However the pi pico is a lot cheaper , can be programmed in c, micro python or basic,you can even use one as a stand alone computer running basic without to much hassle and still have 13 io pins to play with.One thing to watch for with the pico is it runs on 3.3v so some of the sensors designed for 5v arduinos might not play nicely

author: brucehoult
author_rank: Super Contributor
timestamp: November 11, 2023, 06:15:08 pm
content: Quote from: MarkF on November 11, 2023, 05:29:54 pmArduino Uno r3 is far from the cheapest Arduino you can get. A genuine one is $35, good quality clones $12-$15. You can get Arduino-compatible boards with other CPU types for $2.However it is the best choice for a raw beginner because of its robustness and all the tutorials being based around it.QuoteI disagree.The Arduino IDE is limited but gets the job done. Sure, you can swap it for VSCode or Emacs or whatever, but that's pure preference with no relationship to understanding how microcontrollers work.The Arduino hardware is just fine.The Arduino library can get limiting, but you DON'T HAVE TO USE IT. Not even if you're using both Arduino hardware and the Arduino IDE. You can program in raw bare-metal C or assembly language and poke at CPU registers all by yourself if you want to.QuoteUgh ugh ugh. AVR is every bit as simple as PIC, but far nicer to program. PIC is total dark ages.Better to get the $0.10 WCH CH32V003 than PIC (boards from $1.50). Infinitely better 32 bit instruction set, and the registers are not hard to poke at. Or a Cortex-M0 board, such as the Pi Pico.QuoteAbsolutely nothing in either the Arduino hardware or IDE prevents you from avoiding the Arduino libraries and talking directly to the hardware.

author: rstofer
author_rank: Super Contributor
timestamp: November 11, 2023, 07:23:31 pm
content: Everything that can be done with an UNO R3 has been done and it's documented somewhere on the Internet.Sure, the Pi Pico with micropython has a more interesting ecosystem but you need to start somewhere.How about using the Arduino for the MNIST Digit Recognition project (machine learning)? The inferencing time of 7 seconds (If that is the total, not just one epoch) is faster than my Macbook Pro M2 at 8 seconds. The accuracy, at 83 percent, isn't worth writing home about because my Macbook gets 99.6%. Different mathematical approaches.Still, that's pretty impressive for an Arduino.https://blog.arduino.cc/2021/05/19/recognizing-handwritten-mnist-digits-on-an-arduino-uno-using-lognnet/https://arxiv.org/ftp/arxiv/papers/2105/2105.02953.pdf

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 12, 2023, 02:27:53 pm
content: Quote from: MarkF on November 11, 2023, 05:29:54 pmThanks, your contribution is interesting. Of course the Arduino will be the beginning, my entry into that unknown world. I'll learn the basics, then I'll try to look even further.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 12, 2023, 02:36:30 pm
content: Quote from: rstofer on November 11, 2023, 07:23:31 pmIn fact, I have to start somewhere, and Arduino offers many ideas on the web that can help me.However, I don't know if I will get the starter kit: I already have the components, cables and breadboard. I also see the lack of power supply for the Arduino. I don't like the idea of powering it with batteries. For me, it would be enough to have the Arduino (even a clone), the suitable USB cable, the suitable power supply. I could then maybe get the sensor kit. Thank you.

author: themadhippy
author_rank: Super Contributor
timestamp: November 12, 2023, 03:03:42 pm
content: Quoteif your only hanging a led or 2 from the ardunio the usb cable will be fine

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 12, 2023, 04:22:56 pm
content: Quote from: themadhippy on November 12, 2023, 03:03:42 pmBut for serious experiments I imagine that the USB cable is as limiting as power. For that I would like to get the appropriate power supply (I think 7-12v). Maybe I'll get the starter kit, but also a separate suitable power supply.

author: Manul
author_rank: Super Contributor
timestamp: November 12, 2023, 05:04:38 pm
content: Quote from: CharlotteSwiss on November 12, 2023, 04:22:56 pmUSB cable is generally enough (typically up to 500mA). Powering Arduino through it's DC jack is not really making it better, because on-board linear regulator might simply overheat, it's not really a solution how to get more than 500mA from 5V rail.General rule of thumb / best practice - if you have low current circuit like a microcontroller together with some high current circuit - use a separate supply for high current circuit.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 12, 2023, 05:20:16 pm
content: Quote from: Manul on November 12, 2023, 05:04:38 pmThank you. Then simply power the Arduino with the USB cable (via PC). Maybe they put the power socket to make the Arduino work when it is disconnected from a USB cable? Otherwise I don't understand why a VDC connector was added

author: xrunner
author_rank: Super Contributor
timestamp: November 12, 2023, 05:30:36 pm
content: Quote from: CharlotteSwiss on November 12, 2023, 05:20:16 pmSo you can power it from different power supplies as you choose. I had a N scale model railroad with a color billboard project I made that run from an Uno. I powered it from the 12V supply that also ran other types of scene elements on the table.

author: Bicurico
author_rank: Super Contributor
timestamp: November 12, 2023, 07:38:49 pm
content: I flash read this thread and I am not sure about the *real* goal of CharlotteSwiss...It seems that the goal revelead over three pages is something like: "I want to read an EEPROM, modify the content, in order to improve an existing product and I want to use an Arduino for that!".Here is my opinion, for what it's worth:1) An existing device does not have the firmware (FW) stored on an EEPROM, but rather a flash memory. You won't be reading the contents of a flash IC with an Arduino!2) The EEPROM of whatever device you want to modify will store data like serial number, software options, user configuration, calibration data, etc. It might be interesting to externally edit the EEPROM content, for example to activate some extra software options. However, you would just use a suitable EEPROM reader for that. You can get pretty good ones for a low price from China. Make sure to get propper desoldering equipment, since more than often, you won't be able to read the EEPROM content without removing it from the PCB.3) Even when you have a file containing a 1:1 backup of the EEPROM content, you will still have to understand what the data means! Normally, software options will be bit or byte encoded in the EEPROM memory space and many manufacturers will use a checksum to make sure the contents have not been tampered (I would). This means that you need to get hold of the FW and analyse it, so that you understand what the bytes in the EEPROM mean. Doing this randomly (changing random byte values) is not a good approach, because you would have to remove the EEPROM, erase it, program it and fit it back for every trial.4) Analysing the FW is a whole new project: you need to get hold of it by either extracting it from a FW update file (where the FW is normally encrypted) or extract it using i.e. a JTAG interface. Then you need to decompile it (using IDAPro, which is a commercial application, or Hidra, which is open source). Learning to use these tools is a journey that involves learning fundamentals in assembly/machine code.5) Programming an Arduino is fairly simple, especially if you understand the basics: variables, conditions and cycles. There are lots of tutorials and videos. What I dislike in your goal is that you have set the bar too high. Start with a simple project: some home automation. There are many projects you can reproduce and learn by doing it. However, you need to learn how to program and for that you do not need to buy anything! Just learn it on your PC.6) If you ask what language you should learn first, you will get as many answers as there are programming languages. Everybody has his own opinion on programming languages and most are correct. A collection of languages that might be interesting for you:- Visual C# or Visual Basic: great for Windows environment, easy to get an app with GUI up and running. You can use free versions from Microsoft for personal projects. Some people say that if you start by learning Basic, your mind get blocked and you will have a hard time to learn C/C++ afterwards. I do agree.- C or C++: not easy to learn, but if you master them, you are set for professional programming of low level and/or software requiring real speed. This knowledge can be used directly for microcontrollers. The really difficult part is the memory handling and getting a GUI to show up (in my opinion). Works on any modern OS.- Python and/or JavaScript: interpreted languages, that work in all modern OS and can be used for a lot of stuff, including web applications. I personally dislike Python, because the syntax is so cryptic and a space can make the difference between error or no-error.In the end, it depends on what you really want to do.But make no mistake: when you read on this forum about someone who hacked a device, by decompiling the FW and edditing the EEPROM to change the display type of a signal generator......you are in presence of awesomeness! To be able to do that, the person has to know so many different things and be extremely smart.Final tip: If you are in it to learning programming with some great reward and are able to spend 6-12 month learning it, I would strongly suggest to take a look at UNITY. This is a game engine, based on C#. Many commercial games are using it on all platforms and they have amazing learning content. I mean, it is absolutely mindblowing how good their courses are.And if you master it, you can easily find a job or start your own thing.Hope this helps.Regards,Vitor

author: brucehoult
author_rank: Super Contributor
timestamp: November 12, 2023, 10:06:17 pm
content: Quote from: Bicurico on November 12, 2023, 07:38:49 pmAssuming an external flash chip, whether parallel or SPI, I don't see why not. It's merely a matter of wiggling I/O pins appropriately. If there was a minimum clocking speed that could be a problem, but I'm not aware of any flash chip like that.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: November 13, 2023, 12:46:24 am
content: I did not read all comments, but agree with qpass and Manul. When you start with microcontrollers, you have a bunch of different things to learn:1. Learning the concepts of how a computer program work.2. Learning programming language (Syntax and such).3. Learning about the IDE (Integraded Development Environment) other tools, compilers, programming software)4. Learning the microcontroller, how the hardware works. (peripherals, I/O pins, current limits etc)5. Learning about libraries and such.All together it is quite a lot to take in."Arduino" is a platform / mix with a bit of all of the above, but I really dislike it for a bunch of reasons. First, it is not designed as an tool to learn "proper" programming. If you start with arduino you will very likely start learning bad habits you will have to unlearn later if you want to get further with programming. The java contraption they call an "IDE" in the arduino world is also a very sad kludge of an editor, although it may have gotten slighly less worse lately. It also attacts beginners, because it's (deceivingly?) simple to get a blinking led program running in arduino. As a result, millions of people are meddling in arduino without knowing what they are doing and that leads to the "crap" remarks from manul and BillyO. "Arduino" is also more into the money making buziness than in the "teaching buziness". It's so sad they botched everything by making a contraption that is somewhere halfway C and C++ and did not cooperate with for example CodeBlocks (which is a relatively simple, but usable IDE). I would never ever buy an "official" arduino board. For the rest, don't look too much at the price of micrcontroller boards. Another pitfall with "arduino" is that most people who like and recommend it very likely started with arduino themselves, and have never seen anything else. They just don't know any better. Those people seem to be the mayority and have made arduino ubiquitous.C and C++ (They are two quite different languages) are quite good programming languages. They have their faults, but each and every language that tries to be a "better programming language" has their own issues. They are also the standard for anything microcontroller related. If you start with C (or C++) then you are on the road to being able to program nearly all micrcocontroller family, regardless of who makes it. I would avoid BASIC. It's a language that should have died 30 years ago. If you start with basic, you get sucked into one particular dialect that is not compatible with anything else. The standardisation of C is a part of what makes it great. A library written for one microcontroller family, can be ported to another microcontroller family with relatively small changes (only the way in which the hardware is controlled has to be modified)If you want to learn some "proper" programming, then I recommend to start with a coarse in C++ and write some PC programs. Following a coarse helps getting structure into your learning and avoid the common pitfalls. Writing PC software also gives you much better and easier to use tools such as debugging. Single stepping though source code is a very good tool for learning how the concepts of programming work (but it is of limited use for debugging itself). And then, only if you are familar with the concepts of programming, start with some microcontroller board.For the hardware, I prefer the breadboard compatible boards. Those are the most universal to get started. There are some big "learning" boards (for example from MicroE) but I would rather have a breadboard and a few EUR6 boards that fit on it, than their USD400+ development boards. For the rest price is only of limited value. It really does not matter much if you buy a EUR2 development board or spend EUR8 on it. Maybe add an "arduino sensor kit" (Search Ebay/Ali/China) There are lots of variants from between about 40 and 80 small PCB's for an average price of less then EUR1 each. You probably won't use half of them, but the other half can give you weeks of fun with experimenting, and it's nice to have something to grab on to get started with an idea on a breadboard.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: November 13, 2023, 01:21:50 am
content: Addition:The MicroE boards are probably targeted at the educational market. Cost is less important (The students don't have to buy the hardware) but the students generally have very little time to tinker with a breadboard during the software/firmware part of the course. It's also nice for teachers and student to know that the hardware itself works.When you want to start programming with microcontrollers, I highly recommend to add a simple 8-pin logic analyser. They cost around EUR8 (From China/Ebay/Ali) and in the last few years sites like Adafruit (and resellers) have also started selling similar boards for around EUR20. These boards can be used with Sigrok/Pulseview, which is quite nice FOSS Software. These boards contain a Cypress Cy7C68013A and they can even be used as a development board themselves. But that processor has a very old 8051 core and it won't work with GCC, but you have to use SDCC (Small Device C Compiler) I do not use other compilers then GCC if I can help it, but it would still be nice if the buspirate software was ported to this thing.

author: brucehoult
author_rank: Super Contributor
timestamp: November 13, 2023, 01:41:32 am
content: Quote from: Doctorandus_P on November 13, 2023, 12:46:24 amI highly recommend making first steps into microcontrollers with Arduino. And then RISC-V if/when you outgrow it.I started with TI and HP and Casio programmable calculators in the late 1970s, then Apple ][ in 1980, DEC PDP-11 in 1981, VAX in 1982, Macintosh in 1984, Linux in the mid 90s.Also doing asm and hardware stuff with Rockwell AIM65 in 1982-4, and together with two friends designed from scratch (datasheets) and built a wire-wrapped M6809 with 64 KB RAM, a UART, and interface to some surplus 8" floppy drive in 1983.Arduino Uno was indeed my first introduction to microcontrollers, in 2011 I think, because for the first time you didn't need to spend hundreds of dollars for a dev board and programmer and thousands of dollars for a C compiler. (I saw BASIC Stamp before that, but that was simply a hard no).In 2012 I used an Uno, a thermistor, and a $2 433 MHz transmitter (and commercial 240V remote controlled outlet) to build a PID controller for my 2400W oil column heater, with different set temperatures at different times of the day. In 2013 I used a Mega to build a home-made 3D printer (using some 3D-printed parts I purchased on the internet).Arm and RISC-V microcontrollers have since become much more affordable and available and I primarily use those now.Kindly stop making insulting generalisations.

author: rstofer
author_rank: Super Contributor
timestamp: November 13, 2023, 02:19:51 am
content: The famous Ben Eater 6502 project includes an EEPROM programmer running off an Arduino Nano. I built it, it works.https://eater.net/6502The programmer is described on the github:https://github.com/beneater/eeprom-programmerI don't know anything about the specific application but for the 6502 project it is ideal. So, it can be done.Version 2.1.1 of the IDE is a whole lot better than the earlier versions. Other IDEs can be used and I almost like Visual Studio Code with the programmer add-in.The Arduino is an ideal beginner's setup primarily due to the hand holding and code resources. The Arduino is a great starting point. There will be others. There's a lot to learn but, like eating a whale, do it one bite at a time. Get comfortable in one platform and when it is no longer adequate, move up.

author: rstofer
author_rank: Super Contributor
timestamp: November 13, 2023, 03:54:46 am
content: Quote from: brucehoult on November 13, 2023, 01:41:32 amI agree.I started writing Fortran for an IBM 1130 in 1970.http://ibm1130.org/I've been doing something with computers for over 50 years. I got my Altair 8800 with 256 bytes of RAM in early '76 while still in grad school. I now have an FPGA implementation of the 1130 that runs all of the IBM code, unchanged. When I want something done quick, as opposed to elegant, I will probably reach for an Arduino. For high performance (all things are relative), I will probably reach for the Teensy 4.1.The Raspberry Pi has a lot to offer. The PiDP 11/70 uses simh on a Pi to simulate the real processor but a lot faster. I have a couple running BSD Unix with all the toys.https://obsolescence.wixsite.com/obsolescence/pidp-11There are starter kits for the Pi as well. It's kind of cool to develop the code on the runtime hardware. The Pi is another easy system to get into with all the demo code. Maybe a nice second step...

author: radiolistener
author_rank: Super Contributor
timestamp: November 13, 2023, 06:33:30 am
content: Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pmI recommend STM32, they are much faster than ATmega, much cheaper and have much more resources.If you don't want to spend much money, you can get bluepill (STM32F103C8T6) module, it cost about 1-2 USD. You're also needs SWD dongle. The ST-LINKv2 which is needed to program and debug code also cost about 1-2 USD. So you can spend just 3-4 USD to try it.

author: Andy Chee
author_rank: Super Contributor
timestamp: November 13, 2023, 06:40:47 am
content: Quote from: CharlotteSwiss on November 11, 2023, 02:01:20 amThere is a third category you might want to familiarise yourself with; firmware. Hard, soft, & firmFirmware as the name sounds, describes everything in between hardware and software.Unfortunately it can also be a bit of a grey zone when talking with other embedded system engineers. So it pays to be flexible about delineating categories.To use a simple example remote weather station; the thermometer, anemometer, 433MHz UHF transmitter and Arduino are hardware, the code inside the Arduino's program ROM/EEPROM would be the firmware, and the PC/Mac with the data visualisation graphing program is software.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 13, 2023, 07:58:39 am
content: I see two things here:1) Wanting to learn about microcontrollers.2) Wanting to modify existing systems to change some settings or behavior.For the first thing the Arduino system is a good option to get started and learn while playing. The range of hardware to play with is wide. Many different MCU's, or should I say boards, are supported by the Arduino system. AVR, STM32, Espressif systems and Raspberry Pico to mention the ones I know of. Also lots of libraries for the different sensor modules and displays that can be connected.But my advice would be to first read up on the logic of programming and how a processor works if you want more than just coding up some simple project. Search google for more information on these subjects.For the second thing I would say it is needed to get a lot of experience with programming and reading hardware before even attempting to hack some existing systems. It is not so simple and involves a lot of knowledge gathering about the system at hand. The type of processor used to be able to reverse engineer the firmware, the layout of the hardware to understand what the firmware does with it, figure out the meaning of the data in a parameter storage, etc. Even for experienced programmers it is quite the task and takes a lot of time to do such a thing.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 13, 2023, 08:37:55 am
content: One major problem with software development today is that many things are "built" by just finding existing libraries that seem to work, throwing them together, and then fiddling with small details until it all seems to work somewhat, and call it done. The Arduino environment somewhat encourages makers to do this too, which is why so much existing Arduino code is not that good; but the exact same thing actually applies to just aboutallprogramming languages currently.The exact opposite, "Not Invented Here" syndrome, rewriting everything oneself, is equally bad, because it is mostly a waste of time, as the end result is typically no better than what already exists. Somewhere in the middle is theeffectivepath; and a lot of shop talk between good programmers is discussing exactly where that effective path is.Thus, I'd say starting with an Arduino is a valid choice. Just don't get stuck into the mindset, and don't assume its imposed choices are the only ones, or the best ones, one can make.

author: rstofer
author_rank: Super Contributor
timestamp: November 13, 2023, 04:05:55 pm
content: Quote from: CharlotteSwiss on November 12, 2023, 04:22:56 pmI believe 9V is correcthttps://www.amazon.com/Arduino-Power-Supply-Adapter-110V/dp/B018OLRIf I use external power, I want to use a powered hub and draw no current from the PC. For simple 'show and tell' projects, USB power is adequate. A powered hub is good protection for the PC.You need to prove that you pin current doesn't exceed the rating and that the package current total doesn't either. Absolute maximum pin current is given in table 28.1 and hints are given in table 28.2 where IOLis spec'd for 5 mA when operating at 3V (or 3.3V). So, you want to limit pin current to around 5 mA. If the LED Vfis 2v then the resistor needs to drop (3.3 - 2)V at 5 mA or 260 Ohms. 270 is a standard value and is close enough. Yes, you should check the LED datasheet or a 'typical' datasheet or assume, for a RED LED that my numbers are close enough. You can always try 470 and 330 Ohms as they will force the LED to draw even less current.No, you can't hang even a small motor to the uC pins!https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdfA little light reading and you will soon see why having proven libraries is such a big deal. Remember, literally millions of people are using that Arduino library code.ETAFWIW, the Arduino designers use a 220 Ohm resistor:https://docs.arduino.cc/built-in-examples/basics/FadeMy 270 Ohm resistor would result in a little less current. Here's a good time to use your DMM and measure everything with the LED solidly ON an solidly OFF. A learning experience in the making. You can calculate the current by measuring the voltage drop across the resistor and then break into the circuit and measure it directly on the current scale.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 13, 2023, 04:32:14 pm
content: Quote from: xrunner on November 12, 2023, 05:30:36 pmOk, but wasn't it said that the Arduino can work with just the PC's USB power supply?Quote from: Bicurico on November 12, 2023, 07:38:49 pmThanks Vitor for your contribute.Exactly, my curiosity about the Arduino was to be able to modify an eeprom. But I have had an interest in the Arduino for a long time, it was a way to combine the two scenarios.In reality, as you said, I raised the bar when talking about eeproms to modify. I admit I don't even have the basics. So, now, I try to forget about FW and eeprom, and buy the Arduino to simply start understanding some basic steps of the programming language. Then maybe in the future I will be able to raise the bar by a few millimetres. Perhaps. Thank you so much for your analysis.Quote from: Doctorandus_P on November 13, 2023, 12:46:24 amI really appreciated your point of view, even though I have no experience to fully understand the content. As I said, I have never written any lines of programming, in any language. It's a new world for me. I don't really like starting straight away with too much 'theory', which may be difficult. This is why I asked for opinions on the Arduino. As you said it's quite popular, highly sponsored online, with lots of resources. Let's say it would be a way to start playing, trying to learn something easy. I would like to buy the sensor kit. It will be a new world for me. I hope to live there well.Quote from: Andy Chee on November 13, 2023, 06:40:47 amI have some experience with FWs, but only at the level of replacement (not modification). I had learned the hard way that a power failure during replacement often made the HW unusable (but once I changed the chip and I recovered the card).Quote from: pcprogrammer on November 13, 2023, 07:58:39 amAs already written above, I had read that here they had modified an eeprom of a multimeter. I thought it was an easy game. In short, I started out thinking I would drive a Ferrari, when instead I should start driving a tricycle!Quote from: rstofer on November 13, 2023, 04:05:55 pmThanks, actually it would be better to power the Arduino externally. As soon as I order it, I will see if I can also add the appropriate power supply (if I wanted, I could power it with my bench power supply, but I need that for other tests in the meantime).---------------------------To conclude: as I imagined there are many pro-Arduino users and many others who advise against it. Maybe I'll be wrong, but I'll have to start from some (easy) scenario, right?

author: xrunner
author_rank: Super Contributor
timestamp: November 13, 2023, 04:44:56 pm
content: Quote from: CharlotteSwiss on November 12, 2023, 05:20:16 pmQuote from: xrunner on November 12, 2023, 05:30:36 pmQuote from: CharlotteSwiss on November 13, 2023, 04:32:14 pmHmmm you aren't quite understanding me. Let me explain further. Yes you can power it from the PC USB port, as you sit there and develop an application. You might also have to have your breadboard with any electronics right near it also, as you are checking how your program runs and if the electronics you are wiring up to it are functioning correctly - LEDs, sensors, or whatever you are using..So far so good.Now, what happens when you are finished developing your application and the electronics are doing what you want? Is it going to sit right there at your PC, or is the project going to be finalized - that is, the electronics soldered up to a PCB, put in a project box with the microcontroller, and used elsewhere?As in my example, I had a project that was to be used at my model railroad table, which isn't anywhere near a PC. So, I need to power the Arduino project (this goes for any other microcontroller as well) at the point where it is used, whether it be batteries or a local power supply. Does that make sense now?

author: rstofer
author_rank: Super Contributor
timestamp: November 13, 2023, 04:55:44 pm
content: Quote from: CharlotteSwiss on November 13, 2023, 04:32:14 pmYou will have many opportunities to use that scope! The tone() function comes to mind.https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/BIG HINT - Make sure your Arduino uses the 28 pin dip chip because it is socket mounted. The SMD board is less useful. You can develop on the UNO and pop the chip out for use in your final project PCB.

author: Andy Chee
author_rank: Super Contributor
timestamp: November 13, 2023, 05:09:41 pm
content: My recommendation for an Arduino starter kit is this:https://www.freetronics.com.au/collections/kits/products/experimenters-kit-for-arduinoYou don’t need to buy it from them, but the contents of the kit should give you plenty to play with. You may have most of the parts in your workshop anyway! Or you could pull the parts out of broken junk appliances thrown out in e-waste.Actually you might want to download their instruction manual pdf to use as a beginners guide.

author: rstofer
author_rank: Super Contributor
timestamp: November 13, 2023, 05:15:15 pm
content: Install IDE 2.1.1 or laterOpen File->Examples->01.Basics->BlinkClick on Upload button (Right Arrow button in upper left of screen - this will compile and upload the firmware)Watch the internal LED blinkA huge number of things have to go right for this to work. And they will!You may need to sort out the board identification with Tools->Get Board Info or Tools->Board, Tools->Port. The new IDE is pretty good at finding the board - at least on MacOS.There are thousands of tutorials but the Examples are worth exploring. Of course the Starter Kit ties the parts and UNO together wiith provided code and explanations.

author: Manul
author_rank: Super Contributor
timestamp: November 13, 2023, 06:02:14 pm
content: Some people criticize Arduino and say that everyone should dive into the "real thing", spend months and years studying "real programming" and so on. It's all very nice, but at times it simply fails reality check. I can give you an example. I'm generally technically inclined, started programming at age 5 and occasionally through the next 35 years. Now you can give me almost any unknown environment and in a few days I will likely be doing something useful with it. But I have a colleague who is 40+ and has no previous experience. He had some ideas he wanted to make, and took an Arduino. Very frustratingly and very slowly, but he managed to make his project alive. I had already reached the level that I wanted to bang my head against the wall trying to explain to him programming concepts and how to make this or that work. Coding it all on ARM from scratch? Nah. It's simply not happening.Life is very different when you are: an adult, no previous experience in that subject, have a day job / run business, lack time, have responsibilities, kids, wife. In that case, the difference between Arduino and low level MCU programming may literally be "yeah, it's possible" vs "never". I find it beautiful that such things exist, which enable people to enjoy technical creativity without having to be experts.That's why I tend to believe it's good to start with Arduino. If, by any chance, you find yourself talented, you will know it: Arduino environment will start to look limiting, inefficient, buggy, boring. A wish to go deeper will grow and you will move to something else. And if not, it's also ok. Just my two cents.

author: rstofer
author_rank: Super Contributor
timestamp: November 13, 2023, 07:31:17 pm
content: You might Google for 'Arduino cheatsheet'. One or more of these might be handy.I haven't used one, yet.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 14, 2023, 08:42:49 am
content: Quote from: xrunner on November 13, 2023, 04:44:56 pmNow it's clearer: while I'm at the PC to program the microcontroller, it's fine to connect it via USB. While obviously if it has to work on a card, it will be powered via the appropriate socket. ThanksQuote from: rstofer on November 13, 2023, 04:55:44 pmBut if I take the ONE, the Atmega chip will be in the sock and not soldered on the pcb, right?Quote from: Manul on November 13, 2023, 06:02:14 pmAfter all, there are always conflicting ideas. And rightly so. If I were to start with something difficult, I would probably leave the ring after a few days.If one day the Arduino is too tight for me (but it will be a very long time from now), I will look for something more difficult.

author: Andy Chee
author_rank: Super Contributor
timestamp: November 14, 2023, 09:07:58 am
content: Quote from: CharlotteSwiss on November 14, 2023, 08:42:49 amTake a look at the attached picture of two Arduinos. They are both functionally the same as far as programming is concerned, but the DIP chip allows you to remove it and use it in your own circuit board that you might design later on.Speaking of firmware, the small square chip above the crystal (on the left-hand side Arduino) is also programmable. One of the more interesting uses for programming this second chip is turning the Arduino into a USB keyboard, USB joystick, or USB MIDI interface, without requiring the need to write custom device driver software for Windows or Mac. This allows one to build anything from custom racing simulator chairs, to custom electronic musical instruments.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 14, 2023, 10:27:07 am
content: Here is the other image

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 14, 2023, 10:35:55 am
content: Quote from: Andy Chee on November 14, 2023, 09:07:58 amOk, there is ONE with a soldered smd chip, and the other removable tht. Thanks

author: Watth
author_rank: Frequent Contributor
timestamp: November 14, 2023, 12:52:22 pm
content: I don't know if it was mentioned, but as Arduino is quite easy to start with, it's a favorite for the hobbyists. If you want to try it and have some help to start, look if there's a FabLab (or equivalent) near you where you could get some help.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 14, 2023, 02:30:16 pm
content: Quote from: Watth on November 14, 2023, 12:52:22 pmThanks, but I'll try to experiment on my own. I'm not a woman who loves socializing so much (outside work). I prefer to have only the tools of my small electrotechnical laboratory around me.

author: rstofer
author_rank: Super Contributor
timestamp: November 14, 2023, 05:06:58 pm
content: Should you wish to probe the IC pins directly, it is easier with the DIP chip. This may never happen but who knows?I think you will find that the starter kits include a connector for a 9V battery. For most learning projects, I use USB power. You can blink a lot of LEDs on USB.For motorized toys, the motors are usually 12V (although this varies widely) so I run the 12V battery power to Vin on the Arduino. Or I can use a separate 9V battery. Or a 9V wall wart. The Arduino is quite flexible. If you have any doubts, post a question. Just make sure the uC ground and the peripheral device grounds are all tied together. Your scope probe ground will connect to one of the Gnd pins on the Arduino.The Starter Kit tutorials will address all of this.For motorized toys, the motors are usually 12V (although this varies widely) so I run the 12V battery power to Vin on the Arduino. Or I can use a separate 9V battery. Or a 9V wall wart. The Arduino is quite flexible. If you have any doubts, post a question. Just make sure the uC ground and the peripheral device grounds are all tied together. Your scope probe ground will connect to one of the Gnd pins on the Arduino.The Starter Kit tutorials will address all of this.That'Blink''Fade' example will look very interesting on your scope. PWM frequency will be constant while pulse width will vary.ETA corrected Blink to Fade for PWM

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 14, 2023, 05:25:00 pm
content: Quote from: rstofer on November 14, 2023, 05:06:58 pmThe Arduino they sell with the starter kit has the chip on the socket, so ok.I saw that in the kit there are 2 9v batteries, to be connected to the Arduino. However, I always prefer to power via a power supply. I'll see if I can find the power supply for the Arduino.Ground speech: if the power comes from USB, the ground will be that of the PC. If by battery, the device will be floating. I didn't understand what you meant by uC.However, I should have the Arduino at home next week, so I can start some easy experiments...I said something stupid: even if I use a battery, I will still have the Arduino connected to the PC with a USB cable!

author: Andy Chee
author_rank: Super Contributor
timestamp: November 14, 2023, 05:33:28 pm
content: Quote from: CharlotteSwiss on November 14, 2023, 05:25:00 pmuC is short hand for microcontroller.uF = microfaradum = micrometerus = microseconduC = microcontroller;)

author: rstofer
author_rank: Super Contributor
timestamp: November 14, 2023, 05:40:08 pm
content: Here's the power supply from Amazon Germany. Is the plug correct? Now I realize why my first link was useless - duh... Ihttps://www.amazon.de/Supply-Arduino-Systems-Charger-Charging/dp/B081YDN4X8

author: Electro Fan
author_rank: Super Contributor
timestamp: November 14, 2023, 06:10:53 pm
content: Quote from: rstofer on November 14, 2023, 05:06:58 pmThe DIP chip will definitely make probing the pins easier (with an oscilloscope and with a logic analyzer), and it will also help if you want to cross the bridge from programming the Arduino with the IDE to reading/writing to the ATmega with a programmer.The XGecu T48 is worth a look and if you go for it, it's probably worth going for one of these:https://www.digikey.com/en/products/detail/jonard-tools/S-340/2309209?utm_adgroup=&utm_source=google&utm_medium=cpc&utm_campaign=PMax%20Shopping_Product_High%20ROAS%20Categories&utm_term=&utm_content=&gclid=EAIaIQobChMI2b2F9IfEggMVKzjUAR2wnwh4EAQYASABEgJWTPD_BwEI think you might find it exciting to program the ATmetga with the IDE, scoop it out with something like the Jonard tool, then install it in the ZIF socket of a programmer such as the T48, read and then edit some code on the 328 using the T48 programmer and it's software, remove the ATmega from the programmer and carefully insert the legs back into the socket on the Arduino, and see the new code run in the IDE.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 14, 2023, 07:02:29 pm
content: Quote from: Electro Fan on November 14, 2023, 06:10:53 pmWithout a doubt the ATmega in the socket is better than the soldered SMD. However, I don't understand why having to program the ATmega on a T48, when it could also be done from the Arduino? Maybe easier/faster?

author: rstofer
author_rank: Super Contributor
timestamp: November 14, 2023, 08:15:58 pm
content: Quote from: CharlotteSwiss on November 14, 2023, 07:02:29 pmAs long as you are using an Arduino board, there is little advantage to any programming scheme other than USB. But do note that there is a 6 pin header on the board for ICSP (In Circuit Serial Programming) which, at this point, should be left as an advanced topic. Ignore it for the first few years and then, if you're bored, look into it.Here's a bit of info:https://forum.arduino.cc/t/what-is-the-icsp-pins-for/124378/5OTOH, if you want to embed an Arduino in a larger project, use the Nano and just plug it into your project PCB. Just create a daughtercard to handle all of the peripheral stuff.https://www.amazon.com/LAFVIN-Board-ATmega328P-Micro-Controller-Arduino/dp/B07G99NNXLIn terms of pinout compatibility, the Nano is a superset with 2 more analog pins. Google for:'does the arduino nano have the same pinout as the uno'There are other workflows where ICSP is useful. Years ago, I used it with the GNU toolchain and ICSP directly with an ATmega128. All the IDE does is wrap up the tools and control them in hidden invocations. But it means you get results without a monstrous learning curve that is both high and steep.The Arduino was invented for artists and craftsmen to be able to add motion and other effects to their projects without an MSEE or higher. You can do it either way but the IDE and libraries is the fast way to get results.

author: Electro Fan
author_rank: Super Contributor
timestamp: November 14, 2023, 08:19:16 pm
content: Quote from: CharlotteSwiss on November 14, 2023, 07:02:29 pmNo doubt, if all you want to do is program the Arduino the IDE is all you need and it's fast and easy.However, if you want to read/write other chips (of which there might be a couple tens of thousands or more of potential interest) the Arduino won't get the job done. So, if you want to take another step on your journey you might want to use or experiment with a programmer like the T48.You could learn to use the T48 on any of those 20 thousand or so other chips, and potentially you could read any of them once you get them in the programmer. However, if you want to write to them - while you might be able to (probably can) do that, it might be hard to fully know and appreciate how successfully the write worked unless you can return the chip to it's home device and see that device operate with the new data. Of course you could see the write in the programmer with another pass of the programmer's software in read mode, but with the Arduino and it's IDE you could confirm that you were able to physically move the chip (in this case the 328) from the Arduino to the programmer, read and write to it in the programmer, and then confirm your successful ability to operate the programmer by seeing the results of the edit in the Arduino's IDE. It's a step in larger learning process if you want to look at not only application software but the firmware of embedded devices.You started your journey in a substantially electrical environment in a mostly analog realm, and you are now crossing over further from electricity and analog to digital - which takes you into the territory of software development. It's one of the beauties of the Arduino - it is a learning platform for some aspects of electricity and it sits at the intersection of hardware and software, and therefore at the intersection of analog and digital realms.The software aspect of digital has layers - including applications software, firmware, and Operating Systems. With the programmer you will get a little closer to the seeing some of the structure of firmware. When you look at your Arduino data on the programmer you might encounter hexadecimal, for example.It's just a matter of what interests you, but I have a hunch you might find it interesting to move the 328 out of the Uno and into the programmer and then play around with the programmer. It's by no means a requirement - it's just a way to expand your view of system architectures that encompasses electricity, analog, hardware, digital, and software including firmware.There's a recent thread about analog vs digital that might stimulate some thoughts and questions. Again, it's just a matter of where you want to look around on your journey. The Arduino can keep you busy indefinitely; as was said earlier, when you have exhausted your interest in the Arduino you will know. In the meantime, the Arduino will enable you to learn and build lots of stuff. The programmer is just another way to gain insight and perspective and it can be very useful for doing reads/writes on the many (thousands of) chips that don't just plug into an Arduino socket.I'd say stick with the Arduino and get it comfortable with it, and then when you feel ready, give the programmer a try. I predict the first time you take a 328 that you programmed in the Arduino and read it in a programmer you will have at least a bit of an "ah ha" moment. And when you re-write the 328 in the programmer and see the new data show up in the IDE you will feel like you have completed a notable lap around the track. Just my guess.... Good luck.

author: MarkF
author_rank: Super Contributor
timestamp: November 14, 2023, 09:28:01 pm
content: Have none of you read her first two posts???- She has NO programming experience. Not one line of code.- She has NO microcontroller experience.90% of this thread is far too advanced and the subjects brought up have clearly just confused her.Let her learn to crawl before walking or running even.All she needs is her computer, USB cable, the Arduino Uno, her scope and the handful of parts she has on hand.Just writing a blinking LED program and getting it working will keep her busy. Then she can learn how to read a switch and do a ADC with a potentiometer. After, she can do a bunch of outputs to a scope probe without any hardware (PWM and SPI are two that comes to mind). Then, she will have an idea what direction she wants to go. And she'll have a million questions.She doesn't need a bunch of sensors and gadgets in these kits to get started.Learning to program in C will take her several days...btw. The Arduino Uno board in the through-hole socket is nice if you blow-up the chip.

author: brucehoult
author_rank: Super Contributor
timestamp: November 14, 2023, 09:28:46 pm
content: Quote from: rstofer on November 14, 2023, 08:15:58 pmNot so hidden. All commands run are listed in the build log. You can copy&paste them into a shell window to repeat or modify them, paste them into your own build script or makefile etc.

author: rstofer
author_rank: Super Contributor
timestamp: November 14, 2023, 09:56:12 pm
content: One advantage of the full Arduino board is that the serial port comes out over USB. I do a lot of my debugging with printf() calls. Some project specific boards may not implement the USB interface for the serial port.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 12:10:06 am
content: Quote from: rstofer on November 14, 2023, 08:15:58 pmI was just looking at the Arduino schematic, the iscp connector communicates with Miso-Mosi. It looks like a master-slave connection, but I'll get into that later.I believe that for a beginner like me, the Arduino world can be a great teaching field. Calmly, into the future.

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 12:15:53 am
content: Quote from: brucehoult on November 14, 2023, 09:28:46 pmYes, once you find the 2 check boxes in Preferences or Settings to enable verbose output on compile and uploading. Copy and paste is absolutely the way to go, the command lines get a bit long. By default, verbose output is disabled (boxes not checked). I might choose paths that are a little more local.I just uploaded IDE 2.2.2 - it seems to work fine. A tremendous improvement over IDE 1.x.x.

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 12:27:58 am
content: Quote from: CharlotteSwiss on November 15, 2023, 12:10:06 amThe SPI protocol signals would have a different name if they were developed today:Master In Slave OutMaster Out Slave Inhttps://web.engr.oregonstate.edu/~traylor/ece473/x_atmelpdfs/spi_system.pdfThis can wait...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 12:33:47 am
content: Quote from: Electro Fan on November 14, 2023, 08:19:16 pmI've already had my eye on the T48, I don't rule out that in the future, when I have learned the basics of this world (via Arduino), I might purchase it. As I said at the beginning, for me the world of chip programming is a new world. However, I still handled an old pic programmer (I don't remember what type), it was used on some decoder cards. I programmed it via serial. I still have it in my little laboratory (I simply sent a hex file if I remember correctly, already prepared by others; in short, without learning anything).As you rightly underlined, I started years ago in the purely electrical field (my father worked as an electrician all his life); I still remember when my father let me do all the installation in the tavern-garage. I completed the job without many problems, but I didn't like that world very much. Few satisfactions.Then I started to deal with small repairs on electronic devices (audio, TV, lamps, motherboards, etc.), this world immediately began to steal my heart. In the digital field, however, I have never had the pleasure of being interested. Although some equipment where I work (healthcare) has started to attract my interest. The Arduino is a way to tiptoe into this world too.I find your advice to start with Arduino and then move on to the programmer very sensible. Step by step, calmly. I'm sure I would be thrilled to program the atmega on Arduino and then see it in the programmer (or reverse). Like when I resolve a fault on the electronic board, troubleshooting, desolder, solder, turn on the board after the repair, pure happiness. But we all seek these emotions in this world of electricity. This makes us one big family chasing dreams made by electrons. Thanks

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 12:39:24 am
content: Quote from: MarkF on November 14, 2023, 09:28:01 pmThanks for the intervention. The guys are also just advising me on what future developments could be. They themselves have already widely recommended that I start step by step. One step at a time. With Arduino and little else. I have many components in my small laboratory, but perhaps with what the starter kit provides, I can perform the suggested exercises without taking too long steps.I didn't understand your last two lines, about the through holes... Thanks

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 12:47:56 am
content: Quote from: rstofer on November 15, 2023, 12:15:53 amMeanwhile, while I wait for the Arduino (not yet ordered, but it will arrive next week), I would like to install the software on my PC. Looking at the Arduino website, I see that there is the IDE 1 or IDE 2 software. Better to install version 2 right? I see they talk about windows 10 or higher? I still use windows 8.1. Will it work on my operating system?

author: xrunner
author_rank: Super Contributor
timestamp: November 15, 2023, 01:21:44 am
content: Quote from: CharlotteSwiss on November 15, 2023, 12:39:24 amThe component pins gothrougha hole in the PCB (through hole device), rather than just soldered on the surface of the board (SMD - surface mount device)

author: Andy Chee
author_rank: Super Contributor
timestamp: November 15, 2023, 02:03:59 am
content: Quote from: CharlotteSwiss on November 15, 2023, 12:39:24 amIf you do something silly with the input/output pins of the Arduino, like short circuit or draw too much current, hopefully it's only the uC that's destroyed. If so, then replacing the uC in the socket is cheaper than replacing the entire Arduino!

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 02:22:08 am
content: Quote from: CharlotteSwiss on November 15, 2023, 12:47:56 amVersion 1.x.x is a mess, avoid it if possible. Try to install 2.2.x and try to compile the blink or fade programs. File->Examples->01.Basics->BlinkCompile using the check mark button in the upper left. If it compiles you may be in luck. You may need to set the Board to UNO and pick any serial port, just don't try to upload. I really don't know what will happen without a Port designation.Tools->Board and Tools->PortIf Ver 2.2.x doesn't work, you might uninstall it and try V1.?.?. But it's UGLY in comparison.Stop the presses! Apparently 2.1.1 works on Win 8 but 2.2.x doesn't. So, try 2.1.1QuoteQuoted from an Internet search for 'will arduino 2.x.x run on win 8?'

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 03:21:55 am
content: Quote from: xrunner on November 15, 2023, 01:21:44 amThanks, I didn't understand. THT components, ok.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 03:25:02 am
content: Quote from: Andy Chee on November 15, 2023, 02:03:59 amOkay. I have already soldered smd chips with more than 28 pins anyway. Even if it's not a walk in the park. I've done the job a few times though. It also depends on the pin to pin pitch.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 03:32:16 am
content: Quote from: rstofer on November 15, 2023, 02:22:08 amThis is a big problem. I assembled my two PC many years ago: one has Windows 7 (the best Windows OS in my opinion). The other windows 8.1; I've been using it for years without problems. My HW is old on the two PC, so I haven't updated to Windows 10.However, I'm experimenting Windows 11 (second SSD), it seems to work (but it's still in the testing phase). In the meantime, I'm trying to install version 2.1. x on windows 8.1. See what happens.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 15, 2023, 07:53:13 am
content: About the in circuit programming, this is only needed when the boot loader is broken.The way it works with the Arduino is that the MCU has a program loaded into it's flash memory that on startup checks if there is communication on the serial port (connected via the USB interface) that tells the MCU the computer want's to load a new program to the MCU. This new program is then stored in another part of the flash memory. After reset the boot loader sees no communication for programming and then jumps into the newly loaded program.When you buy a fresh MCU it is blank and needs the boot loader programmed to the MCU first to work in the Arduino environment. For this the in circuit programming comes into play. One needs a programmer for it like theUSBASP. Cheap ones can be bought fromaliexpress.The Arduino UNO you are looking into to buy will have the boot loader and works directly with the IDE, so no need to worry about it. In the future when you gained experience and want to do more it can come in handy.

author: MarkF
author_rank: Super Contributor
timestamp: November 15, 2023, 11:16:23 am
content: Quote from: CharlotteSwiss on November 15, 2023, 12:39:24 amYou want this one:https://store.arduino.cc/products/arduino-uno-rev3Not the Uno with the SMD microcontroller.Personally, I would not buy any of the starter kits. It might be worth while if you had no other parts on your work bench. Too much waste for what you get. The manual would give the novice some direction, but with a little imagination and some Youtube instructional videos you would have the same thing. Just start with the examples from the Arduino IDE. Then, venture into the areas that you're interested in. I think you're biggest struggle will be just learning C programming.Perhaps a small display?Waveshare 1.5inch RGB OLED Display Module.I'm sure one of your future projects will involve a display of some sort. It will also tax your programming skills. Adafruit has a library that will help. Although their initialization of the display is insanely bright and will burn in the OLED. I can give you a more conservative initialization when you get to that point.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 02:02:05 pm
content: Quote from: pcprogrammer on November 15, 2023, 07:53:13 amThanks for the explanation. I understood something, not everything. This means that the ATmega328 chip mounted in the Arduino socket already has a boot loader inside and therefore this allows the Arduino to work. For example, if I changed the original Atmega chip with a VIRGIN one, the boot loader would have to be inserted into the new chip (using another programmer), otherwise nothing would work. Did I get it right? Thank you

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 02:10:05 pm
content: Quote from: MarkF on November 15, 2023, 11:16:23 amThat display is nice, I would like to add it to my old intercom.So, with an Arduino I could program that display to my liking? CoolThey have many components in the laboratory, from one point of view you are also right that an Arduino kit could be a clone of many elements that I already have. But it contains some things that I don't have (besides the Arduino(). USB cable, power supply, and probably a series of sensors, which otherwise I'll have to buy elsewhere to experiment with anyway. Let's say you're not entirely wrong, I thought I have the same thing too. But then I would still have to buy a lot more separately...

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 02:49:23 pm
content: With the starter kit all 3 bits match: The tutorial, the components and the code. That's the whole point. You don't have to dive right in to a datasheet to dig out the I2C address of some component and then discover that the commands for youe component don't line up with the tutorial. Oh, was that the 7 bit address or is it already shifted? With the I2C protocol, you can expect to use your scope for decoding. I use SPI at every opportunity, even though it takes more pins.I really think having all 3 pieces matching is useful and worth every dime of the kit cost. I prefer simple and attainable examples. Particularly in the early days.

author: themadhippy
author_rank: Super Contributor
timestamp: November 15, 2023, 03:12:25 pm
content: Quotenope ,you just save your code and load an i2c scanner instead

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 03:39:07 pm
content: You are going to have to learn C. The tutorials will show you C but they probably won't teach you C. I suggest the definitive book: "The C Programming Language, 2d Edition" by Kernighan and Ritchie. Unfortunately, it is overpriced at Amazon, maybe you can find it used or something. These fellows developed the language and their book is a desktop necessity.No doubt, there are other books but K&R is the standard.https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628Feel free to type in all of the code and save the functions for a future library. I use the string conversion routines all the time. My process is to get the UART working and then load my program with these conversion functions for help with debugging via printf(). Sometimes a decimal representation carries more readily available information than hex. itoa() and atoi() are particularly useful. Integer to ASCII and ASCII to IntegerI don't often use the GNU string functions for embedded code because, at some point, the GNU library will expect a memory heap and I dislike using the heap on embedded projects. If you ever see something like '_sbrk() undefined', you will know that GCC is expecting a heap manager that you have to provide. You want to avoid this. You define it in syscalls.c which you also have to provide - primarily for file handling if your project deals with files (not usually).The stack grows down in memory and the heap grows up. When they meet, the program crashes, without warning. You will run into this stuff sooner or later. Let's treat it as an advanced topic for now. Just know that the K&R string conversion functions are useful and worth playing with because they don't require a heap.There are probably other references at much lower cost and you can find the conversion functions elsewhere but K&R is the standard reference.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 03:59:24 pm
content: Quote from: rstofer on November 15, 2023, 02:49:23 pmI haven't ordered yet, I will do it in these days. I see for example (on Amazon) that the elegoo kit comes in different prices: basic, medium, ultimate... Perhaps the most complete one could be the best? Thank youThe discussion of integrating Arduino and oscilloscope will certainly interest me. I will take advice on experiments. It will also be a way to improve the use of the oscilloscope (with digital almost never used).

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 04:06:18 pm
content: Quote from: rstofer on November 15, 2023, 03:39:07 pmThe discussion on strings is interesting. As I begin to use the language, I will certainly come to these problems.I had already thought about a book. My choice fell on this:https://www.amazon.com/Arduino-Projects-Dummies-Brock-Craft/dp/1118551478/ref=sr_1_1?crid=1YTV5BX7D0NUA&keywords=projects+with+arduino+for+dummies&qid=1700064292&sprefix=projects+with+arduino+for+dummies%2Caps%2C808&sr=8-1Could this be a good choice to start with?Thanks

author: JeremyC
author_rank: Regular Contributor
timestamp: November 15, 2023, 04:46:37 pm
content: Quote from: rstofer on November 15, 2023, 03:39:07 pmYou can get this book in pdf format for free from here:https://colorcomputerarchive.com/repo/Documents/Books/The%20C%20Programming%20Language%20(Kernighan%20Ritchie).pdfAnother good book for beginners is "C For Dummies",https://www.cl72.org/070documents/C/For%20Dummies%20-%20C.pdf

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 04:56:11 pm
content: [quote author=CharlotteSwiss link=topic=400635.msg5170110#msg5170110 date=1700The discussion on strings is interesting. As I begin to use the language, I will certainly come to these problems.I had already thought about a book. My choice fell on this:https://www.amazon.com/Arduino-Projects-Dummies-Brock-Craft/dp/1118551478/ref=sr_1_1?crid=1YTV5BX7D0NUA&keywords=projects+with+arduino+for+dummies&qid=1700064292&sprefix=projects+with+arduino+for+dummies%2Caps%2C808&sr=8-1Could this be a good choice to start with?ThanksI would put it off until I had finished the Starter Kit tutorials but, sure, why not?Most of my discussion above is related to programming bare metal, no Arduino libraries. The book is solid, the rest is advanced.I think I am treating 'learning C' as a separate project. See if you can get CYGWIN to work. This will provide you with a terminal (working screen) and all of the GNU tools for C programming. There are a LOT of options, try to install for C development only. The other packages can be added later.https://www.cygwin.com/This setup will allow you to edit, compile and run all of the code in K&R. I don't recall what editor they supply - it will be rudimentary so edit with Visual Studio Code and compile/run with CYGWIN. Dual monitors are real handy.This is about 'learning C' and has little to do with the Arduino or its IDE. Learning C is a definite need.Your versions of Windows are 64 bit, right? If not, you need to dig deeper at the site for 32 bit versionshttps://www.cygwin.com/install.htmlETA:Try Notepad++, it is a fine editor and entirely adequate.

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 05:35:57 pm
content: If Visual Studio works, you can skip the Cygwin/editor installation. I didn't emphasize this enough. Visual Studio is a good place to learn C.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 06:15:24 pm
content: Quote from: rstofer on November 15, 2023, 05:35:57 pmMy OS (I use 3) are all 64 bit.In the meantime I have installed IDE 2.1.1, it seems to work on Win 8.1 (of course we will have to see when I connect the Arduino Uno).For software that concerns the C language, we have never talked about Visual Studio, right?Is it free software? Would it be useful for writing strings in C?

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 06:42:21 pm
content: We haven't spent much time on Visual Studio but, yes, it's free. It really wants to create C++ projects and we want C projects so watch the video, it's better than my written description.These DEBE (Does Everything But Eat) tools take a bit of time on Google.

author: MarkF
author_rank: Super Contributor
timestamp: November 15, 2023, 06:49:01 pm
content: Quote from: CharlotteSwiss on November 15, 2023, 06:15:24 pmVisual Studio is basically the gold standard for developing software on a Windows computer in a professional environment. It is an IDE that you would use to develop programs for a Windows computer. It is not an IDE that you would use for the Arduino.TheCommunity edition of Visual Studiois free. It might be a good way to start learning C language basics without any references to the Arduino. You can switch over later. It's a lot to learn though.There is NO connection between Visual Studio and the Arduino. They are two different development environments (IDEs) with the only similarities being the C/C++ language. They both allow you to write programs, compile them and run them. Think of C++ as an advanced version of C.Both the Arduino IDE and the Visual Studio IDE are souped-up text editors.

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 07:36:30 pm
content: Visual Studio is a HUGE package but you can install just the components of interest and, primarily, I think you need to focus on the C++ installation which will compile C code with the filetype is .c rather that .cpp

author: rstofer
author_rank: Super Contributor
timestamp: November 15, 2023, 07:45:46 pm
content: Here's a quick video showing how to create a C project in Visual Studio 2019 and it works in 2022 as well.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 15, 2023, 08:55:25 pm
content: Quote from: CharlotteSwiss on November 15, 2023, 02:02:05 pmYes, that is correct. The USBASP can be used to do that programming, or one can even use an Arduino UNO or Nano to do the job.Programming the boot loader can be done from the Arduino IDE with the use of one of these special programmers.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 15, 2023, 09:25:20 pm
content: I see a lot of talk here about the programming language to learn, and I agree that C is a good base to get things working, but there are a couple of layers to it.Basic C is about the syntax made up with the curly braces {, } and the fixed keyword like if, else, for, while, do and the operators like +, -, *, / etc. With these basics it is possible to do everything you want on a microcontroller. For this the K&R book mentioned is a good place to start.Then there are the library functions like printf, abs, sin, etc. With these functions it becomes easier to perform specific tasks. These library functions are all made up with the basics of C or assembly language. You might not need these when playing with Arduino, because they use different libraries to get things done. There are many sites online with references about these functions. For instance:https://cplusplus.com/reference/A further step on the ladder is C++ where for instance classes are introduced. This does come in play in the Arduino environment because it uses parts of C++.The focus in Arduino development is on two functions:1) void setup() to perform all the initialization.2) void loop() to do the actual work.The setup is only run once at the power up of the board, after which the loop function is called time after time until the board is powered down.You can learn C while you play as long as you bare in mind that what is used in the Arduino environment is a special methodology not found in bare metal systems or computer software. Writing code for a computer requires different knowledge about programming. Even though the basics are the same. I myself like to keep things as plain as possible and avoid using libraries when programming microcontrollers. But for this each it's own

author: brucehoult
author_rank: Super Contributor
timestamp: November 15, 2023, 10:08:21 pm
content: Quote from: pcprogrammer on November 15, 2023, 09:25:20 pmWhat do you mean by that?The Arduino environment doesn't force any methodology on you.They make it *easy* to do things in a particular way, but don't in any way *force* you.For example, there is no requirement to return from setup(), in which case it's essentially the same as main() in any other C program, and loop() is never used (and can be empty).When you arrive in setup() a few things have been done for you. The clock has been set to 16 MHz (or whatever), a timer has been set up for millis()/micros(). There's a stack. But not a lot more than that, and you can easily poke at registers to change it.Nothing forces you to ever call any Arduino library functions from setup(). Just blast away with your bare metal programming, setting up timers, ISRs on pins, and looping in setup().

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 15, 2023, 11:35:56 pm
content: Quote from: MarkF on November 15, 2023, 06:49:01 pmThanks I understand. In the meantime I had searched, in fact I can install it free on my PC. He will do it. But I will start looking at visuals, when I have done some experiments with Arduino, which will allow me to understand some easy strings of C or C++ language. Calmly, I'll get there.Quote from: rstofer on November 15, 2023, 07:36:30 pmAs soon as I can I'll install it here on Windows 8.1. So I can only install the part that concerns C++. Great thanks.I will install the 2022 version (it offers me that one when I search for it on Microsoft).I saw the video, I'm starting to understand how these programs work to compile C code. Above it is written, below it helps you understand if the compilation is correct. Same thing with the Arduino IDE.Quote from: pcprogrammer on November 15, 2023, 08:55:25 pmInteresting. So with the Arduino and the USBASP (I saw that the Chinese give it to you on Ali...), you can compile the boot loader of a new Atmega. Once the boot loader has been added, the new chip is ready to be programmed with C++ language in the Arduino.Quote from: pcprogrammer on November 15, 2023, 09:25:20 pmI had already studied the explanation of the void the other day, exactly as you wrote it (I had searched because when I opened the IDE, I saw that it had two separate areas, namely setup and loop.From what you wrote, if I understand correctly, the libraries (in the C language) would basically be pre-packaged 'strings', ready to be called if necessary.---In the meantime, I would like to thank you all for the advice received. Your preparation and passion can be perceived from a distance. I admit that I wish I had even 1% of your knowledge in this electronic world.Now I'm going to order the Arduino, I'm curious to connect it for the first time and observe while it does some work, the command language. Thank you.

author: rstofer
author_rank: Super Contributor
timestamp: November 16, 2023, 03:30:36 am
content: In addition to K&R, which is NOT a tutorial, you can Google for 'c programming tutorial' and land on a wonderful site:https://www.w3schools.com/c/index.phpEdit, compile and run are all done on the browser. Nothing to install!

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 16, 2023, 07:37:52 am
content: Quote from: brucehoult on November 15, 2023, 10:08:21 pmGoing by all the examples out in the world, which most likely happens when you are a beginner, you mostly see the use of setup and loop with the available libraries for the peripherals used in these examples.And a lot of these libraries use a C++ approach for calling the functions, which differs from standard C.Sure it is possible to do somewhat bare metal within the Arduino environment and use setup as main, but that is not what the examples show. That is why I say keep this in mind when the intention is to learn more about the ins and outs of programming microcontrollers.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 16, 2023, 08:00:57 am
content: Quote from: CharlotteSwiss on November 15, 2023, 11:35:56 pmA minor difference but just to keep it straight, the boot loader is already compiled, so that step is skipped. The IDE just uploads the binary to the fresh Atmega.Quote from: CharlotteSwiss on November 15, 2023, 11:35:56 pmWhat you call 'strings' I call functions. C is based on functions be it in libraries or the ones you write yourself. For libraries that come with the compiler the source can often be found, making it possible to see what a particular function does under the hood. The same applies for a lot of the Arduino libraries. The source can be found and studied to see what it does. Third party libraries can come without the source to protect their intellectual property.@CharlotteSwiss. A question for you. How much do you know about the basics of computers, and with that I mean the hardware like the processor, memory (ROM and RAM) and the peripherals like serial interface, graphics interface, etc.This is a vital part of working with microcontrollers. Understanding how things are connected and what the parts do for you. Within microcontrollers a lot of these parts are packed into one single chip and give you the ability to interface with other external parts be it sensors, dispays, personal computers or even other microcontrollers.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 16, 2023, 08:07:47 am
content: Quote from: rstofer on November 16, 2023, 03:30:36 amI have used their site a lot for web development, and they offer a lot of good information.

author: brucehoult
author_rank: Super Contributor
timestamp: November 16, 2023, 08:32:48 am
content: Quote from: pcprogrammer on November 16, 2023, 07:37:52 amYou have to start somewhere, and following examples and tutorials in an easy environment is it. You can get blinky going on an Uno within 10 minutes of opening the box. Maybe 5.The claim I am countering (which I encounter frequently) is that the Arduino environment as a whole somehow locks you into doing ONLY that, and prevents you progressing.If a beginner has to read data sheets and set up clock trees and poke at port and counter registers themselves to get a blinky working then 99% are going to give up and do something else. Triply so for setting up a UART to print "Hello World" back to their PC.And then you get zealots from the opposite direction, saying that the C++ language the Arduino libraries use is too hard to learn. And yet large numbers of people, including kids, manage to do it.

author: xrunner
author_rank: Super Contributor
timestamp: November 16, 2023, 12:01:53 pm
content: Quote from: brucehoult on November 16, 2023, 08:32:48 amIt ain'tthathard people -https://therealschool.in/blog/arduino-projects-best-kids-learn/

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 16, 2023, 12:24:42 pm
content: Quote from: brucehoult on November 16, 2023, 08:32:48 amI'm not against using the Arduino environment. I'm just saying that there is more then Arduino and to keep that in mind.That kids manage to do it does not surprise me at all. Now a days they are almost born with a computer device in their handsProgramming ain't that difficult. Solving bugs in what you have programmed can be though.

author: rstofer
author_rank: Super Contributor
timestamp: November 16, 2023, 02:01:41 pm
content: All of the tutorials I have ever seen discuss the mechanics of programming. How to do conditional statements or loop statements or function calls. The simple mechanics.What I have yet to see is a tutorial describing the art of programming a solution to a real problem. That's one of my hangups with C++. I don't know how to apply it to solving a problem. C, Pascal, Fortran (without objects), sure, I understand these well enough. C++ and Java, not so much. Python is a work in progress.I want to see a real application, solving a real problem, written in C++. Not some trivial 10 line example, something around 1000 lines. A real program!Part of my problem is that when I do come up with a problem, I solve it with comfortable languages before I even give C++ a chance.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 16, 2023, 02:11:59 pm
content: C++ is all about objects. Think structures in C and you are halfway there.I only used it when developing programs under windows, which I don't do anymore. On linux I can develop programs with just C, which I have much more of a grasp on.For me every problem that I need to solve with a program I can do with C, because it offers all the needed basics. Sure it can be harder and more work then using C++ or other more sophisticated programming languages, but these other languages also have a learning curve.

author: Dan123456
author_rank: Regular Contributor
timestamp: November 16, 2023, 02:48:12 pm
content: I know you have had a million and one responses already and are probably overwhelmed with options at this point but figured I’d ad my two cents as a fellow newbie to the world of MicrocontrollersAs so many others have said, absolutely! Go for the Aurduino UNOThere are sooooo many different libraries, examples, project ideas and resources online for them it usually makes finding info super easyOn the learning programming side, I strongly agree with the others that suggested one of the beginners kits that comes with a book / bookletFor me at least, I find physically typing what I’m reading from a book into the computer a really good way to learn as it prevents me from being lazy and just clicking on the preloaded example or copy pasting the code from a websiteIt also really gets you used to the… way you have to write things (syntax? - sorry, not a programmer so unsure on the correct terminology!) such as having to remember to close brackets and add the right symbols etc.Even the really basic projects like “make a LED blink with just a resistor and a LED) are good to do as they help train you on thisAgain, I know you have heard all of this from others already but hope that helpsGood luck and have fun!Edit: also forgot to say, you can also use the Aurduino IDE (the computer program you use to program the Aurduino) to program other microcontrollers like the ATTiny’s (there are heaps of examples and guidance online of doing that with the ATTiny85)So, after getting used to the Aurduino and the IDE, you can fairly easily start learning about those without having to learn a brand new piece of software at the same time

author: MarkF
author_rank: Super Contributor
timestamp: November 16, 2023, 04:06:27 pm
content: Quote from: rstofer on November 16, 2023, 02:01:41 pmHere you go...This is a MIDI Sequencer I wrote that sums four different MIDI channels each with different sounds/instruments. Each keyboard and its knobs is a C++ object. I just instantiate the object four times (i.e. m1, m2, m3 and m4). I've only included the main() function and the two manual() files (the object and header) to make the code easier to follow. The rest of the program is just header files with MIDI definitations.

author: rstofer
author_rank: Super Contributor
timestamp: November 16, 2023, 05:50:21 pm
content: Re: installing Visual Studio 2022 Community EditionThe only required package for this discussion is "Console Apps" and maybe Python. The installer program hangs around so the other packages can be added on demand.

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 17, 2023, 01:41:35 am
content: Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pmHi Charlotte,I've read the whole thread but responding to your thread starting post (original post(er) aka OP) on account it seems to me that your best option would be to purchase a nano board (or three - they're cheap enough if you avoid Amazon).You'vealready got the solderless breadboard(s) to handinto which to plug a nano and load the blinky sketch to verify that your nano(s) and your Arduino IDE installation do actually work (at least to the level of blinking the on-board LED). From that point on, you can experiment with stuff like thermistors and potentiometers from your stock of salvaged components.I'd bought a pack of three nano3 clones for just £4 from Bangood some three years ago now and tested just one with the blinky sketch before packing them all away until I was ready to use them in a rubidium oscillator baseplate temperature controller project I'd already started that used a cpu fan cooler using a simple thermostat circuit based on a comparitor to simply switch the fan on and off using a mosfet.This was a bit on the crude side but as luck would have it, the breadboard wiring had introduced unwanted feedback which caused the controller to behave as if it where a PWM proportional controller, inspiring me to add a PWM modulator circuit to do this by design rather than by 'Happy Accident'.However, I'd realised by then that I needed to include barometric compensation for which there were no simple analogue barometric sensors available at hobbyist pricing. The only cost effective devices being the BMP180 and 280 pressure/temperature sensor modules mounted on breakout boards with I2C and/or SPI which would require the use of a micro-controller of some sort (namely one of those 3 nano3s I'd speculatively purchased a year earlier).Finally, I'd reached the point where I had no other choice but to employ a nano in order to progress any further with my project. I found a thermistor based thermometer sketch and tested that, followed by a BMP280 based barometer and temperature sketch (all outputting via the usb tty link to the Arduino's terminal emulator) leaving me to look for a stand alone display add on to complete my project as a self contained solution. This took the form of the classic SSD1306 oled display.I've since spent the past two years refining my LPRO101 baseplate fan cooler temperature control algorithm to the point where it can maintain the baseplate at 36.04 deg C +/- 20mK over a 4 to 26 deg ambient range. leaving me to extend the upper limit to its possible maximum of 32 deg. The bit of code that prevents overcooling at very low ambient needs a little more refinement to stop it sabotaging the call for more fan speed at the upper end of the ambient temperature range.In the meantime, I've come to realise that I could use a couple more bits of PWM resolution to provide the finer control of fan speed required to reduce the amplitude of the +/- 20mK excursions either side of my 36.04 degree target base plate temperature so I'm looking at solutions to improve the standard PWM's 8 bit to 10 bit as well as refining the ambient top end cooling performance (and commissioning a 48v 100AH LFP battery replacement for a set of four 12v 7AH SLA battery pack and resuming my MK III GPSDO project currently on hold for lack of workbench space whilst I have the RFS back on the the bench for further modifications (both hardware and software). In short, I'm having trouble finding the time to complete the inter-related RFS and GPSDO projects.The RFS project has taken so long simply because it needs a minimum of 24 hour test runs to check the results of any code changes and even days if I've had to power it down to make hardware modifications or repairs. Two of the three Banggood sourced Bourns ten turn pots I'd used to fine tune the RFS's calibration, went open circuit with even the unused spare failing the same way!!TBH, I'd totally underestimated the complexity of this temperature control task. I landed up having to add servo controlled recirculation flap diverter valves to stabilise the plenum fan intake temperature in order to operate in low ambient temperature conditions (4 deg C) without having to slow the fan right down to a standstill which creates undershoot followed by an overshoot as it spins back up, a condition that appeared with a temperature as high as 15 or 16 deg C when the fan was directly exposed to such low air intake temperatures.I have to admit that such real time software isn't new to me, just the change to a micro-controller and the Arduino IDE. I've served my time as a hobbyist apprentice 40 years ago with a 2MHz Z80 based S100 bus kit built home computer (Transam Tuscan) when 3.5 inch floppy disk drives cost £100 and the FDD controller boards were £150 (plus VAT) making it worthwhile to write the control routines (in Z80 assembler) to drive bare Philips data cassette mechanisms via a home brewed interface board to create a formatted tape storage system (392Kb each side (784KB per C60 cassette) running at 15ips/19.2KBd) for a tape OS of my own creation.Of course, the advent of the IBM PC soon spelled the end of such ingenious ways to get around the expense of disk storage when the price of HD FDDs dropped below the £10 mark with developments in flash ram eventually rendering even blue ray disk storage obsolescent.Technological progress is relentless, leading to micro-controllers such as the nano with more power than a Z80 based desktop PC in the same footprint as the Z80 cpu alone. It's worth gaining familiarity with such micro-controllers if you want to tackle more complex projects. In my case, the need to ensure such precise temperature control and barometric compensation was more than enough motivation to learn how to program the nano to do something more useful than just blink or fade LEDs.I learnt a few tricks over the past two years to wring the maximum performance out of that little nano3 to speed the control loop cycle from a lethargic 2.4Hz to a more spritely 53Hz which allowed much finer control over base plate temperature to improve the RFS's frequency stability. The bottleneck had proved to be the display update code (some 63ms worth versus the 16ms for the rest of the main loop code).I mitigated its effect by only letting the display update code run every 20th cycle. Now I'm seriously thinking of throwing a second nano into the mix to offload this task completely from the main control loop. Not only should this boost the main loop cycle frequency to 75Hz but also eliminate the 2.4Hz 'hiccup' this adds to the existing control algorithm. The nano3s were only about 3 quid each when I bought them and will only add an extra 20mA or so on the 5v rail.The take away from the above is that given enough motivation, you'll find a way to put a micro-controller to productive use soon enough even if it does mean learning C and getting to grips with the arduino (or other) IDE. The trick with the arduino is to use example sketches to take baby steps and combine the ones of interest into a sketch customised to a project of your own making.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 17, 2023, 02:47:35 am
content: Quote from: pcprogrammer on November 16, 2023, 08:00:57 amI have two desktop PC, completely assembled by me. I know every bios setting, I always study the bios to have the best possible setting. I know where the NB and SB are located on the motherboard. Let's say I know where to put my hands inside a PC. For example, I know how to straighten crooked pins on an AMD CPU. I know less about how the CPU interfaces with the various peripherals, I have never studied the processor in depth.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 17, 2023, 03:07:07 am
content: Quote from: Dan123456 on November 16, 2023, 02:48:12 pmThanks for the encouragement, very helpful. I've already made the choice. I will start exclusively with the Arduino Uno (and therefore with the Arduino IDE). And I will start with the starter kit, in addition to reading a good book that I picked up, with various projects for Arduino). As the experts who helped me explained to me (and there are so many experts here), programming with Arduino might not teach me anything with other microprocessors. I'll have to start from the beginning again. But in the meantime I will have learned my skills on a topic I had never dealt with. This experience will certainly help me.Quote from: rstofer on November 16, 2023, 05:50:21 pmOk then I will only install console apps on my windows 8.1.But first I will use Arduino IDE. Will Visual help me with Arduino?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 17, 2023, 03:25:47 am
content: Quote from: Johnny B Good on November 17, 2023, 01:41:35 amI just ordered the Arduino Uno (kit) yesterday, it will arrive on Monday. It seemed more reasonable to me for a beginner like me. For me it will be a new world, full of unknowns, certainly with many obstacles. But I'm not generally a woman who is impressed by scenery. I pull out my nails and move forward with my head held high.I was speechless reading all the steps of this project of yours. I was pleased to read this 'adventure'. But to do this you need to be an expert. Will I be able to do something similar one day? I hope so. Thank you very much for what you wrote.

author: rstofer
author_rank: Super Contributor
timestamp: November 17, 2023, 05:11:11 am
content: Quote from: CharlotteSwiss on November 17, 2023, 03:07:07 amBoth Visual Studio and Visual Studio Code (the IDE/editor only) can be used to develop Arduino code. It's an advanced topic and with the new V2.2.x of the Arduino IDE, I'm not sure it is worth it.https://marketplace.visualstudio.com/items?itemName=VisualMicro.ArduinoIDEforVisualStudioYou'll be using VS to learn C programming with help from that tutorial link I posted a few messages back.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 17, 2023, 06:48:13 am
content: @CharlotteSwiss.Hope you enjoy your Arduino UNO.When you have played with it and want to gain more insights in the hardware side of things here are some links you can look into.https://www.tutorialspoint.com/microprocessor/index.htmhttps://www.techtarget.com/iotagenda/definition/microcontrollerhttps://www.arrow.com/en/research-and-events/articles/engineering-basics-what-is-a-microcontrollerhttps://www.youtube.com/@BenEaterIntroduction_to_the_Z80_MicrocomputerI find Ben Eater to have a pleasant way of telling how things work. He build a 6502 computer on breadboards and gives a lot of information about how things work.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 17, 2023, 11:44:55 am
content: apart from the few unos and megas that i've put in few projects, i'd like to keep some of them handy. recently i figured i've out of stock of mega board, so i made another order while at the same time utilizing one free uno... debugging or figuring out which pin do what? in one "real" circuit. since i know they all work in 3-5V limitation, so arduino is the right choice and handy... code completed faster than i expected, only like 5 minutes and it works. and with latest arduino ide 2.2.1, it can plot nice graph out of serial comm data, nice! but unfortunately i didnt take a screenshot... attached is what i call 12bit digital, 6 channel analog (1-100Sa/s) MSO, since i need many channels to probe, my rigol DS1054Z is a bit limiting in this task, hence the need of arduino to the rescue, fwiw...

author: matts-uk
author_rank: Contributor
timestamp: November 17, 2023, 01:40:13 pm
content: Quote from: CharlotteSwiss on November 17, 2023, 03:07:07 amIf you only read one book make it, Beginning C for Arduino, by Jack Purdum. A bit of searching may even turn up a PDF on Github. Easy to read, short enough to finish and makes an excellent job of teaching C using an Arduino, rather than how to assemble projects.QuoteExperts are great at making simple things sound complicatedMicroprocessors all work in a similar way. They all step through instructions, carry out the same logical operations and comparisons, and they all need a memory to hold binary values. Just about everything else is, 'mere syntax.'C has the advantage of being a small step from the native assembly language. C has the disadvantage of being a small step from the native assembly language. Learn C well, rather than how to assemble projects, and you learn how a microprocessor works which makes switching to other languages a great deal easier. Often it's a case of wanting to do something in some other language, that would be easy in C, and being irritated by the syntax not allowing you to.Good luck and remember to enjoy it.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 17, 2023, 02:20:54 pm
content: Quote from: matts-uk on November 17, 2023, 01:40:13 pmno need book, arduino ide already have code examples openable from menu. no need to complicate things, just buy. one can easily spend the money and even much more on much useless things.

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 17, 2023, 10:46:32 pm
content: Quote from: CharlotteSwiss on November 17, 2023, 03:25:47 amThe Uno is basically a nano3 dressed up in a nice overcoat so a good choice to start off with. At least if you want to transfer your sketch to a more compact board to fit into a space constrained project enclosure, you only need to change the target board setting in the Arduino IDE from UNO to nano and upload the compiled sketch unchanged.Oddly enough, I'd also purchased a UNO R3 kit with two touch screen display modules (2.8 and 2.4 inch TFT panels) from Banggoodshortly afterbuying those nano3s on account of its irresistibly low price (a mere £11 afaicr). I only opened the box to make sure its contents matched the package contents description before adding it to my inventory of "might come in handy one day" spares. After all, I'dalreadymade a start with those nano3 versions of the UNO R3.The point I was trying to make was that I too was inexperienced with the Arduino micro controller boards and their IDE when I first embarked on what eventually proved to be a rather more ambitious project than I'd initially visualised. My previous experience with that Transam Tuscan had been some forty years earlier and its only value by then being that it would leave me no excuse to shy away from tackling a more up to date version of a similar real time software controller exercise.At the start of my project, I was still getting to grips with the Arduino eco-system of processor boards and its IDE - I too was an "Arduino Newbie". Even now, after two years' worth of programming a nano3, I can only claim to have a basic understanding of Arduino's particular dialect of C (or even any dialect of the language for that matter). The only expertise I can make any claim to having is in regard of thermally stabilising and pressure compensating a rubidium oscillator - mainly the difficulties in achieving the 1 E-13 levels of frequency stability that is just possible with a rubidium oscillator.Anyway, I'm absolutely certain that you're going to get a lot more use out of that UNO than I did with mine.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 18, 2023, 03:29:46 am
content: Quote from: rstofer on November 17, 2023, 05:11:11 amOk, for now, I will only use Arduino IDE. As soon as I have experimented with something and begin to understand the C language better, then I will also install VS. Thank youQuote from: Johnny B Good on November 17, 2023, 10:46:32 pmI also hope to get a lot of learning from UNO. In fact, I'm sure I'll learn something from the Arduino. Just having fun, which is the main thing. Thank you for your valuable contribution.------------Thank you all, all your encouragement is very important to me. On Monday I will have the Arduino, I will start this new journey. I will let my emotions be known.

author: tautech
author_rank: Super Contributor
timestamp: November 18, 2023, 09:00:44 am
content: Quote from: CharlotteSwiss on November 18, 2023, 03:29:46 amGood luck with your new voyage.BTW did you know there was a new firmware for your scope from earlier this year ?https://int.siglent.com/upload_file/zip/firmware/Oscilloscope/SDS1202X-E_V1.3.27_EN.zip

author: MarkF
author_rank: Super Contributor
timestamp: November 18, 2023, 10:58:29 am
content: Quote from: CharlotteSwiss on November 18, 2023, 03:29:46 amYou might want to install Visual Studio now while learning C. I often will develop logic or math models in Visual Studio before porting them to the microcontroller. It's just quicker to develop the code without the steps of transfering it to the microcontroller. For example, recently I did some work with fixed point math of a FFT and weighting. Being able to do graphics on the PC to plot the results was a great help. I often work out small snipets of code on the PC before incorporating them into my microcontroller project.The basics of C/C++ code is independent of the platform you're using. It only becomes dependent on the platform/microcontroller when you start trying to talk to the particular hardware.Personally, I find Visual Studio Code difficult to navigate and would recommended the Community Edition of Visual Studio. Maybe that just because I've used the Professional version of Visual Studio for over 25 years. It's hard to teach an old dog new tricks.

author: rstofer
author_rank: Super Contributor
timestamp: November 18, 2023, 02:07:53 pm
content: The Blink example requires no external wiring, it flashes the onboard LED. It's a great place to start.Plug in boardStart IDELoad Blink exampleSort out Board/PortClick on Upload (which compiles before uploading) - Right facing arrow near upper left. Wait for messageWatch for blinking LED.

author: themadhippy
author_rank: Super Contributor
timestamp: November 18, 2023, 02:57:15 pm
content: QuoteAnd introduces the bad practise of using delay.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 18, 2023, 03:58:48 pm
content: Quote from: themadhippy on November 18, 2023, 02:57:15 pmanother wannabe newbie talking?... if you have nothing to do other than to delay the operation for human eyes then what do you do? hundreds of thousands of "nope"? delay() is just a tool, you'll learn another tools (skills) along the way.

author: themadhippy
author_rank: Super Contributor
timestamp: November 18, 2023, 04:06:39 pm
content: Quotenope,just someone who got caught out in the early days with code seemingly hanging up,like everything if you start with bad habits then its harder to learn how to do things correctly further down the line.

author: rstofer
author_rank: Super Contributor
timestamp: November 18, 2023, 05:55:34 pm
content: Interesting scope exercise: Remove the delay() statement and measure the LED frequency with a scope. On time versus off time, that kind of thing. I don't know the answer!The full answer depends on a lot of factors and can be considered an advanced topic.https://forum.arduino.cc/t/maximum-pin-toggle-speed/4378/10

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 18, 2023, 07:30:36 pm
content: Quote from: themadhippy on November 18, 2023, 04:06:39 pmthe problem is the people sticking with bad habits (not blaming the tool). but then if the bad habits serve the people well then whats the problem? the problem is with the "other" people who see or define the habits as bad, or got problem with the habits/tools itself and got rid of them. ymmv cheers.Quote from: rstofer on November 18, 2023, 05:55:34 pmatmel chip on arduino board can be directly programmed in atmel/microchip studio if you need as fast as it can get, the hex file can then be transferred with avrdude. that was the last time i tried with arduino board with ftdi chip, not sure with the latest CH340 cloned boards. but who beginner needs advanced topic? we wont be able to see blinking led at fastest rate, only dimmed led... ymmv.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 03:59:52 am
content: Quote from: tautech on November 18, 2023, 09:00:44 amI replied in the topic of my oscilloscope...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 04:16:53 am
content: Quote from: MarkF on November 18, 2023, 10:58:29 amOk, I'll install VS as soon as I can. I think the free version is the community. With VS, does the 'dialogue' with the ATmega always take place via USB? (in the same way as the Arduino IDE...)Quote from: rstofer on November 18, 2023, 02:07:53 pmI had read that it was the LED on the Arduino. In the meantime, can I observe the C language that makes the LED light up? Can I modify it to learn?Quote from: rstofer on November 18, 2023, 05:55:34 pmIn time and out of time what would it be? I'll do this test as soon as the Arduino arrives...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 04:25:20 am
content: While I'm waiting for the UNO, I've started studying a book about Arduino. I learned that the ATmega used in the Arduino is a microcontroller, which is different from a microprocessor (which would be what we have in computers). I don't know what connections there are between the inventors of the Arduino and the company that produces the Atmega, but the popularity of this board has made this microcontroller very widespread and used.It was explained to me that the actions to turn on are contained in the Atmega boot loader. But where do the instructions we send them with the programming language go to? In a ram? In the eeprom? This new world is starting to attract me

author: Dan123456
author_rank: Regular Contributor
timestamp: November 19, 2023, 05:00:54 am
content: Quote from: CharlotteSwiss on November 19, 2023, 04:25:20 amReally glad to hear you are enjoying it! The options are almost limitless and I find them super addictiveIt’s saved in the EEPROM from what I understandI don’t think it could be saved to RAM as the Aurduino will still “remember” it after it is turned off and on again (so the RAM would be wiped)I think of the EEPROM as it’s hard drive (although that might be technically wrong)Regarding the IDE and seeing the code, it should pop up on the screen after you click the blink examplefrom there you can play with the delay number to change the time the LED spends off or on etc.You can also pretty safely “break” things too! For instance, remove a bracket or change a letter in one of the words (say “HIGH” to “HIGG” or something)This will obviously make it not work properly but is a good example of what happens when the code is wrong and you can just upload the fixed code to make it work again

author: brucehoult
author_rank: Super Contributor
timestamp: November 19, 2023, 05:52:40 am
content: Quote from: CharlotteSwiss on November 19, 2023, 04:25:20 amThat pretty much just means that all the RAM and ROM and peripheral interfaces are built in to one chip. Plus microcontroller tends to mean lacking things such as an MMU required to run a modern real operating system such as Linux / Windows NT / Mac OS X (as did early microprocessors for DOS and Classic MacOS).QuoteBoth are stored in flash memory, similar to an SD card but internal. EEPROM, if present (AVRs have some) tends to be very small and for data only, not instructions.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 19, 2023, 07:54:54 am
content: About the memory in the Atmega take a look at thedatasheetIt might be a bit advanced, but the introduction tells what the different versions give you.To explain about the non-volatile memory terms a bit, FLASH memory is based on EEPROM technology which means electrically erasable programmable read only memory. Its predecessor EPROM which stands for erasable programmable read only memory needed UV light to erase it and could mostly not be done in circuit. See thearticle herefor more information about FLASH memory.In the Atmega chips you get FLASH, EEPROM and SRAM (static random access memory). The FLASH is used to store the program(s), the EEPROM can be used to store parameters and the RAM is used for the variables and the stack.The stack is needed for C to store both program addresses and variable data to make the functions work. When a function is called the program address of the next instruction is stored on the stack and the processor jumps to the address of the function. After the function is finished the processor reads the old program address from the stack and returns to the point after the function call. If the function takes in parameters, these are also placed on the stack and are read by the function to access them.Since the Atmega does not have a lot of SRAM it is good practice to keep things small. When for instance sampling data from an ADC (analog to digital converter) you can only store so much data as is available next to the stack and other variables. The IDE will tell you when it does not fit.Maybe a bit to much at the beginning of your journey, but gives a bit of an insight in the workings of C and microprocessors.

author: brucehoult
author_rank: Super Contributor
timestamp: November 19, 2023, 08:23:36 am
content: Quote from: pcprogrammer on November 19, 2023, 07:54:54 amSome unfortunate misinformation there.The AVR being a RISC processor with 32 registers, function arguments and results are passed in registers where possible. The first up to 8 bytes of function arguments are passed in r18-r25 and a 4 byte result, for example, is returned in r22-r25. Typically for a RISC, other than any registers used to return the function result, r18-r25 are allowed to contain arbitrary values on return from the function i.e. the function can scramble them. Another 8 bytes of function arguments can be passed in r10-r17 but these are required to be preserved on return to the caller. If there are more than 16 bytes of function arguments (quite rare) then those are passed on the stack and then accessed via r28-r29 (aka "Y"), which also then need to be saved on function entry and restored on exit.Here, for example, is AVR code for..Code:int myAdd(int a, int b){return a+b;}Code:myAdd:add r24,r22adc r25,r23retThe stack is used only for the return address.OP doesn't need to know this, but it's better in any case to give correct information, not obsolete CISC-centric information, which has never applied to any RISC CPU I know of since 1985 and is incorrect even for x86_64 (2003).

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 19, 2023, 09:57:29 am
content: Never to old to learnBut to call it misinformation is a bit far fetched.It depends on the processor architecture and the compiler implementation on what practice is used. When the processor lacks the amount of registers, like older architectures they go on stack. With more sophisticated ones they can use registers or even switch register banks for different processes like interrupts. To learn about this behavior one needs to study the assembly code generated by the compiler.But indeed not directly a need to know for CharlotteSwiss.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 19, 2023, 11:14:30 am
content: priority should be given to register, because they are fast one instruction. thats why there is even "register" keyword in c... now i can see where this thread is going, from arduino to stack overflow, and then my way is better than yours

author: brucehoult
author_rank: Super Contributor
timestamp: November 19, 2023, 11:53:00 am
content: Quote from: pcprogrammer on November 19, 2023, 09:57:29 amIndeed so, and we are talking here about the AVR processor found in the Uno R3, and the compiler used by the Arduino IDE, gcc.The same applies to other processors you might find in Arduino-compatible boards, such as Arm and RISC-V.QuoteThe only such processors most people here are at all likely to come across that put function arguments on the stack are 32 bit x86 and Motorola 68k. And that's not very likely -- both are in the distant past for most people not into retro-computing.8 bit processors such as 6502, z80, 8051, PIC don't have sufficient support for stack access to efficiently pass function arguments on the stack and tend to use some combination of registers and fixed RAM locations.16 bit MSP430 has two different ABIs, but both pass function arguments in r12-r15 (the ABIs have opposite allocation orders for these registers), and return the function result in r12 or r15 (whichever holds the 1st argument).QuoteThat gives some idea, certainly, but better to read the platform or compiler ABI documentation to get full details.

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 19, 2023, 12:32:27 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 03:59:52 amI hadn't realised they'd actually issued another firmware update (too busy using it 24/7)So my thanks to tautech for that one.

author: MarkF
author_rank: Super Contributor
timestamp: November 19, 2023, 12:39:26 pm
content: Re: Your question about the Visual Studio IDE and the Arduino IDE.QuoteVisual Studio has absolutely NOTHING to do with anything Arduino. You install Visual Studio Community Edition (Free) to write programs that will run on a PC and to learn C programming.The Arduino IDE is used to write C programs that will run on the UNO and to transfer those programs to the UNO.However, you can test a piece of code (say some math equation for example) in VS on the PC. Then when it works the way you want, copy that code into an Arduino IDE program and run it on the UNO. Obviously, you can't do anything hardware related. Be aware while doing this that variable sizes will differ between the PC and UNO. All integers and floats are not create equal.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 03:04:56 pm
content: Quote from: Dan123456 on November 19, 2023, 05:00:54 amI will definitely play around with modifying the programmed code. But if I change the blink, this example won't work anymore, I'll have to reset the code for it to work again (I think).Quote from: brucehoult on November 19, 2023, 05:52:40 amOk, let's see if I understood correctly: therefore a microprocessor also has the instruction that allows it to manage an OS, while the microcontroller does not. For example, the Atmega328 therefore has an internal flash memory, where both the boot loader and the programming code are kept. Eeprom is not present in all microcontrollers (and it is different from flash memory), however, in the atmega328 we also have the eeprom.Quote from: pcprogrammer on November 19, 2023, 07:54:54 amI had already written in the previous message before reading further...So our Atmega 328 has flash memory (boot loader, programming code), an eeprom and also an sram (probably volatile, like PC ram I imagine).This is already an advanced discussion, I'll get there little by little, thanksQuote from: brucehoult on November 19, 2023, 08:23:36 amIn fact I didn't understand much about those advanced functions, for now I'll move on to the basicsQuote from: MarkF on November 19, 2023, 12:39:26 pmOk, so let's say that VS could only be used to learn the C language better. The VS c language will be quite different from the one generated with the Arduino IDE.

author: rstofer
author_rank: Super Contributor
timestamp: November 19, 2023, 03:41:11 pm
content: QuoteSave the code with a different file name before you make changes.Code:/*BlinkTurns an LED on for one second, then off for one second, repeatedly.Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZEROit is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set tothe correct LED pin independent of which board is used.If you want to know what pin the on-board LED is connected to on your Arduinomodel, check the Technical Specs of your board at:https://www.arduino.cc/en/Main/Productsmodified 8 May 2014by Scott Fitzgeraldmodified 2 Sep 2016by Arturo Guadalupimodified 8 Sep 2016by Colby NewmanThis example code is in the public domain.https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink*/// the setup function runs once when you press reset or power the boardvoid setup() {// initialize digital pin LED_BUILTIN as an output.pinMode(LED_BUILTIN, OUTPUT);}// the loop function runs over and over again forevervoid loop() {digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)delay(1000); // wait for a seconddigitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOWdelay(1000); // wait for a second}I would tend to remove most of the text and just keep the code and comments. About 12 lines are useful, 25 are just boilerplate.You can compile the code without having a physical board attached to the PC.I might remove the comments as well. Why do you think they call it code? Kidding...

author: MarkF
author_rank: Super Contributor
timestamp: November 19, 2023, 03:48:47 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 03:04:56 pmThat is not exactly what I said. Visual Studio can help you learn the C language. But it can also help you design new code before putting it into the UNO. For instance in my example math model... Say you had a very complex math equation you needed to program. You could first write it in VS and test it with all the capabilities provided on a PC to debug. For example you could graph the output over a range of input values to see if you get the expected results. Recently I needed to approximate a 20*log(x) using fixed-point math without using the log() function for increased execution speed. On the PC I plotted the approximation on top of the log() version for comparison. (You will not necessarily have a large screen with graphics available attached to the UNO. When I was satisfied with the results, I ported it to a PIC32 microcontroller.The C language is basically the same for all platforms. The differences start to come in due to differences in hardware. On a microcontroller an integer may be 16-bits where-as on a PC it could be 32-bits. A PC does not have an ADC built-in but most microcontrollers do. On and on. But, you can leverage the commonalities to help you design complex programs. The C syntax is the same for both with only minor differences mostly due to the compiler.You can take advantage of the capabilities of a PC to design and test elaborate logic, math or any modelling required by your program before porting it to a small microcontroller with limited debugging capabilities.Maybe it's better for you to tuck this away for later when you're more experienced. Just think of Visual Studio as a way to learn C at first. I've been writing code since the late 70s with punch cards and paper tape. Mostly doing modelling and simulation. I could just be giving you too much information up front.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 04:38:11 pm
content: Quote from: rstofer on November 19, 2023, 03:41:11 pmI'm starting to understand that some pre-compiled codes for Arduino are full of useless lines.I try to leave only what is necessary for the blink, have I won?Question: 1000 represents a time, does it represent milliseconds?----------------------------------------------void setup() {pinMode(LED_BUILTIN, OUTPUT);}void loop() {digitalWrite(LED_BUILTIN, HIGH)delay(1000)digitalWrite(LED_BUILTIN, LOW)delay(1000)}--------------------------------------------------Which without yet having the basics, tells me:-high signal (current to LED, therefore LED on)-ignition time 1000-low signal (no current to the LED, therefore LED off)-shutdown time 1000-loop (so the sequence repeats infinitely).However, I have to understand how this code (instruction) goes exactly to that LED on the Arduino!lighting: evidently Led_builtin represents that LED.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 04:45:18 pm
content: Quote from: MarkF on November 19, 2023, 03:48:47 pmOk, now it's clearer. However, I understood that the c language was approximately the same for all microcontrollers, except for some 'nuances' of the compilation software.In the meantime, I think of VS as a software for learning to write in C. Then I will see how to use that code on a microcontroller (atmega328 first and foremost).Thanks

author: xrunner
author_rank: Super Contributor
timestamp: November 19, 2023, 04:46:59 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 04:38:11 pmIt does.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 04:52:57 pm
content: Quote from: xrunner on November 19, 2023, 04:46:59 pmSo in the C language, a time is always filled in milliseconds.

author: zapta
author_rank: Super Contributor
timestamp: November 19, 2023, 05:12:55 pm
content: Embedded programming is fun and useful. I think that your first choice should be, what programming language you want to use, e.g. C++ (most popular for Arduino), Python (modern and most friendly), or Basic (arcane).Once you decide a language, you can pick a board that is a good fit for learning that language. E.g. Arduino Uno for C++ (it's the canonical Arduino board), or an RP2040 based board for Python (MicroPython or CircuitPython)Adafruit is a good source for Python boards and information.

author: MarkF
author_rank: Super Contributor
timestamp: November 19, 2023, 05:23:25 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 04:52:57 pmThe time I spent on a UNO was just long enough to try the blinky program.However, I believe there is also a micro-second function. Might be a different name.On the Microchip PIC microconrollers there are both. __delay_ms(t) and __delay_us(t).You need to always lookup the definition on whatever platform you're using.That goes for all built-in functions.

author: rstofer
author_rank: Super Contributor
timestamp: November 19, 2023, 05:58:40 pm
content: Quote from: CharlotteSwiss on January 02, 1970, 11:14:01 pmSomewhere, buried in an obscure header file that you need not reference, LED_BUILTIN is defined as the appropriate pin for the specific board selected for the project.In theory, you can use that macro (those kinds of definitions are called macros) and it works for any board. I might look at the schematic and define the pin myself. Many examples declare the pin at the top of the code. Before setup()...Here's a site you should bookmark:https://www.arduino.cc/reference/en/

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 19, 2023, 07:06:27 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 04:52:57 pmNot correct. The delay function in the Arduino environment uses milliseconds. There is also a function millis(), that gives you the current number of the milliseconds counter. This can be used to check if some code takes to long and needs to be terminated.As I wrote before the C language has a basic set of instructions and a large set of added functions. An instruction is something like the "if" or "while" statement. A function is for example millis() or delay() or digitalWrite() for that matter.It is good to get an understanding about the difference between these. The instructions are part of the basic syntax and apply to every system you code for being a PC or a microcontroller. The functions come in libraries and can differ from system to system.See the code below which gives a time out on the while loop. If the variable "flag" is changed by for instance an interrupt routine before the timeout the loop will exit due to that, otherwise it will exit when a second has passed. Setups like these can protect your code from hanging due to unforeseen mishaps.Code:int current = millis();int flag = 1;while(flag){if((current + 1000) > millis())flag = 0;}Also bare in mind that C is case sensitive. "IF" will cause and error when used for "if". Naming of variables can be confusing because "ThisVariable" is not "thisVariable". Mistakes are easily made with this.

author: MarkF
author_rank: Super Contributor
timestamp: November 19, 2023, 07:16:35 pm
content: Quote from: rstofer on November 19, 2023, 05:58:40 pmAs @rstofer indicated, LED_BUILTIN is typically defined as "digital pin 13". If you can read schematics, the UNO digital pin 13 is connected to the LED through a driver chip. See highlighted.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 07:52:34 pm
content: Quote from: zapta on November 19, 2023, 05:12:55 pmI decided to start with Arduino, then with C++. It's arriving tomorrow...Quote from: MarkF on November 19, 2023, 05:23:25 pmI just looked, the delay of the Arduino + IDE expressed only in msThanksQuote from: rstofer on November 19, 2023, 05:58:40 pmQuote from: pcprogrammer on November 19, 2023, 07:06:27 pmYes, I read about the delay function. The code you listed, for now I have understood in large lines, that is, 'if' is the condition that would cause the 'flag' function to exit (0 = out). I hope by gaining experience with the basic Arduino exercises to get to grips with this language.Quote from: MarkF on November 19, 2023, 07:16:35 pmThis means that the 'blink' code controls that LED coming out of the sck pin of the atmega328 (if I haven't misunderstood)Thanks

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 19, 2023, 08:30:45 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 07:52:34 pmCorrect. A little insight in the naming of the pins. In the schematic you can see it named PB5 with the mention of SCK. The PB stands for Port B. In the iners of the Atmega P328 there are several peripherals of which one is the SPI (Serial Peripheral Interface). But it also has GPIO which means general purpose input output. For many pins of the chip it can have multiple functions. When enabling the pin as digital output it uses the GPIO module and the pin has then no other use case then being able to set it low or high. When enabling the SPI the pin PB5 becomes connected to the SCK of the SPI. Now this pin has the function of being the clock signal for the SPI. In this case PB3 and PB4 are also connected to the SPI to become the data input and output signals.Pins can even have more abilities like becoming an interrupt input or an analog input.More information about this can be found in thedatasheetof the Atmega microcontrollers.

author: brucehoult
author_rank: Super Contributor
timestamp: November 19, 2023, 09:49:56 pm
content: Quote from: CharlotteSwiss on November 19, 2023, 04:52:57 pmNo. Only for thedelay()function in the Arduino library. There is alsodelayMicroseconds()in the same library.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 19, 2023, 11:57:26 pm
content: Quote from: pcprogrammer on November 19, 2023, 08:30:45 pmWell, when we talk about pins, it becomes very interesting for me. It will be one of the first things I will have to learn, namely the work that the 28 pins of the atmega328. I have already downloaded the microcontroller datasheet, as soon as I have any doubts I will consult it.Quote from: brucehoult on November 19, 2023, 09:49:56 pmI had only looked at the delay() function. Thanks for the information.

author: JonMorton
author_rank: Contributor
timestamp: November 20, 2023, 12:35:51 am
content: Wow! it’s monster thread about Arduino…Did you ever see thelink?It may simplify you life:)I suggest go straight to learn C, it’s simple and logical language.For now forget C++ and forget for good crap like BASIC, PASCAL, REXX and similar dinosaur languages, it’s waste of time.At one point you will start feeling that you’re missing something with C, then go forward and start C++, or similar.

author: EEVblog
author_rank: Unknown
timestamp: November 20, 2023, 12:41:25 am
content: Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pmYes, it's as a good a place to start as any. The advantage is the MASSIVE community and suppot behind the whole ecosystem. And you are basically learning the C language which is what you want.

author: EEVblog
author_rank: Unknown
timestamp: November 20, 2023, 12:42:55 am
content: Quote from: JonMorton on November 20, 2023, 12:35:51 amArduino IS the C language. It's just that it comes with lots of higher level routines to make your life easier, but it's still C.

author: brucehoult
author_rank: Super Contributor
timestamp: November 20, 2023, 12:59:56 am
content: Quote from: EEVblog on November 20, 2023, 12:42:55 amIt's C++.You can't write code likeSerial.begin(9600);in C.The "Wiring" language (as they call it in their documentation) was originally designed to be source code compatible with both C++ and Java, with a little pre-processing for both: forward declaring all your functions for C++ so you could write them in any order, and putting class bollocks around your code for Java. But they stopped talking about the Java version a decade ago I guess.

author: JonMorton
author_rank: Contributor
timestamp: November 20, 2023, 01:01:41 am
content: Quote from: EEVblog on November 20, 2023, 12:42:55 amYes, but the routines are only functions in the libraries. I believe that learning the C language from scratch will simplify learning. The ANSI C it’s only 30+ command and on top of that are functions in the standard libraries. Once when a person understand the concept then the person will understand the rest. If somebody will start learning from within the the middle then will never be good with analyzing anything.The same applies to EE, if you know all the basic laws and algebra you may accomplish everything, but not vice versa.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 01:04:37 am
content: Quote from: EEVblog on November 20, 2023, 12:41:25 amThanks for the video, I will definitely watch it. I didn't even consider other older languages. I just asked which one of the most current and widespread was, so I set my sights on C. To tackle it, since I know almost nothing about digital, I then decided to get an Arduino. Tomorrow he will come to my house for the first time. Happy.Quote from: EEVblog on November 20, 2023, 12:41:25 amExactly, the choice fell on the Arduino also due to the huge amount of material available online

author: EEVblog
author_rank: Unknown
timestamp: November 20, 2023, 01:33:25 am
content: Quote from: JonMorton on November 20, 2023, 01:01:41 amThe problem is you are forgetting thewaypeople learn, and the importance of enthusiasm.If you have a beginner say "I want to learn microcontrollers", and you reply with "You have to learn C from scratch", what does that do to theirenthusiamfor learning?I kills it for most people is is what it does.On the other hand, grabbing an Arduino and some existing working code and getting your LED to blink first go gives that endorphin rush you need to be enthusiastic about continuing.You can argue all you like that learning from scratch is "better", and you wouldn't necessarily be wrong. But if that person gives up in frustration then you have failed.It's the age old debade about learning electronics. Do you start with a breadboard a LED batetry and switch. Or do you start with the phsyics of what an electron is?QuoteDemonstrably untrue.

author: brucehoult
author_rank: Super Contributor
timestamp: November 20, 2023, 01:55:16 am
content: Quote from: EEVblog on November 20, 2023, 01:33:25 amAbsofrigginlutelyRun Blinky. Modify the constants to make it blink faster or slower, or asymmetrically. That's power!Attach an LDR to an analogue input and make that LED blink faster or slower as you move your hand closer or further from the LDR. Now, that's MAGIC.

author: JonMorton
author_rank: Contributor
timestamp: November 20, 2023, 02:34:22 am
content: Quote from: EEVblog on November 20, 2023, 01:33:25 amYou’re probably right, I forgot about the enthusiasm, I was looking from the educational perspective.I do remember when I was studying electronics and computer engineering in late 80s / early 90s. 1st year was 95% pure math, DC and magnetism, 2nd year the same but AC and RF, and later the fun stuff. In the middle of 1st year ~30% students quit/changed directions… I wasn't very happy either. But when I got my 1st job I understood that the extensive basics and math did pay off!Quote from: EEVblog on November 20, 2023, 01:33:25 amI’m not trying to start a debate, but I would disagree.An example: Somebody told me that P=U^2/R what is true, and I asked but why? … the person couldn’t explain…2nd example, I spoke with a person with associate degree in EE, in the middle of conversation came dB topic. This person couldn’t clearly explain why the multiplier factor is 20 and not 10 while it’s about dBV… (who were examiners?).

author: Dan123456
author_rank: Regular Contributor
timestamp: November 20, 2023, 03:04:20 am
content: Quote from: JonMorton on November 20, 2023, 02:34:22 amI think you are both rightIf you want to do it professionally, yeah, you probably need to learn all the theory and “boring” stuff to give you a foundation before moving into the application side of things (although there are plenty of examples of self taught people building incredible things in their garage too so it does depend on the person)However, when you’re talking the hobby side, fun should be above everything elseIf something is fun, you want to learn more and more and more. You might be going about it “backwards” from a formal training perspective and it might take you a little longer to fully understand overall, but if you end up learning just as much in the long run, I say the fun option is by far the best way to learnAnyways, I don’t want to be the one who throws Charlotte’s thread completely off topic so will leave it there

author: zapta
author_rank: Super Contributor
timestamp: November 20, 2023, 03:10:17 am
content: Quote from: CharlotteSwiss on November 19, 2023, 07:52:34 pmGood choice. You took the mainstream route, and can benefit from gazilions of books and youtube tutorials. For example, this book is highly considered but there may be others.https://www.amazon.com/Exploring-Arduino-Techniques-Engineering-Wizardry/dp/1119405378BTW, Arduino is programmed with C++ so you will also start with C++ tomorrow. ;-) The 'Arduino language' is a scam, i't actually a full blown C++ using a standard C++ compiler. For example, all the code snippets in this thread are C++.

author: brucehoult
author_rank: Super Contributor
timestamp: November 20, 2023, 03:41:03 am
content: Quote from: zapta on November 20, 2023, 03:10:17 amThe Arduino language, "Wiring", was officially originally confined to a common subset of C++ and Java (and J2ME at that, I believe). The library is designed around that, and I think the example code probably still is too.No one has cared about the Java version since ... maybe 2010?And of course nothing prevents you using full C++ in your own code.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 20, 2023, 04:02:49 am
content: Quote from: JonMorton on November 20, 2023, 02:34:22 amwe have imagination and enthusiasm since before we can read. we built things before we can read. long story short, i'm sorry for your boring study time i know what you went through, this is what i afraid what my kids are going to go through... studying without knowing why they are studying it, only realizing it only when they go to work. that just if in lucky case as you, passed the grade, what about those unlucky chaps dropped out? if they have some basic tinkering before school, they can get good grade because they can appreciate what they are taught along the way. btw, if you look carefully c/c++ keywords, they cant do anything usefull to human, they can only do process in eon, in order to become usefull to human, it need display on screen, no c/c++ keywords alone can do that, it needs libraries of low level language asm to make display.. so learn c/c++ from scratch? think again. we all learnt from "printf"

author: tautech
author_rank: Super Contributor
timestamp: November 20, 2023, 09:57:20 am
content: Almost makes me drag out the Zilog Z8 Encore development kit I was given some years back....maybe smaller steps with an Arduino first might be best.Bruce, I should really get around to dropping by for some pointers.....maybe next year when I can see some gaps.You still just a bit north of us ?

author: brucehoult
author_rank: Super Contributor
timestamp: November 20, 2023, 10:56:45 am
content: Quote from: tautech on November 20, 2023, 09:57:20 amIf you head up Old North Road and Peak Road (always my choice of route if I'm going to the airport, because it's far more fun than Dome Valley etc and never has traffic jams) then google says 2:35 to me right now. Or ±1 min the other way. Whatever.I'm quite likely to meet some friends in Ak at Christmas (not my family this year)

author: tautech
author_rank: Super Contributor
timestamp: November 20, 2023, 11:25:27 am
content: Quote from: brucehoult on November 20, 2023, 10:56:45 amWould love to host you, even for just a coffee however we'll be away for a few weeks over Xmas.Will be in touch.....

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 12:10:57 pm
content: Quote from: brucehoult on November 20, 2023, 01:55:16 amI went to watch a video on the Arduino LDR project. It will definitely be one of my first testsQuote from: zapta on November 20, 2023, 03:10:17 amThanks for the literary suggestion. Exactly, starting tonight I will be dealing with C++ for the first time (courier arriving...). I'm sure that by doing the various exercises in the kit I got, I will start to become familiar with the basics of the language. The simple basics, because today, if I see certain codes, they make me lose my desireQuote from: Mechatrommer on November 20, 2023, 04:02:49 amThe famous printf(), hello world. I also learned this before starting, with this function I will be able to write a text on a peripheral display.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 12:18:50 pm
content: Yesterday I started installing Visual Studio (only the C++ development package), but once I started the installation it told me that Windows 8.1 was not supported. It was still 11GB of space (only that package), maybe there were a lot of optional options selected.Nothing come on, now I start the other SSD where I have the Windows 11 test in work (I have to understand if it works with my old HW). It's time to move to a new OS, so in addition to VS, I can also install the latest version of the Arduino IDE (2.2.x).Note on my old HW: with this passion of mine for fixing electronic parts, there is no way to buy a new PC with a modern OS. Always repairing parts! Nothing gets thrown away around here!

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 20, 2023, 12:44:23 pm
content: Another OS option could be linux. Runs quite well on older hardware, but does have some pitfalls when it comes to Arduino. Sometimes additional actions are needed to get the permissions set for using USB devices.About the famous printf() it differs on the Arduino, where it depends on the library for the display what is used. For instance when you want to use the terminal on your PC as output device for the Arduino, you can use the serial object. Seehttps://www.arduino.cc/reference/en/language/functions/communication/serial/print/I called it an object, because that is the C++ naming for these type of things. Seehttps://www.w3schools.com/cpp/cpp_classes.aspSo serial is an object and to print something you call the function print found in the object. "serial.print()"

author: SuzyC
author_rank: Frequent Contributor
timestamp: November 20, 2023, 01:57:50 pm
content: There are several videos on Youtube that show how to easily install and run Microsoft Visual Studio if your PC is now using Windows 8, 8.2, 10 or even 11.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 02:03:57 pm
content: Quote from: pcprogrammer on November 20, 2023, 12:44:23 pmI didn't understand the difference between 'serial.print()' and 'print(). Maybe different programmers require a different format? But calmly over time, I will understand

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 02:07:08 pm
content: The Arduino UNO band has finally arrived on my bench.The study will be very long, time is always limited for this passion of ours.Tonight I'll at least start connecting it to the PC...Thank you all for your interest.Can't see the image?I'll try with another image... Ok, it seems to work

author: themadhippy
author_rank: Super Contributor
timestamp: November 20, 2023, 04:22:45 pm
content: QuoteCall that an arduino on the bench? Way too tidy and organised. This is an arduino (nano) on the bench

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 20, 2023, 04:33:09 pm
content: Quote from: CharlotteSwiss on November 20, 2023, 02:03:57 pmThe difference is in the target where the output is send to.On the Arduino different classes are used for the different targets. "serial" is for communicating via the UART, which is connected to an UART to USB bridge and then to an USB port on your computer. Within the Arduino IDE you can open the serial monitor and see what your Arduino is sending.In C/C++ there are different print() functions with different targets, which can be the display (console) or a file on disk. Seehttps://en.cppreference.com/w/c/io/fprintffor more information about this.On the Arduino the "serial" object can be used to send messages to the PC, but it can also be used to receive a message from the PC. You will get there when playing with the different examples. In your 37 sensor kit there will be sensors that measure for instance temperature, and this data can be send to the PC. Lots for you to play with.

author: fourfathom
author_rank: Super Contributor
timestamp: November 20, 2023, 04:53:00 pm
content: Quote from: brucehoult on November 20, 2023, 03:41:03 amOr using generic C.I've used other IDEs with Arduino-compatible boards, but lately have been using the Arduino IDE because it's simple and easy to set up. My own code is almost always plain-vanilla C, but sometimes I want to take someone else's C++ code (usually a library) and modify it to suit my own purposes, so I do know enough C++ to make that work.But the Arduino IDE does just fine with a mix of C and C++. If I were starting out I would probably learn C first (because it has less baggage than C++), and use that with the Arduino IDE. Learning C++ can happen gradually. The fact that the libraries are written in C++ can be pretty invisible.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 05:58:05 pm
content: Quote from: themadhippy on November 20, 2023, 04:22:45 pmI am a strictly tidy woman (on the workbench). Then oh well, I don't publish photos of my room, my bathroom...Quote from: pcprogrammer on November 20, 2023, 04:33:09 pmThanks for the explanation, you're right, playing with the kit, in a few weeks I'll start to understand something. Now I'm sailing in the dark. Interestingly, sensor data can be stored on the PC. I will learn.In the meantime, I installed the latest Arduino and VS IDE on Windows 11 (here on Windows 8.1 almost nothing works anymore, too bad). I just opened VS out of curiosity, wanting to create a project in C++: obviously I didn't know how to write anything, it was just out of curiosity. It looks like a nice piece of software though. I also copied some code from the web into C++ (kello world), pasted into the first few lines of VS, but nothing lists a lot of errors. The time will come to learn something. Thank you

author: MarkF
author_rank: Super Contributor
timestamp: November 20, 2023, 07:36:30 pm
content: Quote from: CharlotteSwiss on November 20, 2023, 05:58:05 pmNot sure how much has changed since VS-2013.Goto File->New and create a new "Win32 Console Application".Open the "filename.cpp" file where "filename" will be the project name you entered.Insert the following code:Code:#include "stdafx.h"int _tmain(int argc, _TCHAR* argv[]){printf("Hello World");getchar();return 0;}Then run the program. A text window will appear.Press the Enter key to exit.

author: brucehoult
author_rank: Super Contributor
timestamp: November 20, 2023, 07:42:16 pm
content: Quote from: CharlotteSwiss on November 20, 2023, 02:07:08 pmLooks like a good starter kit! And it's on 35% discount ($42 vs $65) Black Friday deal at Amazon.I like that it's got a DIP ATMega328P, an LCD display, 1 and 4 digit 7-segment displays, unipolar stepper motor (the usual one used for A/C louvers), 9g servo, and I think a simple DC motor, and all manner of interesting sensors including IR, ultrasound distance, temperature and humidity. Even a couple of chips including a 595 shift register.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 20, 2023, 11:37:34 pm
content: Quote from: MarkF on November 20, 2023, 07:36:30 pmThanks Mark, later I will boot windows 11 where I have VS and tryQuote from: brucehoult on November 20, 2023, 07:42:16 pmI haven't connected anything yet, but anyway as you said, it's actually a very complete kit (including the sensors). I would say that Elgoo packaging was also excellent. Happy purchase from this seller!

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 21, 2023, 05:29:27 am
content: meh... you can just buy $10 bare board and snap led or any sensor circuit on separate breadboard. What fun for a repair tech to buy kit?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 21, 2023, 12:39:03 pm
content: Quote from: Mechatrommer on November 21, 2023, 05:29:27 amWith just the Arduino UNO, perhaps I would have risked going nowhere and abandoning. With the kit I will have many hours of experiments ahead of me that should teach me something. I remember that I start from ZERO in the digital and microcontroller fields.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 21, 2023, 12:41:38 pm
content: Quote from: MarkF on November 20, 2023, 07:36:30 pmI tried again, my VS is the 2022 version, I think it's different from your examples. I open a project in C++, but when I then paste the code of your example, it returns at least 4 errors. But maybe I'm starting from the wrong line, I don't know. I'll get there.

author: MarkF
author_rank: Super Contributor
timestamp: November 21, 2023, 01:06:32 pm
content: Quote from: CharlotteSwiss on November 21, 2023, 12:41:38 pmYou'll have to give me more to work with. I'm running Win 7 and Visual Studio 2013.This reminds me of the year I spent trying to teach my Mom to use a computer. I would usually get "It all went off."

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 21, 2023, 01:17:31 pm
content: Quote from: MarkF on November 21, 2023, 01:06:32 pmThese are the first steps (crawling) with VS and C languageTonight when I'm on the PC where I have VS, I'll try to make a list of my steps.I was curious to simply see a few lines and the result.Thanks Mark

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 21, 2023, 01:39:18 pm
content: With VS you can make different type of projects. For the given one a console project is needed, which opens a command (cmd) window and displays the message. An other project type is a graphical window, where you have to define GUI (graphical user interface) items to be able to display a message.My guess is that the project you are using is for a GUI and not a console, and therefore fails with errors.Maybe you are better of to start with the W3Schooltutorialmentioned earlier, where everything is done online.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 21, 2023, 02:10:18 pm
content: Quote from: pcprogrammer on November 21, 2023, 01:39:18 pmYou're right, it's not my intention to start with VS first. I will do it after having experimented at least something on the Arduino IDE. I'm probably wrong which project to open, I'll take a closer look tonight. Thank you

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 21, 2023, 02:31:08 pm
content: Quote from: CharlotteSwiss on November 21, 2023, 12:39:03 pmif you like me, you'll play with the kit only very little hour and they will spend the rest of their life collecting dust. there will be not enough hours for you to handle what come next.. this journey will never be enough, cheers.

author: xrunner
author_rank: Super Contributor
timestamp: November 21, 2023, 02:38:13 pm
content: Quote from: Mechatrommer on November 21, 2023, 02:31:08 pmAnd if she isn't like you she'll play with it for many hours ...

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 21, 2023, 02:59:40 pm
content: Quote from: xrunner on November 21, 2023, 02:38:13 pmand that will be enough for her...

author: rstofer
author_rank: Super Contributor
timestamp: November 21, 2023, 03:17:07 pm
content: Here is the total code necessary for HelloWorld to work. Nothing more, nothing less:Code:#include <stdio.h>int main(void){printf("Hello World\n");return 0;}Open VSFile->New->Project<ConsoleApp><Next>Pick a project name - HelloWorld works (unless it is already used)<Create>Delete all code from file and paste code from aboveFile->Save As->HelloWorld.c {The Save As entry is loaded with other text - ignore it}Click the little green arrow just to the left of "Local Windows Debugger" or <Debug><Start without debugging>You should wind up with "Hello World" on a console window along with some messages.

author: rstofer
author_rank: Super Contributor
timestamp: November 21, 2023, 03:25:51 pm
content: Quote from: CharlotteSwiss on November 21, 2023, 02:10:18 pmArduino Blink project should be first.Connect board and start IDEFile->Examples->01.Basics->BlinkSelect proper board and portCompile and Upload (Green Right Arrow at upper left)LED should start blinkingAnything else, post the error output.

author: MarkF
author_rank: Super Contributor
timestamp: November 21, 2023, 03:27:12 pm
content: Charlotte here is a quick video on how to get started with a Visual Studio "Hello World" program.He creates an "Empty Project" at time 2:45.After you get his example working, go back and create a "Console App" (it's right below the "Empty Project") and start a second time from there. I usually create a "Console App" because it gives you a template to build on. Try both ways and do whichever you're comfortable with.Also, he does streaming I/O instead of printf(). I always do printf() so that I can format the output. Like 2 decimal places for a float instead of 20.... Again, it's a personnel choice.When you get to the point of creating Win32 graphic applications, you will definitely want VS to give you a template. It's a lot of work to make one from an empty project. (But, this is far down the road for you.)It looks like he has a lot of other videos that might help you learn C/C++.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 21, 2023, 07:56:58 pm
content: Quote from: Mechatrommer on November 21, 2023, 02:31:08 pmNow I think about the present. We'll see tomorrow about the futureQuote from: rstofer on November 21, 2023, 03:17:07 pmI'll try later, this time I feel like I might succeed.Unfortunately it is a period full of work commitments, I have not yet managed to connect the Arduino. Better times will come for my passions!Quote from: rstofer on November 21, 2023, 03:25:51 pmOf course, the blink will be my first experiment. I also want to monitor the signal coming out of the MC pin with the oscilloscope.Quote from: MarkF on November 21, 2023, 03:27:12 pmThanks Mark, as written just above, I will try this project with VS later. With VS, after many hours spent with the Arduino kit, I would like to start understanding the C (and C++) language better. I don't think I'll ever get to do graphic projects, but for me the important thing is knowledge (for now).

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 22, 2023, 11:15:41 am
content: Quote from: rstofer on November 21, 2023, 03:17:07 pmI opened the console app project in VS, I pasted the code for hello world, but it renders two errors:-for #include Error E1696 unable to open hw source file error code "stdio.h"-for printf Error E0020 identifier "printf" not definedPremise: when opening a new console app project, it automatically compiles the code for hello world, but even that case produces two errors.

author: brucehoult
author_rank: Super Contributor
timestamp: November 22, 2023, 11:22:01 am
content: Quote from: CharlotteSwiss on November 22, 2023, 11:15:41 amWhat did you install, that it is missing essential libraries?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 22, 2023, 11:51:29 am
content: Quote from: brucehoult on November 22, 2023, 11:22:01 amIn fact, I think I didn't install what was needed.I had chosen C++ development and then left all the optional options checked.But I think the necessary libraries are missing!The problem with this SSD with Windows 11 under test is that it only has 60 GB, and it's full! I need to clone to a 128GB SSD, and reinstall VS

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 22, 2023, 11:59:06 am
content: why do you need to install the humongous VS? do you want to learn to become full scale programmer? if you just follow code example from arduine IDE, you can have led blinking already today... or print "hello world" on serial comm already.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 22, 2023, 12:07:21 pm
content: Quote from: Mechatrommer on November 22, 2023, 11:59:06 amThey are two separate paths, Arduino for its world (adapted C++ language), VS for the basics on the C++ language.However you are right, my priority is Arduino (VS at the time was just a small exercise out of curiosity).

author: rstofer
author_rank: Super Contributor
timestamp: November 22, 2023, 05:37:09 pm
content: Give w3schools a shot before you get into VS & C. Everything is online, nothing to install and a fairly comprehensive program. They have a program for C++ as wellhttps://www.w3schools.com/c/index.phpYou can still cross-reference with K&R.This doesn't need to stall your work with Arduino examples since you will likely be copying given code and possibly tweaking it a little bit. Concurrency may even be a benefit.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 22, 2023, 07:09:18 pm
content: Having already installed VS, so I wanted to just try how it worked by writing a few lines and seeing the result. I understand that I'm new to the C/C++ world, but I feel incompetent that I can't even write the code for hello world!The program tells me 'include' and 'printf'.I don't understand if it's a syntax error or a library error.Depressing

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 22, 2023, 07:31:26 pm
content: Quote from: CharlotteSwiss on November 22, 2023, 07:09:18 pmyou need to reinstall VS with its complete standard libraries.. no problem with code there imho..

author: zapta
author_rank: Super Contributor
timestamp: November 22, 2023, 09:29:42 pm
content: Quote from: CharlotteSwiss on November 20, 2023, 12:18:50 pmVisual Studio is arcane and complex. To start with the Arduino, the Arduino IDE is the easiest and most intuitive, and will take you a long way.Latter, when you will want more advance tools you can use Visual Studio Code (a more modern IDE from Microsoft) and a plugin called platformio, that makes it supporting Arduino.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 22, 2023, 10:45:38 pm
content: Quote from: zapta on November 22, 2023, 09:29:42 pmI would only try hello world with VS for now. Of course, Arduino is my main interest. I just didn't appreciate installing a 15GB software without being able to do that simple code. Thank you

author: Electro Fan
author_rank: Super Contributor
timestamp: November 22, 2023, 11:09:33 pm
content: Start with the Arduino IDE.If you need some additional adventure maybe try codeblocks for C and C++.Both will have abundant learning resources here and elsewhere.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 23, 2023, 12:43:13 am
content: Quote from: Electro Fan on November 22, 2023, 11:09:33 pmOf course I have to start with the Arduino IDE. With the kit's tutorial I will have no problem learning. For VS or other compiler there will be time when I have learned at least the basics.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 23, 2023, 03:20:08 am
content: I wouldn't be able to sleep if I didn't solve the 'elementary' problem. First I argued for many hoursto clone the OS onto a larger SSD; then I added many packages to VS. Here I was finally able to say goodbye to the world. Happy. Now I can move on to the Arduino IDE

author: xrunner
author_rank: Super Contributor
timestamp: November 23, 2023, 03:33:00 am
content: BLINKBLINKBLINK...

author: rstofer
author_rank: Super Contributor
timestamp: November 23, 2023, 04:39:24 am
content: Quote from: CharlotteSwiss on November 23, 2023, 03:20:08 amI'm surprised that the compiler accepted C code with a filetype of CPP.I wouldn't count on that always working. Use File->Save As <filename>.c to change a new file to .c from the default .cpp.

author: Electro Fan
author_rank: Super Contributor
timestamp: November 23, 2023, 06:02:33 am
content: Quote from: CharlotteSwiss on November 23, 2023, 03:20:08 amNice work

author: brucehoult
author_rank: Super Contributor
timestamp: November 23, 2023, 06:10:04 am
content: Quote from: rstofer on November 23, 2023, 04:39:24 amThat code is absolutely normal and valid C++ code as well as C. You have to go out of your way, poking into strange corners of the language, or stepping on C++ reserved words, to write C code that is not also valid C++.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 23, 2023, 09:07:00 am
content: Installing GBs of VS just to see Hello World compilation going. Amazing!

author: brucehoult
author_rank: Super Contributor
timestamp: November 23, 2023, 09:27:49 am
content: Quote from: Mechatrommer on November 23, 2023, 09:07:00 amAnd wading through masses of GUI wizards and configuration options. Ugh.I love GUIs. I was a convert to the Mac as soon as it came out in 1984 -- hell even the Lisa and ICL Perq before it -- but I hate IDEs. The GUI is just to throw up a bunch of terminal windows and emacs and a web browser for documentation and so forth.If I was on a Windows machine and wanting to learn to program in C I'd just install WSL and then...Code:sudo apt updatesudo apt install -y gcc emacs-noxemacs hello.cThen type in your helloworld ... emacs works just like Notepad or any other modern editor at a simple editing level ... type, move around with arrow keys, backspace to delete mistakes. The only tricky thing is C-x C-c to exit (hold down the Ctrl key while pressing x then c) and then type y to confirm saving changes.Then...Code:gcc hello.c -o hello./helloEt voila!!! It's really too easy.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 23, 2023, 12:31:35 pm
content: Quote from: rstofer on November 23, 2023, 04:39:24 amThis only happened after I installed various 'optional' packages. No more compilation errors. I hadn't saved the project. Tonight I'll try to save it, and change the final file extension. Thank you.Quote from: Mechatrommer on November 23, 2023, 09:07:00 amIsn't this the beginning of everything? I had never considered that by writing line commands I could achieve all this. Notes: VS will still be good in the future

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 23, 2023, 02:21:34 pm
content: Quote from: CharlotteSwiss on November 23, 2023, 12:31:35 pmit is good indeed! from past to the future (for those who interested). i started from "command line" fortran and then find my way through better GUI, because programming is only usefull if you can see/experience/enjoy/benefit it through your eyes/senses. i got to choose between borland delphi/vc++ builder and m$ studio (VC++ and VB) so i stuck with MS VS6 for the longest time (VB for GUI in PC and VC dll for efficient number cruncher functions) if you are interested in old VB/VC 6, they are only half a GB, but since its obsolete, i seek for newer GUI IDE, i choosed Qt, but unfortunately i think i dont have much time yet to fully learn it until now, either i'm too old or i have too much other interests/hobbies/responsibilties. so i still stuck with MSVS6 while i still can. Arduino the IDE and HW (mcu dev in general) otoh is a different game on manifestation of programming skill into reality... they are very different subset of programming imho, i mean very different library implementation. although learning one subset may help quicken learning the other subset. long story short, the real deal in programming is things like... "algorithm and data structures" ....man i hate it when i wander too much off-topic and mumbling so long like thisnobody will care anyway since everyone has their own path to success and happiness.. cheers.

author: rstofer
author_rank: Super Contributor
timestamp: November 23, 2023, 05:56:31 pm
content: On my Macbook, and I suspect all similar Linux/Unix machines, I get a warning when I compile HelloWorld.c with g++Code:(base) rstofer@Richards-MacBook-Pro ~ % g++ -o agpp.out HelloWorld.cclang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 23, 2023, 07:32:16 pm
content: Quote from: rstofer on November 23, 2023, 05:56:31 pmhaving familiar with some of M$ products... VS (or M$?) has a way of "minimizing" users/newbies concern by turning off some non critical warnings by default i guess. as they grow more advanced, they can turn back the warnings ON again. i guess this is M$'s definition of ergonomics.

author: brucehoult
author_rank: Super Contributor
timestamp: November 23, 2023, 09:59:50 pm
content: Quote from: rstofer on November 23, 2023, 05:56:31 pmWhat is the relevance of this comment?The OP created a starter console app which has a .cpp file and is no doubt automatically set up to use the C++ compiler, and you apparently complained that the code in the .cpp file was C code. Which is also valid C++ code.Now you're talking about using a .c file when you have specifically asked for the C++ compiler which, yes, it should complain about. As should the C compiler complain about being given a .cpp file.If you use the gcc driver instead of g++ then it will automatically choose the right compiler based on the file extension.(with the caveat that, as you can see in the error message, on MacOS gcc/g++ are actually aliases for the LLVM compilers)

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 12:43:19 pm
content: Quote from: rstofer on November 23, 2023, 04:39:24 amI can change the file extension from cpp to c (or c to cpp), and when I open the file from VS, there are no differences.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 12:46:01 pm
content: Quote from: Mechatrommer on November 23, 2023, 02:21:34 pmWhy do you say that no one will care? I liked what you wrote, it tells your journey into the world of programming languages. I appreciated your thoughts, Thanks

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 24, 2023, 01:57:06 pm
content: Quote from: CharlotteSwiss on November 24, 2023, 12:46:01 pmyou are probably the only one here that will say such thing because.. i guess you are the special breedthe problem with Qt is that we still need to do manual binding between code and GUI elements (buttons, textboxes etc) its quite a hassle for someone who got used with M$ RAD environment like me. specifically VB environment, borland C++ builder back then was also quite similar in easiness, not sure how is it today. just double click the button, we are directed to a place in code file (c,cpp,*.frm etc) where it should and we just type our code to be executed there, no need manual binding nonsense.. M$ also had this called MFC that we need to read up a whole book to understand how to use and code, i never got to learn it since, there is VB!there is no free IDE that can come close to easiness creating Windows, not even Qt. probably nobody here will understand that except some of them that have used VB including Dave the admin. thats the problem i think why its difficult for me to make the switch. C/C++ otoh is a super powerfull language imho even today, thats why its very hard to get rid from either. i've watched java, python and what not... meehhh.... boring! the same with newer VS and its VB# VC# "managed language" when you've built your large library for yourself, its very difficult to make the switch. when thinking of porting library to new ecosystem.. its unbearable. maybe mainly i'm old timer in comfort zone.. the only worthy effort imho for now to port my library is to Qt's C/C++, its prospect is high and can live for long imho.thats also the reason why this arduino and mcu is fun! with just simple code, you can see led blinks in colors, you can make something automated turned on or off based on sensors reading etc, no need library dependency other than standard library that came with it. its like... limitless! the limit is only imagination and money to buy things. isnt this long enough!(i should not be herei got less thing to do these few days while waiting for parts to arriveyou and me dont want me to be in this state, otherwise i'll mumble)

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 05:12:44 pm
content: Quote from: Mechatrommer on November 24, 2023, 01:57:06 pmThanks for the thought. I have no skills to give advice on programming languages. Maybe in the future I will be able to understand something more. I chose Arduino precisely for the 'ease' of programming. I am also aware, as has also been suggested to me here in the forum, that the C++ used by Arduino is a 'fake' version. Easily when I then switch to some other IDE (always C++ environment) I will have many problems, because the Arduino IDE will not have helped me in that sense. But now is the present. I'll think about the future when the time comes.

author: rstofer
author_rank: Super Contributor
timestamp: November 24, 2023, 05:31:49 pm
content: You might want to think of the IDE as having 2 pieces: The editor for user interface and the compiler/tools and this bit includes the C libraries and the Arduino libraries.Even if you change editors, the build process will use the same compiler and libraries. Even if you build from the command line you still use the same compiler and libraries. Yes, you typically have to have the Arduino software installed even if you don't directly use it.That's why you can use the Arduino editor with a different compiler tool set to compile code for the Teensy 4.1 ARM chip (and many others). The Teensy is nothing like the ATmega328 but the libraries provide the same/similar functionality. Code can be mostly portable.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 06:03:03 pm
content: Quote from: rstofer on November 24, 2023, 05:31:49 pmThanks, I understand the concept quite well. Now I will try to understand every test I will do with Arduino, but I will have to understand the structure of the C++ code that will make the hardware perform a certain job. Because performing various exercises, WITHOUT analyzing the code at all, is not of interest to me.Note for kit: they could have supplied the USB cable slightly longer, for those who work from a desktop who don't have the PC on the work table (but perhaps underneath). Instead of 50 centimeters, they could do at least 1 meter.

author: xrunner
author_rank: Super Contributor
timestamp: November 24, 2023, 06:10:58 pm
content: Quote from: CharlotteSwiss on November 24, 2023, 06:03:03 pmLOL I have a bunch of those short USB cables that come with these types of boards, most areBLUE. They are too short to be of much use. In fact I just threw away some the other day clearing out junk.

author: rstofer
author_rank: Super Contributor
timestamp: November 24, 2023, 06:14:02 pm
content: I always have a powered USB hub on the desktop regardless of where the PC is located.https://www.amazon.com/Individual-Switches-Adapter-Extension-Female/dp/B08PDTR35D

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 06:20:17 pm
content: Quote from: xrunner on November 24, 2023, 06:10:58 pmIn fact it is blueQuote from: rstofer on November 24, 2023, 06:14:02 pmI will look in my 'electronic' warehouse, I will find a solution

author: xrunner
author_rank: Super Contributor
timestamp: November 24, 2023, 06:26:30 pm
content: Quote from: rstofer on November 24, 2023, 06:14:02 pmWhat makes you think everyone has a PC and a desktop near where the microcontroller is located? Where some development is taking place at a point where test equipment is being used, like in the latest project I'm doing. See that long USB cable attached to the Arduino? It goes across the room ...

author: tautech
author_rank: Super Contributor
timestamp: November 24, 2023, 06:29:57 pm
content: Is it USB A to USB B ?Charlotte has a 1m one that came with her scope.

author: xrunner
author_rank: Super Contributor
timestamp: November 24, 2023, 06:35:31 pm
content: Quote from: tautech on November 24, 2023, 06:29:57 pmYes it is (the short ones).

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 06:54:03 pm
content: Quote from: tautech on November 24, 2023, 06:29:57 pmExact. I had 3 other identical cables in reserve, I used the one from the printer I used in 2010 (1.5 m). I don't think the length can affect the communication with the Arduino. Seeing 50 cm of cable with the kit I had some doubts...

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 24, 2023, 09:11:37 pm
content: For my own microcontroller experiments, I often use a cheap ADuM-based USB isolator (~ 10€ at eBay). They are limited to high-speed USB (12 Mbits/s, or about 1 MB/s or one megabyte of data per second) –– many have a small dip switch to select between low speed (1 Mbit/s) and high-speed –– and vary on which isolated 5V-to-5V DC-DC switchmode controller they have (so the current budget is less than the common 500mA, say 250mA or so), but within these limits, they work absolutely fine.Although the USB bus is supposed to be robust, I prefer using such an isolator to shield my computer/laptop from my own bumbling.It is mostly a mental security blanket for me, as this way I know that even if I let the magic smoke out of a microcontroller while it is connected to my computer/laptop, I know my computer/laptop will be safe.When connecting the microcontroller to a computer via USB, and to another mains-powered device (say, via UART), it can also help avoid ground loops if the computer ground and the other mains-powered device ground are not exactly the same.I also prefer microcontrollers that have native USB (ATmega32u4 is my favourite 8-bit AVR), and these tend to have a micro-B connector. Dangling from the isolator, I use a cable hub with two USB A connectors, one micro-B connector, and one mini-B connector. (Some USB 3.0 hardware implementations have issues with USB 1.1 devices, but using an USB 2.0 hub in between has fixed those issues in all cases I've heard of. The USB to Serial chips from FTDI etc. as used on many Arduino boards do not usually have this problem, however.)Microcontrollers with native USB (as opposed to USB to serial translator chip) are fun to use as HID devices – keyboards, mice, joysticks, touchpads, gamepads, etc. – as they don't need any drivers at all, they just Work when you plug them in. (If using aTeensy 4.0microcontroller, my current favourite, it is extremelyeasy to do, too, because the Teensyduino add-on for Teensies adds menu-based USB configuration options.)

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 24, 2023, 09:31:56 pm
content: Quote from: Nominal Animal on November 24, 2023, 09:11:37 pmI understand the problem regarding the security of the PC's USB port. I don't remember with what experiment, but a few years ago one of my USB ports on my desktop PC went up in smoke. Luckily two SMD ferrites were burned on the input board; once they were replaced, the door worked again. My Arduino doesn't have native USB (UNO, atmega328), but there should be a USB-serial converter. Thanks for the contribution

author: westfw
author_rank: Super Contributor
timestamp: November 25, 2023, 02:53:18 am
content: Quote from: CharlotteSwiss on November 10, 2023, 03:55:14 pmNo one has said this yet, but I would avoid the "Uno R4" for now. Despite the name, the R4 is an entirely different processor and architecture from the R3, leading to poor compatibility with many of the existing tutorials and libraries.Moreover, the processor it does use is essentially unknown in the amateur community, is "weird" in a bunch of ways, is not that well documented, and comes from a manufacturer with a poor reputation for "small customer" support.The best beginner choices are Uno R3 (or clones) and "Nano" (or clones.)Possibly worth considering is the "Arduino Nano Every." (it's got a different processor than an R3, but the same basic architectures. Library support is not great, but much better than an R4. More memory, a better power supply circuit, and rather cheap (even for the official versions.))

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 25, 2023, 05:11:33 am
content: Quote from: xrunner on November 24, 2023, 06:26:30 pmI have my desktop PC set up on an office desk one side of my hobby room and the workbench on the other. I came up with a similar solution, initially by cascading a selection of half, one and two metre USB extension cables which I replaced with a 5 metre extension cable. This connects to one of the PC's rear panel usb sockets via a half metre extension lead. For the workbench end, I simply plug a short (half or one metre) cable with the required plug into whatever I need to link to the desktop PC. In the case of my GPSDO and the rubidium reference oscillator, it's a mini B usb lead.The specified maximum length of usb A to usb B cable is 5 metres and this setup exceeds this limit by at least another metre. Despite this, I've not experienced any issues using this out of spec setup.

author: brucehoult
author_rank: Super Contributor
timestamp: November 25, 2023, 05:56:43 am
content: Quote from: Johnny B Good on November 25, 2023, 05:11:33 amThings are supposed to work at the spec limit, under a wide variety of conditions, with aged cables, manufacturing tolerances, etc.It would be quite the engineering challenge to make something that worked reliably with a 5.0m cable but didn't work in good conditions with a 5.01m or 5.1m cable. Or 6m, for that matter.

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 25, 2023, 08:16:14 am
content: Since my PC, that is on the bench, has most of its USB ports on the back, I use USB extension cables. Very handy for the ST-Link programmer used for among others the bluepill.They are 1.5m long, so plenty of reach for my projects.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 25, 2023, 11:41:40 am
content: Quote from: westfw on November 25, 2023, 02:53:18 amIf I had made the choice, I would have chosen the UNO R4 version (thinking newer = better). But most EEV users recommended the Arduino UNO R3, which is now on my workbench. It seems he made the right choice. Thank youQuote from: Johnny B Good on November 25, 2023, 05:11:33 amVery good, then with my 1.5 meter USB cable I certainly won't have 'length' problems. The 0.5 meter Elgoo cable will end up collecting dust

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 25, 2023, 10:53:38 pm
content: Quote from: CharlotteSwiss on November 24, 2023, 09:31:56 pmUno R3 will work absolutely fine with the cheap ADuM3160-based USB isolators, should you wish to use one. All you need to remember is that the isolator DC-DC converter is only about 60%-80% efficient, so if your circuit draws say 200mA from USB 5V, the actual draw from the PC may be up to 300mA, again depending on exactly which isolated DC-DC converter the board uses. (And yes, they really arethis simple– seedatasheet: just four capacitors and four resistors –, noting that mine has an extra diode D1 that one might wish to omit, or replace with better voltage backfeed protection instead.)If you get one that has the FS/LS dip switch, make sure it is in the FS (full speed) setting, or otherwise the isolator will slow down the communications to the UNO R3.Note that isolation can be done outside the Arduino as well. I particularly like theTI ISO6721isolators for UART, because it is trivial to use (just two 100nF bypass capacitors), cheap (1.42€ at Mouser), and works as both isolator and voltage level shifter. For example, my Odroid HC1 single-board computer has 1.8V UART for system console on a 4-pin connector (1.8V, RX, TX, GND). If I use any of my microcontrollers to connect to it via the ISO6721 isolator, I can use any logic level voltage (3.3V or 5V) on the microcontroller side, and not worry about whether the Odroid ground is the same as my microcontroller ground. Of course, it works perfectly well even if the two grounds are the same. Small price to pay for peace of mind!Analog ADuM1201 is available at LCSC and JLCPCB for around USD $1, but is more limited in its voltage levels (2.8V to 5.5V); otherwise very similar to use.I avoid using bidirectional voltage level translators (TXB0n0m, TXS0n0m, the transistor-based break-out boards), because I've had problems with them (the automatic direction sensing seems to affect the low level voltage a bit). I use unidirectional ones (or dedicated I²C ones for I²C) like TXU0n0m (TXU0202 and TXU0304 in particular), and 74LVC1T45, '2T45, '8T245, and so on. I particularly like the TXU0n0m ones because of their very high speed (up to 200 Mbit/s) and wide voltage range (1.1V to 5.5V). 74LVC1T45, '2T45, and '8T245 have almost as wide a voltage range, but also a direction pin, which can be really useful sometimes; the TI TXU0n0m ones are strictly fixed-direction.I do recommend anyone connecting their microcontroller projects to other systems via UART or SPI to have both isolators (ISO6721 for UART, ISO7741 for SPI or ISO7731 for SPI without SS/CS) and voltage level shifters (74LVC1T45, TXU0101, TXU0202, TXU0304) in stock. Very good Mouser order padding to exceed the 50€ free shipping, in my opinion. It is just too easy to blow an I/O pin by using too high voltage in my experience, especially when one moves from 5V to 3.3V logic. Several of my own microcontrollers – and basically all of my SBCs! – cannot tolerate 5V on their I/O pins at all. It's nicer to have a reliable, fast solution at hand, than try to cobble something together from transistors or diodes and current-limiting resistors. And ground loops are annoyingly easy to achieve, especially with not-so-good wall warts used as power supplies, or when using questionable supplies when testing something on the workbench.All that said, I come from the opposite direction: I'm a newbie hobbyist on the electronics side, with lots of experience on the programming (especially Linux) side. My needs do tend toward interfacing stuff with other stuff, possibly explaining my focus on avoiding problems with that.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 26, 2023, 02:54:06 am
content: Quote from: Nominal Animal on November 25, 2023, 10:53:38 pmIn practice, by placing this protector between the PC and the Arduino, would it protect both the USB port of the PC and the Arduino board from high voltages?I see they sell it for a few euros from the ChineseQuoteBut is the Arduino MCU so 'sensitive' to voltages?Thanks for the contribution

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 26, 2023, 06:11:06 am
content: Quote from: CharlotteSwiss on November 26, 2023, 02:54:06 amNot a problem if you're only powering it from the PC's USB port. However, if your project requires more power than a PC's USB2 port can provide and you're obliged to use a separate PSU, you could land up damaging it via the half live mains voltage that the 1nF Y cap wired between the dc output and the mains rectified HT used to reduce the amount of emi conducted on the dc output typical of almost every 5 to 15 volt smpsu wallwart you may be tempted to use.This was an issue with the Feeltech FY6600 AWG caused by the double insulated 10W three rail smpsu board that powered it via a C8 (2 pole - no safety earth) mains inlet socket. Other contributors to the long running FY6600 topic thread had noted the presence of this half live voltage on the BNC grounds and came up with some inventive solutions all of which involved replacing the C8 2 pole connector with a 3 pole C14 to allow the DC ground rail to be hard wired to the safety earth.I wasted some time trying to avoid swapping to a three pin earthed socket by trying to null out this half live mains voltage but gave up when I realised that it could only work with mains plug connected in one of two random orientations. A polarised mains inlet socket would still be needed which rendered the concept of nulling out the voltage a waste of space since the swapping to a polarised socket could provide access to the safety ground to allow the 0v rail (BNC grounds) to be linked via a 3.3K to 10K to ground neatly attenuating the half live voltage (about 90vac on 240 mains when measured using a DMM with a 10Mohm impedance) down to less than 500mVac (10K resistor case).You might well ask why I didn't simply hard wire the BNC ground rail directly to the PE pin on the clover leaf (C6) socket I'd elected to use (thinner more flexible mains leads were available in C6 ended mains cables to reduce the "Tail wags the dog" effect that the C14 cables had on such a lightweight piece of test kit). The answer was simply that I didn't want to create a mains earth hum and noise loop like Feeltech had done in the FY6800 and FY6900 models in (a seeming knee jerk) response to customer complaints about the presence of this half mains live voltage. Furthermore, this hard connection to the PE also proved to be the source of mysterious 20 to 50mV dc offsets that new owners of the FY6800 had started to observe whilst existing FY6600 owners had never been troubled by more than a mV or two due simply to a less than perfect factory calibration.I suggested to one such FY6800 owner that he temporarily disconnect the safety earth (the psu board was still the same double insulated one used by the FY6600 models) and see if the mystery DC offsets disappeared. Not surprisingly, they did.I then suggested that he insert a 4.7 or 3.3 K resistor in series with this hard earth connection so "he could have his cakeandeat it" ( half live mains voltage reduced to a harmless 250mV rms whilst attenuating the unwanted mains hum and RFI and DC offsets by some 40 or more DB - Winner winner, Chicken Dinner!" as Mr EEVBog himself is wont to say.I should mention that once the connection via a bnc cable is completed, this residual 250mVac is (as near as damn it) completely shorted out.I've since modified a few of my 12v 2A wallwarts with a 4k7 resistor between ground and the negative (0V) rail. to render them safer to use with less robust kit. In a couple of cases, the wallwarts had been blessed with a proper brass earth pin to operate the safety shutters but not connected. These were the easiest to modify. Others, I simply cracked open to retrieve the pcb for transplanting into previously gutted cases of scrapped wallwarts that had likewise been blessed with a brass earth pin rather than the more common (and cheaper) plastic pin required to operate the safety shutters.An alternative way to achieve the same effect with cost effective (cheap) wallwarts is to make up a mains extension socket into which you can also plug the DC flylead into from which you can then wire another dc flylead and connect a 4k7 resistor from the negative DC tag to the extension socket's PE pin.An even more elegant alternative would be to use a small metal project box to rehome the cost effective wallwart's innards into and use a C14 or C6 mains lead socket hard wiring the case to the PE tag for safety but only linking the DC negative to the PE tag via a 3k3 resistor to reduce the effect of the earth loop issue. There's more than one way to skin this particular cat.Obviously, you could forego all this DIYing faff by chucking some 50 to 60 Euros at the problem in the form of a cheap adjustable bench power supply. The metal case is earthed for safety whilst the output terminals are left floating with a case earthing terminal that allows you to connect one or the other output terminal to ground as you see fit (including using a 3.3 to 10k or higher resistor link if so desired). The outputs are left to float so you can wire them in series with a second bench supply (up to a maximum total voltage limit, of course).Making sure that, one way or another, your auxiliary dc psu doesn't output half live mains voltage is perhaps a better alternative to adding interface isolator boards everywhere. Of course, there's nothing to stop you from taking a "Belt and Braces" approach and use both options

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 26, 2023, 12:10:50 pm
content: Quote from: Johnny B Good on November 26, 2023, 06:11:06 amThanks for the explanation. I had heard about the problem on FY with that dangerous voltage on the device connectors. It was my purchase choice, but then I gave it up.Initially I will perform all the exercises of the Arduino kit with only the power supply from the PC's USB port (5V-500mA).However, I didn't understand (having never done any project with the Arduino) when they talk about 'supplementary power' for the project itself.Do you mean that I power the Arduino directly with the small power supply supplied with the kit, or that the project receives voltage from a benchtop power supply?I have the bench power supply (30v-5A).In short, I didn't fully understand when there could be a dangerous voltage situation using the Arduino (I only understood that there are no problems if you power only from the PC's USB). Thank you.​

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 26, 2023, 04:11:18 pm
content: Quote from: CharlotteSwiss on November 26, 2023, 12:10:50 pmThis "touch voltage" issue with such class II double insulated wallwarts isn't dangerous to us humans. It may be annoyingly uncomfortable to experience but not dangerous. What makes it dangerous to an MCU i/o pin isn't the 80 or so μA touch current, which any protective clamp diodes can otherwise handle with ease, it is the fact that the charge stored on a 1nF Y cap can be more than enough if the connection is made at a point in the mains cycle when it happens to be fully charged to half the peak mains voltage to blast a brief spike of several hundreds of mA discharge current into an i/o pin (an alternative form of ESD).The level of risk of such damaging discharges depends on how such connections are made between independently powered devices where one is powered from a class I earthed PSU and the other from a class II double insulated PSU. Provided you never forgot the golden rule of connecting the common grounds first and disconnecting the common grounds last, you could safely interconnect such separately powered devices but woe betide you should you forget to apply this sequence.When it comes to connecting usb peripherals powered from a class II psu (typically a wallwart) to a desktop PC, the design of the USB plugs and sockets guarantees such a connection sequence (assuming of course undamaged interconnecting cables). The risk is more associated with tinkering with a breadboarded prototype typically powered with a 5/3.3v YRobot adapter that allows use of an external 7 to 12v supply where the two pole press on/off button is used only to independently switch the centre pin of the 5.5mm socket (wallwart option) and the USB A socket's Vcc pin, leaving the 0v rail permanently connected to your class II wallwart (5v USB charger or a 7 to 12v psu).Whilst using this switch does avoid shorting out or wiring errors from damaging your prototype component parts, it does nothing to avoid the ESD risk even when using an interface isolator module. The safest option would be to make use of your bench supply (always keeping in mind the 15v maximum V in rating of those tiny 1117 ldos fitted to these YRobot psu adapters) and link the negative terminal via a 4k7 half watt resistor to the ground terminal for good measure. In this case, the ideal bench supply voltage setting would be a minimum of 6.5 to a maximum of 7 volts.

author: westfw
author_rank: Super Contributor
timestamp: November 26, 2023, 09:16:38 pm
content: QuoteThe Uno power supply circuit is a bit of a joke. OK, you can get about 500mA through the USB port, which is plenty for the Uno itself, and most "pure electronic" things that you might connect (sensors, speakers, etc.)But if you want to use something like a motors or a big string of smart LEDs, 500mA is likely to be insufficient, and you need "supplemental power." But the 5V regulator on an Uno has no heat-sinking, and while the chip is rated for 800mA or so, power dissipation issues mean that you can't really get anywhere near that much :-( The higher the external power supply voltage, the worse this problem becomes.So a typical high-power project will have an external power supply going to the Vin of the Uno, and powering ONLY the Uno. And a separate connection (and perhaps a separate regulator) for the higher-current parts of the project. This isn't particularly dangerous in itself, but the opportunities to cause damage by accidentally touching THAT part of the circuit with THAT wire are significant, especially given the bare-board nature of most components, the inexperience nature of many Arduino users, and the tendencies to "poke around" while the circuit is "live."

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 26, 2023, 11:28:10 pm
content: Quote from: westfw on November 26, 2023, 09:16:38 pmThanks for the explanation. He will start doing the basic projects, powering the Arduino only via the PC's USB. For more 'thirsty' projects, now I understand, in practice it will be necessary to power the Arduino with an external power supply from the Vin socket (in the kit however there is a dedicated power supply, I haven't yet looked at how much current it can supply. The important thing is that do not exceed 12v to Vin.There remains the problem of some short circuit with some flying cables, I will try to be carefulQuote from: Johnny B Good on November 26, 2023, 04:11:18 pmLet's see if I understand correctly: in practice in a project where there are multiple power supplies (including perhaps a signal control oscilloscope), should the devices with an earth connection be connected first and disconnected last?I see that the solution of powering the Arduino with a bench power supply (also connected to the ground) would be the best, but adding that resistor (but I don't feel ready for that modification). Thank you

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 27, 2023, 01:57:04 am
content: Quote from: CharlotteSwiss on November 26, 2023, 02:54:06 amOnly the USB port of the PC. Yes, these typically cost less than 10 euros, shipping included.Quote from: CharlotteSwiss on November 26, 2023, 02:54:06 amWell, UNO R3 uses 5V logic levels, and that's all you can get from standard USB port.However, there are many modules that cannot handle 5V logic. The 0.96" I²C 128×64 OLED modules using SSD1306, and many 9-DOF IMU sensors like MPU9250 are particularly good examples: they're often advertised as working with 5V logic, but it is actually beyond the specs for the SSD1306 controller and the MPU9250. When used with 5V logic levels, these rely on various "tricks" (series current-limiting resistors and relying on the ESD diodes, weak "pull-ups" to local 3.3V) I personally do not trust. It would be much better to use an I²C voltage level translator instead, say PCA9306.It really becomes more important if/when you switch to 3.3V logic microcontrollers. Then, even an accidental 2.2kΩ pull-up to 5V can burn the I/O pin.(Plus, there are some very efficient non-isolated DC-DC switcher modules, like TI TPSM84203EAB (6.84€ at Mouser) that should be 93%+ efficient at loads over 100mA, which means that while drawing 500mA at 5V from the USB port, you can draw 700mA at 3.3V. Well, 660mA, if we allow VUSB as low as 4.75V.Quote from: CharlotteSwiss on November 26, 2023, 11:28:10 pmIt should help, but it's more that you should check the grounds or zero-reference voltages are at the same potential, before connecting them.The problem is that depending on how their supplies are implemented, they may not be referenced to true ground. When you connect such grounds together, you get a current flow. If those grounds are referenced to something, instead of a pulse of current that equalizes the potential across the new shared ground, you can get a ground current loop. Because supplies always include capacitors, even if their zero reference voltages are just floating and you get a pulse of current, connecting the true ground first means the current pulse will flow to a "proper" ground sink, and hopefully not destroy anything.The USB isolator is exactly what you want to use in this kind of case, because it means the isolated side has its own ground potential, independent of the PC USB ground potential. No current flows across the isolator, except for the DC-DC converter, so there will be no ground current over the USB connection. And ADuM3160 is rated to handle 400 Vrms/560 Vpk difference continuously.You could also make an isolated ADC. The annoying part is supplying power to the isolated part, as isolated DC-DC converters and USB power banks are a bit noisy; battery-powered (with a linear low-noise regulator to 5V or 3.3V) is much easier to get working right. Then, the ADC itself would share its ground with whatever it is measuring (even if mains-referenced!), and only the digitized data is transferred over an isolator like ISO1640 (I²C) or SI8652ED-B-IS (SPI+DRDY: SCLK, MOSI, MISO, /CS or CONVST, and DRDY), with the isolator also handling voltage level translation if the two use different logic level voltages.

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 27, 2023, 02:36:21 am
content: Quote from: CharlotteSwiss on November 26, 2023, 11:28:10 pmOscilloscopes, including ancient CROs through to today's modern DSOs, link the signal input grounds (BNC or whatever) to the protective earth along with any metalwork or internal screening. Whilst some of the older boat anchor CROs provided a safety earth disconnection switch to allow the input connector grounds to float in order to facilitate testing in special circumstances involving the use of rubber rather than kid gloves, this practice was very much frowned upon for obvious safety concerns and only intended to be used as a last resort.No modern DSOs provide such an earth disconnection switch option since any such testing can now be performed by using a very expensive high voltage isolation differential input probe. Suffice to say that if you're examining any signals in whatever you're working on with a mains powered oscilloscope, you can guarantee that the input connector grounds will be tied to its protective earth connection.In other words connect the scope probe's ground clip first to whatever is the ground reference of the device you're testing and likewise any other ground connections from PSUs (bench or otherwise) and / or any signal generator sources. If you remember to always follow this golden rule without exception, your DUT (Device under Test) will be protected against this half mains voltage ESD risk (assuming no unintended earth disconnections occur during the test). The fact is that even when there isn't a real ground connection to suppress the touch voltage from a class II wallwart the golden rule can still provide the same level of protection for your DUT.

author: humidbeing
author_rank: Regular Contributor
timestamp: November 27, 2023, 04:27:24 am
content: I'm a big arduino fan, but I'm comfortable with C-style syntax. For a beginner to programming I would go with a Pi Pico since it uses Python.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 27, 2023, 12:07:52 pm
content: Quote from: humidbeing on November 27, 2023, 04:27:24 amThey had already suggested this scenario to me, but now I've got the Arduino kit and so I'll have to try to pedal with that...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 27, 2023, 12:39:59 pm
content: Quote from: Nominal Animal on November 27, 2023, 01:57:04 amThank you Nominal. I had made some notes on the importance of zero potential references in a circuit when I bought the oscilloscope. As soon as I have the opportunity, I will get a USB isolator based on ADuM3160, so I will protect at least the PC portQuote from: Johnny B Good on November 27, 2023, 02:36:21 amI have a note in my notes on the oscilloscope, where I specify that the socket where I connect it must necessarily have a working ground. Thanks for reminding me of all this. Typically when I connect the probe to the circuit, I do it without voltage, but however I will always try to connect the potential reference first, and only then the measurement clip. And in the end, the reference tweezer will be the last to be detached.------------------------------------------------------------------------------------------------------A few cents question: when making projects on bread boards with the Arduino, all the connections between the Arduino and the components on the board must be made with the USB cable disconnected from the PC, right? (so as not to have the atmega live).

author: Ian.M
author_rank: Super Contributor
timestamp: November 27, 2023, 01:14:12 pm
content: Quote from: CharlotteSwiss on November 27, 2023, 12:39:59 pmThat's best practice (and external power should also be disconnected), but can be a PITA. You can usually get away with holding the ATmega in reset by jumpering its Reset pin to Gnd (at the Arduino header) and disconnecting (or switching off) power to the breadboard (but not Gnd) while making changes. This forces all I/O pins to high impedance inputs, and for Arduinos with a separate USB <=> UART IC, also avoids the board re-enumerating.Caution: If reusing an Arduino from a different project, to avoid potential damage from output pin conflicts, either wipe it by uploading a blank sketch (empty setup and loop functions) or load it with sufficient project code to set up the pins correctly *before* you start the physical build.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 27, 2023, 01:22:13 pm
content: Quote from: Ian.M on November 27, 2023, 01:14:12 pmI'll do it like this: when I connect/modify the cables between the Arduino and the project on the board, I do it ONLY with the USB disconnected (obviously, or the Vin disconnected).BEFORE connecting a new project, I always reset the atmega to clear the old pin settings.Does the Reset button on the board do this too? (deletes the code inserted into the MCU memory?). Thank you

author: Ian.M
author_rank: Super Contributor
timestamp: November 27, 2023, 01:35:34 pm
content: No, the Reset button only restarts the (main*) Atmega, executing the existing firmware, effectively from the beginning of setup(). While held, it also tri-states all I/O pins.* It does not reset the Atmega16U2 on some Arduino boards, or other USB serial IC that provides the USB <=> UART interface, so digital pin 0 (RX) wont go properly hi-Z, though there is a 1K resistor between the USB chip and the pin, which provides some protection.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 27, 2023, 03:18:53 pm
content: Quote from: Ian.M on November 27, 2023, 01:35:34 pmOk thanks, so before writing a new code on the atmega, I will delete the previous one from the IDE software

author: fourfathom
author_rank: Super Contributor
timestamp: November 27, 2023, 03:54:15 pm
content: Quote from: CharlotteSwiss on November 27, 2023, 03:18:53 pmI think this is getting way too complicated. In the Arduino IDE when you compile and upload a program it erases any existing program.It does not erase the boot code, which is a good thing. The Arduino board comes with boot code pre-loaded, and this is what allows the IDE to upload the program. You can change the boot code if you like, but you need a special programming gadget for that (see the Segger "jlink" products). For normal Arduino-hacking you will never need to touch the boot code.And unless you start attaching external hardware with other voltage or power requirements, don't worry about USB isolation. It does no harm, but if your board is self-contained and USB-powered, just plug it into the computer. And any modern oscilloscope shouldn't pose any ground-loop issues (although I can't power my cheapie "ADS1013D" tablet 'scope from the computer USB port when the arduino is also connected via USB -- it needs an isolated supply to eliminate ground issues.)

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 27, 2023, 04:18:06 pm
content: Quote from: fourfathom on November 27, 2023, 03:54:15 pmI imagine the boot loader is the preloaded startup program.Given the low cost, I will also use USB protection for other projects (extra-arduino).Of course, when I compile new code it overwrites the previous one. but perhaps the users who warned me meant not to connect a new project BEFORE having compiled the new code (i.e. with previous code in memory). Thank you

author: Ian.M
author_rank: Super Contributor
timestamp: November 27, 2023, 04:56:55 pm
content: Exactly. It is important to avoid connecting logic outputs in opposite states together, as excessive current can flow, and as it is impossible to upload to the Arduino while its held in reset, all I/O pins used for the new project must either be reconfigured correctly, or configured as inputs before connecting them. It is not sufficient to simply compile the new code, it must be uploaded to the Arduino.

author: westfw
author_rank: Super Contributor
timestamp: November 27, 2023, 10:50:02 pm
content: QuoteYeah, that.Thousands of clueless people (with far less experience than CharlotteSwiss) have fiddled with Arduinos without hurting themselves, and only a small minority even manage to damage their boards. Just jump in! Try some of the examples, follow some of the tutorials, and once you have more of a feel for the general "ecosystem" and a more concrete idea of what you want to do as a particular project, THEN you can ask more meaningful questions.

author: r00n
author_rank: Contributor
timestamp: November 28, 2023, 12:54:12 am
content: I enjoy using arduino very much.There are plenty of online tutorials to get you started.I started at this site.https://www.jeremyblum.com/2011/01/02/arduino-tutorial-series-it-begins/] https://www.jeremyblum.com/2011/01/02/arduino-tutorial-series-it-begins/

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 28, 2023, 07:29:09 am
content: Quote from: westfw on November 27, 2023, 10:50:02 pmI'm not used to throwing myself into the void. I prefer to progress in small steps. No hurry. Rushing could cause damage. Thank you

author: westfw
author_rank: Super Contributor
timestamp: November 28, 2023, 09:07:31 am
content: But it's NOT a "void", and the steps ARE small...

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 28, 2023, 04:45:38 pm
content: Quote from: r00n on November 28, 2023, 12:54:12 amOpera refused to open that link and I had to resort to Firefox (normally the first application to be uninstalled from my Linux distro installations after I've installed opera but, these days, too many non compliant web sites cause show stopping problems with Opera's security features, particularly youtube videos where the message " your browser cannot play this video" has become an ever more common occurrence - hence my now retaining FireFox as a 'sacrificial lamb' from which I can readily delete all of its history).Even pasting that link into FF was still bedevilled with problems but after finally accessing the starting video tutorial, I was met with a barrage of high volume adverts finally to discover that it was a whole 12 years out of date. Much better tutorials can be found with a DDG search (Duckduckgo really is your friend in this endeavor).By way of example here's the first one I found extremely useful to my temperature stabilised rubidium oscillator project (I literally lifted it as was to start coding my controller sketch) however, when I was experimenting with using more than the 5 averaging samples, my sketch would lock up once I tried using hundreds of samples. The reason being that the sketch was accumulating them into a memory consuming array (for this newbie, it hadn't be so obvious that such an inefficient way to gather the samples was being used). I soon fixed that by accumulating the samples into a float variable which would allow me to collect thousands of samples if need be without crashing the sketch. However, there's little benefit in averaging more than 23 samples at a time.Later on when I was trying the oversampling technique to wring out a few more bits of resolution (using floating point math which allowed me to try out the in between half bit's worth of additional resolution in my search for the optimum trade off between latency and 'precision') I even tried an oversampling value of 1024 to add an additional 5 bit's worth onto the adc's 10 bit resolution before finally settling on a 64 times oversampling to give me a less ambitious extra 3 bits of resolution.Here's the link to that tutorial and sketchhttps://learn.adafruit.com/thermistor/overviewI did likewise for the other two main components in my control sketch, a BMP280 pressure and temperature sensor module and an SSD1306 OLED display to effectively create a 'Frankensketch' out of the three separate sketches (I wasn't about to re-invent this particular wheel from scratch when others had already done the heavy lifting for me - there's no shame in utilising open source software snippets provided you acknowledge the original authors' contribution). I gained a considerable amount of expertise in weaving the work of others into a sketch of my own.When I bought that pack of three nano3s (just over 4 quid from Banggod about four years ago), it had been a speculative purchase against the day when I'd build a micro controller based GPSDO design. I never did embark on such a project since the G3RUH 'simple gpsdo' worked so well, free of the problems of temperature effects on the components that the micro-controller would be obliged to deal with as additional side issues.It wasn't till I started my rubidium project which required some form of barometric compensation to be included with the baseplate temperature control that I found the motivation to upgrade from a simple proportional PWM thermal regulator circuit to a micro-controller based one on account that the only affordable way I could apply barometric compensation was to use a BMP280 sensor which had no analogue output, only digital I2C which required some form of micro-controller to process the data. Being left with no choice in the matter of developing my project any further was motivation enough to unpack one of those nano3s and start hunting for inspirational example sketches.I've now reached the stage where the 300μK resolution of my baseplate temperature sensing setup using an ADS1115 replacement for the nano's built in 10bit ADC is now showing up the limitations of the nanao's 8 bit PWM analogue output that controls the cooling fan speed. I could wring another 2 bits' worth out of the nano's PWM at an acceptable sacrifice in PWM frequency but I'd have to rearrange the PWM pin connections yet again and there's still the possibility of a conflict with the PWMservo library I'm currently using.If I could have tracked down a 2 or 4 channel 12 bit (or more) I2C PWM module to overcome the 8 bit limit of the nano's analogue outputs, I'd have have bought one. Sadly, the closest item to that were the PCA9685 16-Channel Servo Driver modules which on closer inspection could only offer a maximum PWM sampling rate of just 1.6KHz which is far too low for my requirements. I can squeeze just under a 15KHz rate at 10 bits out of the timer 1 controlled pins on the nano which is just about an acceptable compromise for the extra two bit's worth of resolution.It looks like my "Flight Spare" (the prototyped on breadboard assembly I'd used for the initial bench testing phase of the project's development) will once more be used to test out the code changes to verify whether or not this change can be achieved without resorting to throwing another nano3 into the mix (I'm already considering such an option to offload the oled display driver burden from the existing nano anyway). One way or another, it looks like I'll be 'exploring new territory' in my quest for ultimate performance. Ah well, it'll help occupy my time. This however, does beg the question as to whether the project will reach a conclusion before EOL (mine or the LPRO101's).

author: themadhippy
author_rank: Super Contributor
timestamp: November 28, 2023, 05:12:26 pm
content: Quotemeanwhile those of us who supposedly have clue manage to blow the buggers up without trying to hard

author: rstofer
author_rank: Super Contributor
timestamp: November 28, 2023, 05:24:44 pm
content: So, you define an Arduino pin as output when it should be input and short circuit the pin - this is bad..I put a 330 Ohm resistor in series with most pins on FPGA projects. For inputs, the voltage drop will be negligible and for outputs, the maximum current flow will be around 15 mA assuming external signal is 5V max. This needs to be considered carefully depending on what is being driven. An LED wouldn't need the usual 220 Ohm resistor or it wouldn't need the 330 Ohm, one or the other.I had never considered what would happen with a previous project in flash having now incorrect pin configuration and being connected to a different project before programming. Oops!Another possibility is to reset the Arduino before wiring it to a circuit. Just an empty file like:Code:void setup() {// no setup code}void loop() {// no loop code}After uploading and running this code, all pins will default to input. Now wire up your circuit and add code. Maybe make it a practice to reset the Arduino when you first pick it up. Who can remember what it was last used for? Certainly do this before wiring any outputs that aren't already properly defined in the loaded code.

author: rstofer
author_rank: Super Contributor
timestamp: November 28, 2023, 05:38:46 pm
content: Then there's the finger test. Put a finger on the high dollar chip before you apply power and feel the temperature rise. If your finger gets burnt, you should shut off the power. Soon...If you are powering from a supply with current limiting, set it low and work up until the voltage is nominal. Stop when something gets warm. Don't start from 3A and work down. Add up some component currents and see if 100 mA will do. Jot down in your notebook the project configuration and current limit setting. I usually start around 100 mA for small projects and work down until current limit kicks in. Then I increase the current limit slightly.A 5V 3A wall wart is a risky way to start.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 29, 2023, 06:28:56 pm
content: Quote from: Johnny B Good on November 28, 2023, 04:45:38 pmThank you for sharing, I was pleased to read this electronic 'adventure'. Since we're talking about Arduino, it would be interesting to see some photos of the project... Will you finish it? It's not a problem, the important thing is that the project takes up your timeQuote from: themadhippy on November 28, 2023, 05:12:26 pmWith the Arduino I'm proceeding with the brake on. But a few years ago with SMPS power supplies I made those scary bangsQuote from: rstofer on November 28, 2023, 05:24:44 pmTwo questions:1) I didn't understand when you said that an LED wouldn't need a resistor. I have always put a resistor in series with an LED to limit the current. I'm just modifying my desktop pc, that sleep led is too bright in my dark room, I'll add another resistor on the cable to get a dim light2) Interesting that code to reset the Arduino. In practice, before connecting a new project to the Arduino, I load that code from the IDE. Then ok I can also connect the new project. It works like that right?Thank youQuote from: rstofer on November 28, 2023, 05:38:46 pmBut I start with the power supply only from the PC's USB. However I thought that even using a wall socket power supply, the Arduino limited the incoming current.

author: MarkF
author_rank: Super Contributor
timestamp: November 29, 2023, 08:12:31 pm
content: Quote from: CharlotteSwiss on November 29, 2023, 06:28:56 pmNo. The power from the USB goes through a MOSFET to eliminate current feedback into the PC. The power from the external power supply goes through a three terminal regulator.Neither power source is current limited. The regulator for the external power has "Thermal Shutdown Protection"; however I wouldn't depend on it. Keep in mind that is only a 1A regulator and I definitely wouldn't push the limit.If you have a project that requires a lot of current, don't run it through the Uno board. Power each separately with only their grounds tied together. The power could come from one external power supply with the +V being split to the each.

author: rstofer
author_rank: Super Contributor
timestamp: November 29, 2023, 10:59:18 pm
content: Quote from CharlotteSwiss:Quote1. If you routinely add 330 Ohm resistors to all pins (within reason) then you wouldn't also add a 220 Ohm series resistor to an LED. That might get a little dim (total 550 Ohms). If the project calls a resistor larger than 330, use that value and skip the 330 Ohm. I don't imagine this will be required for the Starter Kit projects or the Examples.2. When you pick up a previously used Arduino, reset it before wiring it into a circuit. Then your setup() code will set the proper configuration for the project. Remember to reset when you change Starter Kit projects, the Examples and, of course, your own projects.

author: selevo
author_rank: Contributor
timestamp: November 30, 2023, 12:53:48 am
content: HiArduino very best and very fast start and and is based on a very powerfullanguage - c++At the moment, there is nothing more ready or better.i used $2 arduino nano type-c (atmega328) on aliexpress.comI can connect this board to my smartphone and check something or write something using the ArduinoDroid application right on the bus, subway or on the plane. it's very cool and cheaphttps://play.google.com/store/apps/details?id=name.antonsmirnov.android.arduinodroid2and if you want more headaches, you can install an microchip mplab ide or Microsoft Studio AVR or something from stm32 or Chinese clones. Nowadays the choice of microcontrollers is too large.Quote from: CharlotteSwiss on November 10, 2023, 10:55:14 pm

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 30, 2023, 03:33:39 am
content: Quote from: MarkF on November 29, 2023, 08:12:31 pmOk thanks for the explanation. It will be some time before I do complex projects with the Arduino, so in the meantime I will learn many thingsQuote from: rstofer on November 29, 2023, 10:59:18 pm1) ok, I misunderstood the previous explanation. Now it's clear. For the weak LED with 550 ohm, consider that I added a 10Kohm resistor in series to the PC suspension LED (night room). Now let's think about it (first too much blue light in the room).2) Before tackling a new project, I reset the atmega with that code. Thank youQuote from: selevo on November 30, 2023, 12:53:48 amThanks for the advice, yes indeed Arduino has a lot of potential. But I won't need the app, I don't really like smartphones... (too many people dependent on these devices, I don't follow the herd)

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: November 30, 2023, 05:57:09 am
content: Quote from: CharlotteSwiss on November 29, 2023, 06:28:56 pmI've posted several photographs in other Rubidium topic threads so rather than repost them here, I'm providing links to three of those posts where you can peruse the prototype setup and the later stage where I've actually made up a heavily insulated enclosure to continue further testing and refinement of the project.https://www.eevblog.com/forum/blog/eevblog-235-rubidium-frequency-standard/msg3652885/#msg3652885https://www.eevblog.com/forum/metrology/gnss-rb-(chinese)/msg3999667/#msg3999667https://www.eevblog.com/forum/metrology/i-just-bought-an-efratom-100318/msg4176703/#msg4176703I've attached 5 photos. The first taken last July, the rest just this morning. The penultimate is my "Flight Spare" set up on the bench ready to test my PWM code changes, hence the presence of the attached servo. The final one shows it powered from my desktop PC, hence the poor lighting.

author: Ian.M
author_rank: Super Contributor
timestamp: November 30, 2023, 10:56:24 am
content: Incidentally, the empty sketch (no code inside the setup() and loop() functions) is one of the supplied examples of the Arduino IDE (both 1.8.x and 2.x). To find it open the menu:File>Examples>01.Basics>BareMinimumYou only need the empty sketch to reconfigure the Arduino to all inputs when developing your own projects. If you are working through example sketches or other people's projects, simply load, compile and upload their sketch to pre-configure the I/O before connecting the Arduino to external circuits. If modifying the I/O mapping, disconnect the affected pins, modify and re-upload the sketch and only then reconnect them.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: November 30, 2023, 06:15:06 pm
content: Quote from: Johnny B Good on November 30, 2023, 05:57:09 amBeautiful project, sir remotely exhales the passion you put into it. We hope you finish it. You'll let me know the developments. Thank youQuote from: Ian.M on November 30, 2023, 10:56:24 amThanks, I understand (I didn't know that code was in the IDE examples). Of course I will upload this code before doing a new experiment of my own. If I load other codes, there is no need to load the empty one, the new code will write over the old one (obviously before connecting the cables to the external project).

author: rstofer
author_rank: Super Contributor
timestamp: November 30, 2023, 07:04:17 pm
content: iEmbedded design is an iterative process. Add a peripheral and get it to work. Add another peripheral and discover that it MUST use pins already assigned to the first peripheral. Clear the Arduino before even starting to write the code.I think you want to avoid disconnecting wires but you can't reset too often. Prototype shields allow you to unplug the entire project.https://www.amazon.com/s?k=arduino+shield

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 01, 2023, 02:34:09 am
content: Quote from: rstofer on November 30, 2023, 07:04:17 pmThanks, I will slowly experiment with the kit projects. Meanwhile I haven't been able to connect the Arduino to the PC yet, it's a period of great work with the arrival of the cold. I hope to have free moments this month to start discovering the atmega

author: liaifat85
author_rank: Regular Contributor
timestamp: December 01, 2023, 10:51:42 am
content: Because Arduino is open -source, so are Arduino libraries. It is very user-friendly. I think R3 is better choice for beginners.

author: Ian.M
author_rank: Super Contributor
timestamp: December 01, 2023, 11:36:19 am
content: Don't worry too much about reprogramming the Arduino. A genuine ATmega328P's FLASH program memory has a rated endurance of 10000 programming cycles, and typically does a lot better than that. That's over 27 programming cycles a day, every day, for a year, and I'd bet you don't have enough free time to spend on embedded development to get anywhere near that, so in theory it could still be reprogrammable after several years of regular development use.In fact I believe wear on the header connectors would be the limiting factor long before the FLASH could wear out!The clone ATmega2328P chips found on most far east Arduinos (and loose on Ebay, Amazon, AliExpress etc.) may not do so well, (along with other disadvantages like higher sleep current and suspected poorer ADC performance), but I'd still expect the far east headers to wear out first!

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: December 01, 2023, 05:55:21 pm
content: Quote from: Ian.M on December 01, 2023, 11:36:19 amThanks for the info on the flash endurance. I must admit there were times when I'd found myself uploading in excess of 30 variations of my control sketch per day when I did wonder how long it would be before I would have to replace the nano3 with a 'fresh one'.It wasn't the cost of purchase so much as the cost in time and the need to disturb the wiring (and hammering yet another thermal cycling 'nail into the rubidium oscillator's coffin') which worried me the most - at just over 4 quid for three, they were the most disposable item in the whole project.As for the concern over possible damage when recycling the UNO or Nano to another project if you don't explicitly clear out the previous sketch before rewiring it, there's really only one serious risk of damage involving the use of the 5 or 3.3 volt being connected to the AREF pin where you must use this command as shown in this code snippet from my rubidium controller project:Code:analogReference(EXTERNAL); //using 3v3 on AREF pin for best thermistor temperature sensing accuracy.//========================================================================================================================// IMPORTANT NOTE!://========================================================================================================================////Although I'm now using an ADS1115 4ch 16 bit I2C adc module, this directive must remain in the code until//I can get around to disconnecting the 3v3 pin from the built in adc's external reference pin to avoid damaging the adc's//own built in reference.//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//// I Tried using the low noise, temperature stabilised 4.97874v rail but this only made things//worse for the lack of any 'dither noise' (Who knew?). Reverted to the 3.3v pin with a plan//to try out a 256x oversampling technique to gain an extra 4 bits of resolution. In the end, 64x oversampling for an extra//3 bits proved to offer the best trade off between 'precision' and loop cycling speed. All now made redundent, of course,//by the ADS1115 upgrade.Rather annoyingly, I forgot to take the opportunity to remove this link when I'd taken it apart to rearrange the fan and servo connections after finding the answerhttps://www.pololu.com/docs/0J57/8.ato the conflict between the two servo libraries and my need to increase the 8 bit resolution to 10 bits for the fan drive PWM which means I have to retain the above section of code until I do remember to remove that link the next time I'm obliged to hammer yet another thermo-cycling nail into my quarter century old LPRO101's coffin.Mind you, I did at least take the opportunity to replace the rear panel SMA socket with a BNC panel SMA plug ended flylead I'd purchased a couple months ago for exactly this purpose.It wasn't the easiest of mods (and I'd thought the job of rearranging the fan and servo wire connections a tricky enough task) since as well as drilling out the hole and filing it out to allow the anti-rotation flats on the BNC socket to gain purchase and remove sufficient of the rear panel polystyrene insulation using a 22mm wood boring bit to fit the retaining nut and washer, I also found myself having to partially disassemble the case to file a clearance notch for said nut and washer from the corner angle bracket as well as getting a spanner onto the nut. This proved to be the longest (and most messy - mangled pieces of polystyrene foam everywhere!) part of last night's (and into the wee small hours if truth be known) job.Now all that's left to do is fine tune the replacement servo code to match the original code which used control input expressed in angular degrees versus the control input expressed in microseconds of pulse width of "on time" by the new code. Testing with my 'flight spare' allowed me to determine the safe limits to avoid hitting the servo's internal end stops and also the microsecond's range to cover the 180 degree angle of rotation from which I could apply a translation and offset calculation to the angle variable used by the PWMservo code which covered a 100 degree range between a minimum of 30 and a maximum of 130 to maximise both efficacy and avoid hitting the ventilation diverter flap valve's own imposed end stop limits.The whole project has been more a work of art than an exercise in coding. The coding was more a case of wielding the tools to hammer the baseplate temperature control into what is now effectively a miniaturised air conditioning system. There's a little more fine tuning to do with the new servo control code and testing with the oled display update code commented out to see whether adding a second nano3 into the hardware mix to offload this cpu cycles hog from the main code is worth the extra work (I can still monitor the baseplate temperature using the serial plotter feature built into the Arduino IDE).I've attached a sequence of nine plotter window screengrabs, each showing approximately 8.8 seconds' worth. The spikes are simply auto-scaling defeating artifacts added every 498 plot points (the autoscaling totally destroys the whole point of graphing such variations of displayed data). This limits the maximum zooming in to a peak of 36.120 and a low of 36.000 degrees (the vertical scale is in mK above the 36.000 degree baseline).

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: December 05, 2023, 12:10:59 am
content: Well, I've finished fine tuning the servo code to allow the flap valves to transit their full range without crashing the BMP280 sensor by hitting their limits (the resulting stall current, about an amp, generates transient dips on the 5 volt rail). Given free movement, the servo normally only draws some 20 to 30mA traversing the full 100 degree range over a little under half a second.Having dealt with that adjustment, I turned my attention to refining the temperature control algorithm to take full advantage of the extra two bits of servo resolution, all of which has kept me occupied for the past couple of days. I also disabled the oled code to test whether it would be worth chucking a second Nano3 into the mix and came to the conclusion that it wouldn't improve the control algorithm.However, what I did realise was that it would be better to use the averaged plenum temperature in the main fan control section and decided to increase the number of averaged samples from 20 to3060. Since both the display and the plenum chamber temperature averaging are synchronised to the same counter variable, that's reduced the refresh rate to one per second as well as increasing the main loop polling rate from an average of 56 to 66 Hz. Neither display rate nor servo response are adversely affected by this so it's a "win, win" change.I had hoped to have it ready for testing under sub zero ambient conditions in my garage / workshop but with all that testing and code editing, that was not to be since last night's overnight temperatures of -2 degrees rose to some 4 degrees by this morning,Since the forecast for the UK is for rising temperatures during and beyond the rest of this week, I decided to make the best of the current low of 3.4 degrees and moved the setup into the workshop to run an overnight test to check that it is still able to cope with temperatures that had gotten as low as 4 degrees about a week ago. I'll leave the high temperature testing (up to a maximum of 32 to 33 degrees) till next week when the warmer weather will allow me to turn my hobby room into a sauna by supplementing the radiator's contribution with an additional 4.5KW using a 2KW fan heater and a 2K convective heater with a built in 500W fan heater.Such testing adds considerable expense onto my energy bill (not to say the heat stress I'm obliged to endure whilst trying out solutions to ensure the fan is allowed to run flat out and not be sabotaged by the proportional hysteresis algorithm designed to give early detection of imminent over-cooling and the resulting undershoot which then triggers an overshoot response - 30 seconds of thermal inertia is rather tricky to tame).I'm now seriously looking into creating an environmental testing chamber to not only provide finer control but also reduce my energy costs and eliminate the heat stress I've been enduring up to now.Anyway, before I installed it into the workshop for low temperature testing where it is beyond the reach of a USB connection, I took another sequence of three successive serial plotter screen-grabs to record the improvement in temperature control as a consequence of discovering that 10 bit servo control algorithm thatdoesn'thijack Timer_1.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 02:00:19 am
content: Quote from: Ian.M on December 01, 2023, 11:36:19 amI don't worry about wearing out my memoryMy Arduino is from Elegoo, so would you say that these clone devices are equipped with a non-original Atmega?Quote from: Johnny B Good on December 05, 2023, 12:10:59 amWell done, you've made great progress. But what does that high and low peak in the diagram represent? Thanks for sharing

author: Infraviolet
author_rank: Super Contributor
timestamp: December 05, 2023, 02:40:04 am
content: One cannot be certain, some really shoddy arduino uno R3* clone manufacturers might well make fake atmega328p chips to fit in to them... but for the most part a clone arduino is just a clone of the arduino board. The microchips on it will, for any reasonable quality clone, still be genuine ones identical to those used on an officially produced arduino uno R3 board.*I mention R3 as Arduino now makes an "Uno" with a totally different Renesas chip on it, nothing like the Atmega328p which the "Uno" name has become popularly associated with. The Renesas chip may be a great chip, I've not tried one yet, it is definitely higher performance than the atemag328p, but Arduino should NOT have named it as an Uno, They should have given it a new, clear, name to reflect that it was a totally different device.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 03:25:52 am
content: Quote from: Infraviolet on December 05, 2023, 02:40:04 amIt's the Arduino R4, 32-bit Arm® Cortex.I agree that they should have omitted 'UNO', it was my first choice, then friends on the forum recommended the R3 model.

author: brucehoult
author_rank: Super Contributor
timestamp: December 05, 2023, 03:43:12 am
content: There have been a few Arm-based official Arduinos over the last decade, starting with the Due, based on an 84 MHz Atmel SAM3 Cortex M3. It was quite overDue, being announced in September 2011 but not shipped until more than a year later in October 2012!With 94 KB RAM and 512 KB flash the Due had twice the clock speed, twice the flash, and three times the RAM of the Uno R4! It did cost a bit more though, at $50 vs $20. It also had Mega form-factor with 54 GPIOs.I was excited by the Due and bought one when it came out, but it never seemed to be very popular.

author: zapta
author_rank: Super Contributor
timestamp: December 05, 2023, 05:02:18 am
content: The Arduinos are overpriced and under performing.Take this for example, a black pill for $5, 32 bits, 100Mhz, 512KB Flash, 128K RAM, OSH. and for additional $3, a fully functional hardware debugger, that works with platformio (a superior IDE) and the same Arduino code and libraries.https://www.aliexpress.us/item/3256801269871873.htmlhttps://www.aliexpress.us/item/3256805381238585.html?And for $16 480Mhz, OSH, 1MB flash and 128K RAMhttps://www.aliexpress.us/item/3256801288743553.html,compatible with platformio, Arduino libraries, and a hardware debugger.

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: December 05, 2023, 05:29:44 am
content: The "spikes" are a deliberate injection of a pair of data points every 498th plotting point to prevent the serial plotter from re-scaling the Y axis to a range less than 120mK above the 36 deg base line. Here's the code:Code:// /* // uncomment this line to disable output to the plotterk = k +1; // increment for each new plotting pointif (k > 497) { // and print out a pair of range limiting values every 498th point.plotTemp = 120.0; // borrow the plotTemp variable to set the upper limit valueSerial.println(plotTemp,4); // and send it to the plotterplotTemp = 0.0; // set the lower limit and...Serial.println(plotTemp,4); // send this valuek = 0;}//plotTemp = fanControl; // Temporarily borrow the plotTemp variable to plot variations in fan drive strength.plotTemp = (tempBp-36.0) *1000; // Show a plot referenced to the 36 deg base temperature in milli Kelvins//Serial.println(Voltage,6); // was also used to check main loop speed (~11.5Hz after adding the PWMservo library)// After further optimisation, the main loop now runs at 53Hz !!!Serial.println(plotTemp,4); // serial plotter can reveal the underlying thermal lag effect (around a 30s cycling time)//and, rather conveniently, determine the main loop cycling speed using a stopwatch which//now currently runs at 53Hz after reducing the display update rate to one every 20 passes.// */ // uncomment this line whenever the plotter output is disabledThose "spikes" in the plot proved rather handy in measuring the plotting rate using a stopwatch to measure the 498 data plot points in the total of 500 plot intervals covered by the serial plotter window's X axis. You simply had to pick a reference point and time how long it took for the next "spike" to pass that point.For very slow plot rates you could just time between the 100 points markers or for more accuracy at high plotting rates you could time how long it took to make 2 or 5 or 10 passes, depending on your patience level. This applies to Arduino 1.8.19. The later 2.something version that I've inflicted on a windows laptop has an even less useful serial plotter (damn thing tries to scale the X axis as well!).This is a neat way to measure how fast the main loop is running (average is now just over 66Hz - a far cry from when it was running at just over 11Hz before I decided to decimate the oled screen updates to once every 15, 20, 30 and now 60 passes of the main loop (once a second display refresh rate). These once a second hiccups on the main loop surprisingly don't appear to be having any ill effect which means I won't be adding another Nano3 to my project any time soon (if ever).Incidentally, after waiting a couple of hours for the the rubidium oscillator's enclosure temperature to reach the 4 deg ambient, I checked how it was doing only to find it had fallen off its 36.045 degrees perch and was hunting up and down around the base plate fan cut off temperature limit at 35.950 degrees. I'd had a sneaking suspicion that my changing the fan drive low PWM limit from 1 to 14 was possibly the culprit so returned, armed with said laptop to reload an edited version of the sketch to restore the limit to 1.Unfortunately, this made no improvement so I tried a few other changes, all to no avail until I gave up when the cold finally got to me. I'll check it out later this morning when the temperature has risen to see if it will actually get back up onto on its perch. I've obviously made some change that has compromised its previously proven resiliency to 4 degree ambient conditions. Prior to shifting it out of my hobby room, it had been stable enough down to a rather chilly 14.5 degree room ambient with no hint of any impending low temperature issues. Ah well, that's yet another mystery to be solved.

author: Ian.M
author_rank: Super Contributor
timestamp: December 05, 2023, 09:47:20 am
content: Quote from: Infraviolet on December 05, 2023, 02:40:04 amNot so. Seehttps://www.eevblog.com/forum/microcontrollers/arduino-pro-mini-two-copies-have-different-sleep-currents/By reply #66 of that topic, suspicions of fake ATmega328P parts had been raised. Reply #99 confirmed the decapped Aries ATmega328P die differed from the genuine Atmel one.Reply#110linked Kevin Darragh's sketch for reading ATmega Arduinos' signature bytes, which, at the time, could effectively distinguish between genuine and fake/clone chips. Interpreting the results was discussed in some detail.The vast majority of ATmega328P chips not purchased from major distributors offering traceability were found to be fake, and clone Arduino boards were found to have the fake chips.Now, a little over three years later, as I haven't bought any Arduinos or ATmega328P chips recently, I have no idea if the fake detection sketch is still effective as Aries may have got better at faking typical Atmel signature byte content. Its only factory programmed FLASH so 'upgrading' the fakes is as simple as changing a data file on the factory ATE machine.Try Kevin's detection sketch and see what you get.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 12:56:33 pm
content: Quote from: zapta on December 05, 2023, 05:02:18 amThanks for the tip. That programming system had already been recommended to me; in the meantime I will start with the Arduino, then in the future I will be able to broaden my horizons

author: xrunner
author_rank: Super Contributor
timestamp: December 05, 2023, 12:57:54 pm
content: BLINK BLINK BLINK ... BLINK BLINK BLINK ...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 01:11:30 pm
content: Quote from: Johnny B Good on December 05, 2023, 05:29:44 amThanks for the explanation. The beauty of certain projects is the succession of problems to be solved. Of course it might make you impatient, but when they are resolved they are gratifying. What kind of world would it be if everything worked out on the first try?Quote from: xrunner on December 05, 2023, 12:57:54 pmI'm looking for a solution with the software, because the latest IDE version doesn't work on windows 8.1. I have to finish some tests with Windows 11 (trial version), and then install the final version. Then I can start the experiments. The blink should not escape, I will find it again...

author: xrunner
author_rank: Super Contributor
timestamp: December 05, 2023, 01:21:48 pm
content: Quote from: xrunner on December 05, 2023, 12:57:54 pmQuote from: CharlotteSwiss on December 05, 2023, 01:11:30 pmWell I'm teasing you a bit CharlotteSwiss I hope you know.But reading this thread and the advice coming sometimes reminds me of people talking to someone who hasn't ridden a bicycle, but they're already discussing what camshaft to put in the engine in the new NASCAR race car you'll eventually be driving.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 05, 2023, 01:46:44 pm
content: Quote from: zapta on December 05, 2023, 05:02:18 amthose are good examples. but how long you want to get stucked with arduino ide? or at least that uno/mini/nano/mega footprint? i myself have a few STM32 arduino mini/nano/mega board in case i need them but ... struggle to find a situation where the normal atmega board cant do the job. i think i'll move to STM32 when i made a real board, or the one thats using dedicated st-link programmer pin as learning process.. and entirely different ide than "inefficient" arduino ide, its only suitable for small program imho. ymmv.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 02:10:16 pm
content: Quote from: xrunner on December 05, 2023, 01:21:48 pmI knew you were joking. Speaking of jokes, be careful that this woman actually puts her hands on the mechanics of my car (changing brake pads, filters...). I like solving problems, not only men perform certain jobs

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 05, 2023, 02:32:11 pm
content: Quote from: CharlotteSwiss on December 05, 2023, 02:10:16 pmAh the age old thing about men and womenBelieve me I have met plenty of men I would not let near my car to do even a simple thing. Sure there are differences between the genders, but I'm not one to say that women can't do certain tasks. It is more up to a persons individual qualities what they can or can not do.But this is a bit of topic.Back to the Arduino

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 05, 2023, 02:59:09 pm
content: Quote from: CharlotteSwiss on December 05, 2023, 02:10:16 pmi guess his comment nothing to do with gender... but if you like to be in bodybuilding or lumberjack business, we will be happy to give you advice on what hormone to take, cheers

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 04:06:46 pm
content: Quote from: pcprogrammer on December 05, 2023, 02:32:11 pmIf they let me go on holiday for Christmas, I'll finally experiment with the ArduinoQuote from: Mechatrommer on December 05, 2023, 02:59:09 pmMy comment was intended to comment on reality. There are still men who think that we women are incapable of driving a car, or doing other things. I don't want to generalize, but somewhere in the world this gender discrimination still exists. But let's talk about Arduino

author: zapta
author_rank: Super Contributor
timestamp: December 05, 2023, 04:16:23 pm
content: Quote from: Mechatrommer on December 05, 2023, 01:46:44 pmMy post was about STM32 MCUs, hardware debugger, and VSCode/platformio IDE. With that combination, you can use the Arduino API or one of the other supported frameworks.https://docs.platformio.org/en/latest/boards/ststm32/blackpill_f411ce.html#frameworksVSCode/platformio have many advantages over the Arduino IDE such as debugger support, code completion, syntax highlighting, git integration, and the rich VSCode eco system. Platformio has the advantage that the project configuration is defined in a small project file called platformio.ini, and when you open a project, all the tools and libraries are configured automatically, as opposed to the Arduino board and library managers.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 05, 2023, 06:32:45 pm
content: Quote from: zapta on December 05, 2023, 04:16:23 pmi guess this is what xrunner was referring to. from arduino ide, and then jump to platformio, VSCode, and then coocox, eclipse and what not. this will be too much to learn and try to push OP climb the ladder at unbelievable pace. but since OP admitted that she is up for the task, then lets see. from earlier post she said want to do slowly, but then later she said she can do anything, so lets wait and see... i admit myself is struggling to learn all those in these many years. if what she claimed is true, then she can jump right away to arm32, st-link programmer and ARM Development Studio 5 on a barebone pedal to the metal pcb + arm32 programming. thats what i always wanted to do. cheers.ps: what i will be more glad to see is if she can do c/c++ class object oriented sw development, data structures and algorithms, asm and some gui/game sw dev skill and tricks etc. if i can do it in free/side time, so she certainly can!cheers.

author: fourfathom
author_rank: Super Contributor
timestamp: December 05, 2023, 07:03:47 pm
content: I still suggest starting at the BLINK and "Hello, world" level, using any available Arduino or compatible board, and using the Ardiuno IDE. You can learn a lot, and actually do quite useful projects with these. The barrier to entry is minimal, and help is *very* available.Then if you so desire look at other hardware and other software tools.

author: brucehoult
author_rank: Super Contributor
timestamp: December 05, 2023, 07:45:51 pm
content: Quote from: xrunner on December 05, 2023, 01:21:48 pmYes. It's ridiculous.Get Uno. Install Arduino IDE. Make sure File / Examples / 01.Basics / Blink works. Modify it and some of the other examples. Start your own project. Be happy.It's going to take most people years to outgrow that.

author: MarkF
author_rank: Super Contributor
timestamp: December 05, 2023, 08:22:13 pm
content: Quote from: CharlotteSwiss on December 05, 2023, 01:11:30 pmDon't get hung-up on the latest version of the IDE.There is nothing wrong with the old Arduino IDE 1.8.19 for your purposes.I still run Win 7 and the old IDE.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 05, 2023, 08:31:48 pm
content: Quote from: zapta on December 05, 2023, 04:16:23 pmWhen I've 'worn out' the Arduino, maybe I'll move on to study this other MCU. It actually looks interesting.Quote from: Mechatrommer on December 05, 2023, 06:32:45 pmWould I have said I was in a hurry to learn? I'm not a woman in a hurry. In fact, I haven't connected the Aduino to the PC yet (it's on the workbench begging me to take care of it)Quote from: brucehoult on December 05, 2023, 07:45:51 pmBut in fact this will be my path. I never said otherwiseQuote from: MarkF on December 05, 2023, 08:22:13 pmYou're right Mark. But I'm not stuck for the IDE, but as I wrote previously it's a period where work takes away my oxygen. But soon I will finally experiment(on the spare PC I also use Windows 7, in my opinion the best Microsoft OS!).

author: MarkF
author_rank: Super Contributor
timestamp: December 05, 2023, 11:27:32 pm
content: Quote from: CharlotteSwiss on December 05, 2023, 08:31:48 pmI cut out that work thing...It just took up too much of my time.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 06, 2023, 12:13:10 am
content: connecting arduino to pc, upload/compile led blinky and post success picture here only takes an hour at most. its just less 1 hour clubbing (after work) timeas highlighted, if latest arduino ide cannot be installed, there's always older version...

author: rstofer
author_rank: Super Contributor
timestamp: December 06, 2023, 12:48:01 am
content: You can use the older IDE on Win 7 and later.Scan down the page for Legacy IDE 1.8.19https://www.arduino.cc/en/softwareYes, the older IDEs are crap but that is relative. Millions of people have used them and it all worked out. I have a color vision problem so the choice of colors for warning messages is suboptimal. With an amazing amount of research, the colors can be changed.Apparently, there is an online compilerhttp://arduinodev.com/software/builder/Nothing to install. I have never used it... I couldn't get it to work on my Macbook....

author: themadhippy
author_rank: Super Contributor
timestamp: December 06, 2023, 01:09:10 am
content: QuoteIndeed,personalty i prefer 1.8.19 over 2.2 something or other,the only good thing i can say about 2.2 is the serial monitor is in the same window .

author: brucehoult
author_rank: Super Contributor
timestamp: December 06, 2023, 01:16:34 am
content: Quote from: rstofer on December 06, 2023, 12:48:01 amIt's absolutely fine for small projects. I've been programming for over 40 years on all kinds of things, and I don't mind the 1.8 (and earlier) Arduino IDE at all. The editor is better than Windows Notepad at least, and I know people who write code in that POS.On bigger projects I tend to use an external editor (emacs) and just switch to the IDE to compile and download and run.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 06, 2023, 01:44:00 am
content: Quote from: themadhippy on December 06, 2023, 01:09:10 am2.2.1 got some arduino logo beep beep before entering editor, its like trying to connect online, i hate that.

author: fourfathom
author_rank: Super Contributor
timestamp: December 06, 2023, 01:55:49 am
content: Quote from: Mechatrommer on December 06, 2023, 01:44:00 amI'm using 2.2.1, and am pretty happy with the update (I'm using Win10). If enabled, the serial monitor auto-reconnects after you upload a new program (which is nice). The include-file handling is improved, and there are other features that seem useful. I do wish I could split an edit window so I can work on two sections if a file without needing to scroll up and down -- it that capability is there I haven't found it.I also use Visual Studio (mostly for C#) and platformio, but the simplicity of the Arduino IDE is very attractive for small/medium jobs.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 06, 2023, 04:55:56 pm
content: Quote from: MarkF on December 05, 2023, 11:27:32 pmI'll have to work for a few more years. But I love my job. Challenging and difficult, but gives emotions (to people)Quote from: Mechatrommer on December 06, 2023, 12:13:10 amBut what disco. At most I allow myself a romp in the snow with my wolf. However the blink will arrive (and I will ring the bells for the event)Quote from: rstofer on December 06, 2023, 12:48:01 amThanks Rstofer. As I explained a few messages ago, it is not a problem of the IDE, but of the time to dedicate to the Arduino. The period is not the best at work... But soon I will be able to start with this new projectQuote from: themadhippy on December 06, 2023, 01:09:10 amWhat things got worse, from your point of view, about version 2.2.x?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 10, 2023, 08:50:30 pm
content: When I connected the Arduino to my PC for the first time, it was recognized immediately without problems. I obviously tried the sketch blink, modifying the time of the high signal and that of the low signal (ms) to my liking.Then loading an 'empty' code, I see that the LED always stays on (I think this is normal). For now everything is simple (but only for now!)

author: westfw
author_rank: Super Contributor
timestamp: December 11, 2023, 07:44:28 am
content: QuoteWithout any code, all of the Arduino pins are set as inputs. On older Arduinos, this would mean that the Pin13 LED would be Off, since the LED was connected directly (w resistor) to the output pin.On newer Arduinos, they avoid loading the output pin by driving the LED via a spare op amp from the power supply circuit. That means that the when the AVR pin is set as an input, the op-amp input is floating, and the output state is somewhat random. (but it's just the LED state that is random - the pin state is still high-Z "input")

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 11, 2023, 07:58:09 am
content: Quote from: CharlotteSwiss on December 10, 2023, 08:50:30 pmThe opamp driving the LED most likely sees the floating input as high making it's output high and thus lighting the LED. Could also be due to noise.On simpler Arduinos like the nano or a board like the bluepill the LED is connected directly (with a series resistor of course) to the MCU and then it won't be lit. No current coming from a high Z or input pin.Edit: westfw was a bit faster then me, but the forum software did not complain this time

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 11, 2023, 11:17:48 am
content: Quote from: westfw on December 11, 2023, 07:44:28 amQuote from: pcprogrammer on December 11, 2023, 07:58:09 amAs you said, the signal comes out of pin 13 and then passes through the operational amplifier, resistor and LED. I simply checked the duration of the signal with the oscilloscope, perfect as programmed in the code (+5v-0v digital signal). When I wrote the message, after loading the empty code, the LED remained lit; but the next time, same code, the LED remained off. Random.Now I need to better understand how memory behaves when I load new code. I didn't use the pre-installed blink, but I wrote it myself. When I send it, it remains written in the memory, I don't see why at the end it asked to save or not. Little by little I will learn...

author: themadhippy
author_rank: Super Contributor
timestamp: December 11, 2023, 02:11:30 pm
content: QuoteThe save is to save the file on your computer,not on the ardunio

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 11, 2023, 03:02:46 pm
content: Quote from: themadhippy on December 11, 2023, 02:11:30 pmIt wasn't that hard to understandthanks.----After this first exercise, I can easily power an external LED (with its resistor), with digital output 13 (but without powering the internal LED).I'm starting to like this game (since it's easy...)

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 11, 2023, 04:39:09 pm
content: Quote from: CharlotteSwiss on December 11, 2023, 03:02:46 pmOnce you know what it is about it is always easyBut getting there could be hardKeep up the good work. Try reading an analog signal from a potentiometer and control the brightness of the LED with it. Look into PWM for this. Also fun in combination with your scope.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 11, 2023, 05:37:59 pm
content: Quote from: pcprogrammer on December 11, 2023, 04:39:09 pmExactly, I'm happy because it's easy to understand what's happening. I accidentally read the first pages of a 'difficult' book on Arduino, it made me want to give up...I think you know this exercise in the kit. I'll be happy to experiment

author: rstofer
author_rank: Super Contributor
timestamp: December 11, 2023, 05:51:19 pm
content: Learning opportunity: Use the "BareMinimum" example code (reset program) and probe pin 13 (LED) with your scope. See if it oscillates, what is the voltage, is the LED just dim (it is on my Uno)? What is going on with the pin?You could also probe pin 1 of RN2A (or the ungrounded side of the LED). Do both LED and pin 13 at the same time and see how the diode curve works (I think).Take every opportunity to use your scope.Try the tone() function:https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/Code:void setup(){pinMode(8,OUTPUT)tone(8,1000)}void loop(){}Check the output on pin 8 with your scope. You can probably use the buzzer from your starter kit if you want to hear the tone. See the kit instructions for using the buzzer.You should see a 1 kHz square wave.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 12, 2023, 08:52:26 am
content: Quote from: rstofer on December 11, 2023, 05:51:19 pmYellow signal on pin 13, purple signal on the LED pin (I was in a hurry, maybe I made a mistake); however, the LED was off. I'll try Tone later.

author: tautech
author_rank: Super Contributor
timestamp: December 12, 2023, 10:03:37 am
content: The counter lies, not sure why but a 20ms period does not = 37kHz.300mV wouldn't turn ON a LED.Maybe Default the scope and setup the 10x input attenuation again and check your probes are set to that too.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 12, 2023, 10:58:44 am
content: Quote from: tautech on December 12, 2023, 10:03:37 amaha! what brand is that?Quote from: CharlotteSwiss on December 12, 2023, 08:52:26 am100mV/div and you got only 400mV tops, you are screwed man!i'm not sure with modern arduino with opamp drive, i dont have one. so i cannot help sorry.

author: tautech
author_rank: Super Contributor
timestamp: December 12, 2023, 11:22:00 am
content: Quote from: Mechatrommer on December 12, 2023, 10:58:44 amA brand that requires Default when info on the display makes no sense.All brands can do this when settings are incorrect.Charlotte is not an experienced scope user but guidance will have her see when readings are wrong, for whatever reason.

author: MarkF
author_rank: Super Contributor
timestamp: December 12, 2023, 12:19:45 pm
content: Quote from: tautech on December 12, 2023, 10:03:37 amMaybe you should describe the procedure to do that ("default" the scope).I've never heard that term. Is that the same as "self calibration"?

author: MarkF
author_rank: Super Contributor
timestamp: December 12, 2023, 12:23:41 pm
content: Her sketch says pin 8.While she says she's probing pin 13 with the scope.

author: tautech
author_rank: Super Contributor
timestamp: December 12, 2023, 12:28:06 pm
content: Quote from: MarkF on December 12, 2023, 12:19:45 pmNo.Default resets a scope to factory settings.The green button on the front panel below.These scopes also can have a User default saved so that favourite settings can be recalled.To do this you set the scope just as you like in and in the Save/Recall menu save instead of factory default.It can also be done with a Setup (Save/Recall menu) of which several configurable settings can be made, saved and recalled from internal memory.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 12, 2023, 02:17:08 pm
content: If people bothered to read what is written, then one would see that the LED is off, and the signal she is seeing is a floating signal on the opamp input which is amplified by a factor 1 and outputted to the LED. The signal looks very much like 50Hz sine from the mains picked up by the board. Just as touching the probe tip with your finger will show a similar shape on the scope. This is an electric field phenomena.If I'm reading the scope display right, it also looks like it has some DC offset, which can explain why the LED is sometimes lit and other times not. With peak voltages above the LED forward voltage it will start to light up. Dimmer then when fully on, but still visible as if it is on.The sketch with the tone output on pin 8 is something she is going to try later. The sketch was proposed by rstofer.tautech is correct in signaling that the ~37KHz seen on the scope display is not in accordance with the displayed signal on the set time base of 10ms/div. Why this is he can probably explain when he knows the settings. I'm not familiar with Siglent scopes.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 12, 2023, 02:31:11 pm
content: Come on guys, it was a try after a 12 hour night shift jobI'll try again. However, as PCprog rightly said, the LED was OFF (or rather, as soon as the Arduino was started it was on, then it turned off. I had loaded the bare minimun sketch. I also saw an offset of about 100mV on the two signals. The yellow signal was on pin 13 (I will do it on pin 8 later with the Tone example). See you later friends

author: rstofer
author_rank: Super Contributor
timestamp: December 12, 2023, 03:28:31 pm
content: Quote from: MarkF on December 12, 2023, 12:23:41 pmIf I saw that sin wave at about 400 mV, I would be thinking floating input with noise from the environment. If the period is 20 ms, I would think 50 Hz noise. I can't see the graticle...The tone example uses pin 8, the reset/blank example uses pin 13. The pin 13 connection is right from the uC so, for the blank example, it should be floating. It was never initialized so trash may be expected.For the tone example, pin 8 is initialized as output and the waveform should be pretty clean.Make sure the probe ground is connected to a Gnd pin.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 12, 2023, 04:10:56 pm
content: I tested the signal again only on pin 13 (the sketch is bare minimum). The LED is on, but as soon as I connect the oscilloscope to pin 13, the LED turns off (I do not understand why), and the signal is the one in the image (same as the previous one, we always have 100mV offset). I saw that the frequency on this signal is fluctuating...I tried to insert the Tone code, but the IDE gives syntax error.Thank you

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 12, 2023, 04:48:28 pm
content: The reason the LED turns of when you probe pin 13 has to do with the fact that the probe has resistance and capacitance to ground. It depends on the probe attenuation factor (1x or 10x) what the resistance is. The effect is that the signal dampens by it and the voltage level at the output of the opamp falls below the forward voltage of the LED.This is a problem with measuring on high impedance circuits. Instead of looking at pin 13 you can only probe the output of the opamp, directly on the LED if that is easier and not on pin 13. The opamp has a low impedance output and is not bothered by the probe. You should see a higher voltage if the LED is lit.Edit: The problem with rstofer his example are the missing semicolons at the end of the function calls.Code:void setup(){pinMode(8,OUTPUT);tone(8,1000);}void loop(){}Try the above.

author: rstofer
author_rank: Super Contributor
timestamp: December 12, 2023, 05:16:11 pm
content: Quote from: pcprogrammer on December 12, 2023, 04:48:28 pmMy bad... I knew I should have run the code and the entire experiment.According to the schematic, pin 13 connects directly to the uC. The op amp only gets involved with the LED. It might be interesting to probe but the op amp doesn't drive a pin.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 12, 2023, 05:42:32 pm
content: Quote from: pcprogrammer on December 12, 2023, 04:48:28 pmThanks PCprog, I imagined it was a matter of cutting off the power to the opamp. Tomorrow I will test the signal only at the output of the operational amplifier with the LED on (without testing pin 13).I will also try the Tone code, in fact IDE told me about the lack of ; , but I had placed them before the command and not at the end.Quote from: rstofer on December 12, 2023, 05:16:11 pmNo problem, at least he learned to understand why code is written badly. For example, now I understand how to tell the ATmega which I/O pin to drive.Note: sometimes I confuse the pins of the ATmega with the I/O pins of the board: for example, SCK is pin 19 of the MCU, but it is pin 13 of the I/O

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 12, 2023, 09:02:52 pm
content: It is indeed a bit confusingThe uC pin used in this case is pin 19 which is labeled SCK but also named PB5 and then connected to the IO header on pin 13 and the input of the LED driver opamp U5B.The PB5 name indicates that internally it is bit 5 of IO port B. You can look in the reference manual chapter 2.1 for a block diagram of the uC.I'm not sure about the naming in the Arduino "language". For instance the "tone" sketch of rstofer uses pin 8, and I'm sure this is pin 8 of the IO header and not pin 8 of the uC, because that is a ground pin.More of a bare metal programmer myself so not to familiar with Arduino.

author: rstofer
author_rank: Super Contributor
timestamp: December 12, 2023, 09:24:28 pm
content: Without a horrible hack, the only pins the Arduino user has access to are on the headers and that's what the pin number references. I suppose there are advanced concepts that require knowledge of the uC pins but they will wait.

author: zapta
author_rank: Super Contributor
timestamp: December 12, 2023, 09:37:09 pm
content: DuPont female to male are hard to find.

author: fourfathom
author_rank: Super Contributor
timestamp: December 12, 2023, 09:56:05 pm
content: Quote from: rstofer on December 12, 2023, 09:24:28 pmCharlotte is using the Uno, right? Here's a pinout cheat sheet:

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 13, 2023, 06:26:04 am
content: Quote from: pcprogrammer on December 12, 2023, 09:02:52 pmQuote from: rstofer on December 12, 2023, 09:24:28 pmWe forgot that the SCK signal also refers to another pin number: 6 of the I/OQuote from: zapta on December 12, 2023, 09:37:09 pmIn my set of Chinese DuPont cables, there are all combinationsQuote from: fourfathom on December 12, 2023, 09:56:05 pmThanks for the diagram, very interesting.

author: rstofer
author_rank: Super Contributor
timestamp: December 13, 2023, 06:37:51 am
content: Quote from: zapta on December 12, 2023, 09:37:09 pmMaybe the lengths are inadequate but Amazon has a bunch of jumpers. You have to strip a single strand from the flat cable.https://www.amazon.com/s?k=breadboard+jumper+wires

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 13, 2023, 07:06:32 am
content: Quote from: rstofer on December 13, 2023, 06:37:51 amMy old set of 300 pieces is of good quality; the ones I received with the Elegoo kit are short, and I have the impression that the male pin is perhaps too thin (they enter the Arduino I/O too easily).Now I don't have time to test the Tones, but I saw that it is possible to give a duration to the sound if I'm not mistaken.Maybe I'll try a classic 440Hz tone for 10sec with this code:Code:void setup(){pinMode(8,OUTPUT);tone(8,440,10000);}void loop(){}Will any pin on that side be able to come out with a tone?I will check the tone signal with the oscilloscope, I want to see if it will be clean.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 13, 2023, 07:21:44 am
content: Quote from: CharlotteSwiss on December 13, 2023, 07:06:32 amYes you can specify the duration like that. This is a good learning point about the difference between C and C++. In C it is not common to have a function with the same name that accepts different number or type of parameters, while in C++ it is defined functionality. This is called function overloading. In this case the duration is made optional.The Arduino reference does not show any limit on the pins that can be used with tone, so just give it a try.As an exercise you could try to make a sketch with a couple of push-buttons and a buzzer and assign a different note to each push-button. Note that it only allows monophonic playback, meaning just a single note at any time.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 14, 2023, 08:29:49 am
content: Quote from: pcprogrammer on December 13, 2023, 07:21:44 amThank you.I tried 3 tones of different frequency (50, 220, 440). My curiosity was the type of signal and it cleanliness (square wave oscillating on hight). For the Siglent detractors, the frequency detected by the oscilloscope is the one I set in the code

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 14, 2023, 09:46:24 am
content: You are welcomeI wonder what is causing the higher frequency ripple in your signal. Looks like the code is setting the output in high Z for short spans of time instead of keeping it high all the time.You can try to write a piece of code using the delay function to output a frequency not using the tone function. Something like the blinky sketch, but faster. See if the signal is cleaner then.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 14, 2023, 02:19:09 pm
content: Quote from: pcprogrammer on December 14, 2023, 09:46:24 amLet's say that the perceived sound is still 'continuous' as the low range is very short. Your suggestion predicted my thought, in fact I wanted to experiment with introducing something from the blink code, but my intent was to do: sound-pause-sound-loop... (with the Tone code I wrote above, it plays for 10 seconds and then everything goes silent ). I didn't think this world of the MCU was so fun, new to me. Thank you

author: rstofer
author_rank: Super Contributor
timestamp: December 14, 2023, 02:29:35 pm
content: I don't get the high frequency bobble, just a clean square wave.How are you powering the board?What does incoming power look like?If using an external PS, not USB, are you sure the ground connections are correct?Is the probe shield connected to the common ground?Is there anything connected to pin 8? An LED maybe?On most bench PSs, the black jack (-) is NOT grounded unless you put a jumper between the black jack and the green jack.Can you post a picture of the setup?

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 14, 2023, 02:45:06 pm
content: Quote from: rstofer on December 14, 2023, 02:29:35 pmI have 2 buzzers in the kit, one active and one passive, here is the description:Buzzers are divided into two categories, active and passive. By turning the two buzzers with their feet upwards, the one with the green circuit is the passive buzzer, on the contrary the closed one with the smooth black surface is the active one.The difference between the two is that the active buzzer has an oscillating input, thereforeIt will generate sound when electrified. A passive buzzer, on the other hand, has no such input, so it will not make any sound when it receives direct current as a signal. With the passive buzzer you will have to use a square wave signal whose frequency must be between 2K and 5K.The active buzzer is often more expensive than a passive one, this is due to the fact thatinside it there are some oscillating circuits.I used the active one, maybe this explains that 'oscillating' signal when it's high?The signal still seems nice and clean to me (leaving aside the high Z)

author: rstofer
author_rank: Super Contributor
timestamp: December 14, 2023, 03:03:53 pm
content: For an active buzzer, you don't supply a frequency, you send a HIGH or LOW and it buzzes at its own frequency.With a passive buzzer you can control the frequency or tone.https://www.circuitbasics.com/how-to-use-active-and-passive-buzzers-on-the-arduino

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 14, 2023, 03:31:11 pm
content: Quote from: rstofer on December 14, 2023, 03:03:53 pmLater I run the link code, also using the button. I'm curious to see the difference between the two buzzers. It doesn't make sense to me that an alternating signal can come out of a digital I/O... I'll experiment, all at schoolThank you

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 14, 2023, 04:06:37 pm
content: Quote from: CharlotteSwiss on December 14, 2023, 02:45:06 pmThat explains it. The active one loads the pin with it's own frequency and that is what is seen on the scope as the ripple. You can try connecting the active one to a 5V supply with a small resistor in series and then use your scope to check the voltage across the buzzer. (So V+ --> resistor --> buzzer --> ground) Probe tip connected to the point between the resistor and the buzzer. Set the scope channel to AC and try to measure the frequency.

author: rstofer
author_rank: Super Contributor
timestamp: December 14, 2023, 04:20:52 pm
content: Quote from: CharlotteSwiss on December 14, 2023, 03:31:11 pmThe digital IO is changing state hence oscillating. Sure, the voltage is varying between 0V and 5V instead of some symmetric waveform around 0V (say -2.5V to +2.5V) but it is still oscillating. In later projects, we will get rid of the 2.5V bias.

author: rstofer
author_rank: Super Contributor
timestamp: December 14, 2023, 04:36:06 pm
content: Quote from: CharlotteSwiss on December 14, 2023, 02:19:09 pmIt's even more fun with your scope. Many people never get to see the 'bobble' on the trace and learn about signals. A good scope isn't a 'must have' but it is darn sure a 'nice to have'.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 14, 2023, 06:53:07 pm
content: Quote from: pcprogrammer on December 14, 2023, 04:06:37 pmI will repeat the exercise as you suggested; I also saw that I had CH coupling on DC (but it is not a fixed DC signal!)Quote from: rstofer on December 14, 2023, 04:36:06 pmWithout an oscilloscope these signals would be soulless. It's nice to observe the heart of the signal

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 14, 2023, 08:58:59 pm
content: QuoteNormally when scoping pins of a digital system you want to have your scope channels set to DC, because the actual levels are important, even if it is a switching signal, like for instance an I2C or SPI bus where things might go wrong. Then you want to make sure the signal levels are what they need to be. For a 0 (low) most common is that it needs to be below 0,8V and for a 1 (high) it should be above 2V.When you set your scope channels to AC a capacitor is placed in the signal path, filtering out the DC component. This way you loose the information important for digital systems. For determining a frequency of a signal it is easier when it crosses 0V, which is achieved with the capacitor of the AC setting.With the suggested setup for testing the buzzer, the signal will have a large DC component (offset) and a small AC component (varying signal). The size of the AC component depends on the resistor and the current drawn by the buzzer.QuoteIt certainly is, but it is also difficult to interpret what you see on the screen. It is part of the learning curve, and differs for the different fields found in electrical engineering. Digital systems have different signals and characteristics then analog system, etc.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 14, 2023, 09:12:11 pm
content: Quote from: pcprogrammer on December 14, 2023, 08:58:59 pmThanks for the explanation, in fact if I had read my notes on the oscilloscope better, I would have found the difference between DC or AC coupling. Then, however, I will do some targeted experiments. Of course, understanding what you see on the oscilloscope display is not easy for those who are not very expert, but it is still a fascinating experience

author: MarkF
author_rank: Super Contributor
timestamp: December 15, 2023, 12:00:51 am
content: In general practice, the only time you will ever want to use AC coupling on the oscilloscope is when you want to zoom in on a small signal riding on top of some DC voltage. Your results would be an example if you want to expand the small ripple on the top of the square wave. The majority of the time you will want to use the DC coupling setting.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 03:49:19 am
content: I also tried the passive buzzer, and I made it sound with a code that played 7 consecutive notes in a loop; I then modified the code to run the job only once. Cute.The signal, however, is not a perfect square wave, but as shown in the image (above the lowest frequency note, above the highest).Now I can abandon the buzzers and follow the kit's experiments gradually. Thank you guys.

author: themadhippy
author_rank: Super Contributor
timestamp: December 15, 2023, 04:12:55 am
content: Quoteor get the ardunio to take a midi stream and play it through the buzzer

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 05:28:06 am
content: Quote from: themadhippy on December 15, 2023, 04:12:55 amMaybe my ONE can't do this?https://docs.arduino.cc/tutorials/generic/midi-deviceNow

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 15, 2023, 07:20:02 am
content: Quote from: themadhippy on December 15, 2023, 04:12:55 amQuoteYours can't do the USB midi variant, but midi itself is in it's basic definition based on a standard UART, and that is something yours can do. But it is probably above your skill set for now.As you wrote yourself it is better to slowly grow into the more complex stuff. Just play with your kit and think of modifications you can make to have it behave like you want.The overshoots you see in the signals with the passive buzzer can be caused by the impedance of the buzzer, or your probe needs calibration. Try connecting just your probe to the Arduino pin and nothing else. See if the squarewave is better then. If not adjust your probe. Most likely it has been explained in your scope for a woman thread.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 01:03:34 pm
content: Quote from: pcprogrammer on December 15, 2023, 07:20:02 amThanks PcProg, I will proceed with the guide of my kit, which has a route from easy to medium-easy. It will teach me a lot. I better not digress too much on the topic for now, otherwise my head will go into confusion.The probe is perfectly calibrated (I did it 1 month ago after updating the FW). It's definitely something about the buzzer. However, I will test the output signal on pin 8 with this code, without having connected the passive buzzer

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 01:15:32 pm
content: Quote from: rstofer on December 14, 2023, 02:29:35 pmI hadn't seen your addition to the message: but is your image a passive buzzer that emits a sound from the Arduino?The board is powered only via PC USB, no power supply. The Siglent is grounded I guess. The ground of the probe is connected to the gnd of the Arduino (there are 3 in the pins). Only the positive of the buzzer is connected to pin 8. As you may have seen, with the passive buzzer there are also high-low peaks at the edges of each square wave

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 02:16:30 pm
content: Signal test (Tone code, pin 8, 440Hz):first screen: with passive buzzer connected; second screen: signal, but without buzzer connected; third screen: detail of the spikes at the edges (approximately 2vdc); fourth screen: the calibration of my probe

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 15, 2023, 02:31:20 pm
content: Clearly the passive buzzer has quite the impact.With your probe perfectly adjusted it shows the switching spikes of the arduino and it shows that the buzzer reacts on them like a capacitor would. I'm not a true electronics expert, so don't know the real cause of the spikes, but do know that fast switching FET's (is what the MCU is made of) give these kind of spikes. It is ringing of the signal.You can try to zoom in on a single spike and it might show an overshoot first, and then a smaller undershoot, etc until the signal is at stable level.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 03:48:14 pm
content: Quote from: pcprogrammer on December 15, 2023, 02:31:20 pmWith the passive buzzer I could easily program a simple song to play for some alarmsTonight I'll zoom in on the peaks better, they are only created on two corners of the picture signal. Surely the signal comes out like this from the pins (I also tried on pin 9, same). Thank you

author: tooki
author_rank: Super Contributor
timestamp: December 15, 2023, 05:02:36 pm
content: Quote from: zapta on December 12, 2023, 09:37:09 pmAbsolute nonsense. They’re perfectly easy to find.

author: rstofer
author_rank: Super Contributor
timestamp: December 15, 2023, 05:07:38 pm
content: When you compensate your probes, do them all and keep the port/probe mix constant. Don't swap them around.Those are inductive spikes and are the bane of fast switching. Calculus wise. V = L di/dt where L is the inductance and di/dt is the change in current per time interval. When you switch in nanoseconds, di/dt gets very large.You can slow down the rise time by putting some low value resistor in series with the pin. Getting the right value takes some experimenting.Just for giggles, try 47 Ohms and 100 Ohms. Capture and post the results.You will also see reverse diodes across coils and motors to absorb the reverse spike caused by switching - especially PWM circuits.https://binaryupdates.com/reverse-current-protection-using-diode/

author: xrunner
author_rank: Super Contributor
timestamp: December 15, 2023, 06:07:21 pm
content: Quote from: zapta on December 12, 2023, 09:37:09 pmQuote from: tooki on December 15, 2023, 05:02:36 pmYea I saw that comment yesterday and thought "I just bought some a year ago and they weren't hard to find at all". I got busy and forgot about responding.Still aren't hard to find -https://www.amazon.com/California-JOS-Breadboard-Optional-Multicolored/dp/B0BRTHR2RL/ref=sr_1_4?crid=2IZA4T8WR79MU&keywords=dupont%2Bmale%2Bfemale%2Bjumper%2Bwires&qid=1702663454&sprefix=dupont%2Bmale%2Bfemale%2Bjumper%2Bwires%2Caps%2C109&sr=8-4&th=1

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 06:45:01 pm
content: Quote from: rstofer on December 15, 2023, 05:07:38 pmIt is absolutely one of the first notes I made when I bought the oscilloscope: calibrate the probes and keep the input the same. Never reversed. They are absolutely calibrated.Ok so as pcProg also suggested, those are mostly due to the fast switching. I don't know this kind of process, it's a new world for me. I will carry out the test with the resistor in series with pin 8. After dinner...

author: rstofer
author_rank: Super Contributor
timestamp: December 15, 2023, 08:46:46 pm
content: What's this 'dinner' thing, have it delivered. You have things to do, no time off for making a snack. Bonus points if you can order online.Sleep? No EE student ever had time to sleep. Just a low doze while writing loop equations.It's amazing what you can do when you are young, broke and driven to succeed.You can probably hold a sandwich in one hand and type code with the other. A form of time multiplexing...

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 09:42:09 pm
content: I am a good cook, I like cooking. I hate meals prepared elsewhere. For sleep, no problem. I sleep very little! And that's not healthy.------The first two screens from above are on the original signal of pin 8 (with code tone-440hz, but without buzzer)); you can see the size of the anomalous peak (it rises up to 7.6 volts!).Then I did the test (again without buzzer) by placing a resistor in series with pin8: I started from 100 ohm (still 1 volt peak), while with 220 ohm, as can be seen in the lower screen, in practice the peak is almost non-existent .All this just for study, now I'm going back to the Elegoo guide

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 15, 2023, 09:51:18 pm
content: The scenario of the experiment

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 16, 2023, 03:31:22 am
content: Quote from: CharlotteSwiss on December 15, 2023, 09:51:18 pmat last! we got a picture! i've been waiting for this... and a more sensible test setup. but urgh... that dip socket looks oldish model.. :'(

author: themadhippy
author_rank: Super Contributor
timestamp: December 16, 2023, 03:38:08 am
content: Quotemakes life much easier to fix in the event of a mishap

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 16, 2023, 04:23:50 am
content: Quote from: themadhippy on December 16, 2023, 03:38:08 ambuying single mcu online is not fun anyway (shipping cost), buying the whole UNO board maybe cheaper from local dealer. i'm not talking try to upload bootloader yet. and who buy DIP footprint today? its the age of smd and jlcpcb...

author: Ian.M
author_rank: Super Contributor
timestamp: December 16, 2023, 05:13:30 am
content: It looks like Elegoo make a good clone of the original Arduino Uno R3, rather than cutting corners by replacing the ATmega16U2 used for the USB <=> serial interface with a dumb USB UART chip, like many other Chinese clones use. That gives you more options as the ATmega16U2 can run code other than Arduino's standard USB serial bridge. e.g. you could reflash it with the Hoodloader2 bootloader which lets you run custom sketches on the ATmega16U2, maybe to act as different classes of USB device, or it can be re-flashed over USB to act as an AVR ISP programmer to program the socketed ATmega328P e.g. to get the Arduino bootloader onto a brand-new one if you don't have a spare Arduino to run ArduinoISP on, or any other AVR ISP programmer.https://fedevel.com/blog/how-to-flash-arduino-bootloader-without-a-programmerYou probably wont be ready to dive into tricky stuff like using both AVRs on a Uno R3 for quite some time, but its always good to have options.I should note that the breadboard jumpers in the kit with round pins with moulded on round black insulators aren't really suitable for connecting to Arduino female headers. Their pins are too thin and you wont get a reliable connection to the Arduino even though they are fine in or between breadboards. Rather than fighting them, or even kinking their pin ends for better contact, I strongly recommend using jumpers with 'DuPont' male pins at both ends. I hope your kit came with some (if so they are the ones with a square insulator and a pin at both ends), otherwise, treat yourself to some or if you've got the tooling and connectors, crimp some up.

author: fourfathom
author_rank: Super Contributor
timestamp: December 16, 2023, 06:26:03 am
content: Quote from: rstofer on December 15, 2023, 05:07:38 pmAnd that waveform is an excellent way to become familiar with the characteristics of an inductor. That buzzer is essentially an inductor in series with a resistor (the resistor is actually the resistance of the wire in the inductor, but keeping it simple you can consider them as a separate L and R). In many ways an inductor is the opposite of a capacitor. To anthropomorphize things, a capacitor tries to keep the voltage across it constant, while an inductor tries to keep the current through it constant. Just as there is an RC time constant (t = R * C), there is also an LC time constant (t = L / R). In your case, the (effective) output resistance of the Arduino output is also in series with the buzzer's resistance.So what you are seeing is at the initial rising edge of the stimulus, the inductor looks like a high impedance, and the applied voltage hits 5V. Following the RL time constant, the current in the inductor rises, until it is limited by the circuit series resistance. Then the measured output voltage is determined by the ratio of the Arduino output resistance (*) and the buzzer DC resistance.Then as the applied voltage switches back to zero, the inductor current remains initially constant. This drives the measured voltage negative, with the relative values of circuit resistance setting that negative voltage. The inductor current drops per the RL time constant, eventually reaching zero, and the measured voltage returns to zero.(*) The Arduino output pin is better modeled as a current-limited voltage source with output resistance, but that doesn't much change this hand-waving analysis.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 17, 2023, 12:53:15 am
content: Quote from: Mechatrommer on December 16, 2023, 03:31:22 amNote the return to gnd not connectedQuote from: Ian.M on December 16, 2023, 05:13:30 amSo do some Arduino clones have a different USB-serial converter from the original? Mine has the ATmega32U2 (not 16U2).For Elegoo breadboard jumpers, absolutely useless: thin (0.58mm) and loose in the pins, the black protectors slide off the cable. Luckily I have my DuPonts with square terminals (enough > 0.6mm), I will only use those. Thank youQuote from: fourfathom on December 16, 2023, 06:26:03 amThanks for the explanation, let's say that in these phenomena the oscilloscope helps a lot to 'read' the analyzed signal. With a multimeter I wouldn't have noticed anything.Surely these peaks above 7v, for example 'alter' the buzzer beeps I think.

author: Ian.M
author_rank: Super Contributor
timestamp: December 17, 2023, 02:58:08 am
content: Arduino UNOs and MEGA2560s have variously had ATmega8U2, ..16U2 and ..32U2 MCUs as the USB serial bridge. 16U2 is merely the most common on official and 100% clone boards. These MCUs are variants of the same device with differing memory sizes. Previous generations of Arduino had dedicated 'dumb' USB <=> serial ICs, FTDI FT232RL on official boards. The clones often used other chips e.g. WCH's CH340G.

author: brooko
author_rank: Contributor
timestamp: December 17, 2023, 07:03:37 pm
content: Hi, this is the guy, everything you need to know...https://www.youtube.com/playlist?list=PLGs0VKk2DiYw-L-RibttcvK-WBZm8WLEPRecommend getting the Elegoo starter kit.Andy

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 18, 2023, 01:22:59 am
content: Quote from: Ian.M on December 17, 2023, 02:58:08 amThank you for the explanationQuote from: brooko on December 17, 2023, 07:03:37 pmI already have the starter kit. Thanks for reporting the videos

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 24, 2023, 05:33:51 am
content: Quote from: Nominal Animal on November 24, 2023, 09:11:37 pmI received the usb isolator (adum3160 chip). Arduino works perfectly.The red power LED is quite annoying. If it hadn't been in a difficult position, I would have changed the series resistor; I will put black tape over the LED. Thank you.

author: Johnny B Good
author_rank: Frequent Contributor
timestamp: December 26, 2023, 02:13:08 am
content: Alternatively, you could try applying attenuating layer of black ink to the offending LED using a permanent marker pen (not really permanent - an Isopropyl Alcohol soaked cotton bud will readily remove the ink with no risk to anything else on the pcb).

author: zapta
author_rank: Super Contributor
timestamp: December 26, 2023, 07:05:41 am
content: Or use LIGHTDIMS.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 26, 2023, 12:09:12 pm
content: Thank you guys. I simply applied black duct tape, so the light is dimmed but you can still see it.Evidently whoever designed the card wanted to create a red light effect that illuminated the roomThis LED needed much less current.

author: westfw
author_rank: Super Contributor
timestamp: December 27, 2023, 09:14:55 am
content: QuoteYeah; everyone knows that the average LED has a maximum current of about 20mA, but NOT everyone has noticed that a modern LED provided with 20mA is insanely bright as an "indicator."

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 27, 2023, 12:33:20 pm
content: Quote from: westfw on December 27, 2023, 09:14:55 amOf course, if the LED has to be visible in broad daylight in a sunny room it could also be fine. But when you have such bright LED in dark rooms... I don't know what it is over there in America, but here in the Alps at my house I have practically reduced the current of almost all of them

author: Andy Chee
author_rank: Super Contributor
timestamp: December 27, 2023, 12:43:02 pm
content: Also it seems that LEDs these days all come with waterclear lenses. A red LED with opaque red lens would be much more comfortable.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 27, 2023, 12:47:56 pm
content: This USB isolator is an SMD LED, very small in size. But terribly bright (in the front USB of the PC it blinded me)

author: Andy Chee
author_rank: Super Contributor
timestamp: December 27, 2023, 01:21:53 pm
content: What color is the lens? If it's a clear lens, you could change it for the red lens which should be less brighter.Then again, your solution works too!

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 27, 2023, 01:52:02 pm
content: Now I have the tape on it, I don't remember, but maybe it was white. Calculate that it is an SMD of extremely small measurements. But if I had wanted to intervene by changing the component, then I would have replaced the resistor in series to limit the current

author: xrunner
author_rank: Super Contributor
timestamp: December 27, 2023, 03:04:02 pm
content: Quote from: westfw on December 27, 2023, 09:14:55 amYes they are, but you can use that to your advantage too.CharlotteSwiss, there are some very simple Arduino LED projects you can do that are actually useful. Quite a while ago back my neighbor had a "Fake TV", which is a theft deterrent. You put it near a window and it appears to an outside observer that someone is in the room watching TV. The LEDs (red, blue, green, and white) have a few different random "scenes" that fade and blink and change color levels. I thought "how hard can that be to duplicate?".I simply used my own selection of El-Cheepo LEDs on a breadboard and came up with my own simple scenes (each scene has it's own function implemented) that to my eye appeared to look realistic. Once I made the scenes I just called them randomly from the Main loop. I just put it by the window with a piece of plastic in front of it as a diffuser, from an old LCD screen I had salvaged the parts from. From outside at night those LEDs are very observable and it does look like a person is watching TV in the room.The point is, even simple LEDs can turn into a nice project.

author: tooki
author_rank: Super Contributor
timestamp: December 27, 2023, 03:20:56 pm
content: Quote from: CharlotteSwiss on December 27, 2023, 12:33:20 pmI would say that the average American house getslesssunlight during the day than a Swiss one. (American homes tend to have fewer, and smaller, windows, since they’re not needed for ventilation, and Americans don’t fret over southern exposure as much as the Swiss do.)

author: Andy Chee
author_rank: Super Contributor
timestamp: December 27, 2023, 03:33:58 pm
content: Speaking of leds, you should have a play with addressable leds like WS2812 (neopixels).

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 27, 2023, 11:22:45 pm
content: Quote from: xrunner on December 27, 2023, 03:04:02 pmBut this is crazy genius. Congratulations xrunner for the idea. I liked itAs a deterrent to intruders, I have a German shepherd. It works quite wellQuote from: tooki on December 27, 2023, 03:20:56 pmI must say that this LED is extremely annoying even during the day. Maybe it's because I have the USB device at face height. Of course I could have used the back door, but I prefer the front one.Quote from: Andy Chee on December 27, 2023, 03:33:58 pmThanks Andy, those experiments with LEDs and Arduino are really cool

author: watchmaker
author_rank: Unknown
timestamp: December 28, 2023, 01:33:29 am
content: Against my inner angels, I decided to learn Arduino. What is a good book(s) for learning C++ as it applies to Arduino?I swore I would never learn another programming language but here it is. I recall the basics but I will need to learn to program Arduino based devices.THANKS!

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 28, 2023, 03:15:45 am
content: Quote from: watchmaker on December 28, 2023, 01:33:29 amAs they taught me in the first pages of this topic, if I learn the Arduino language, when I then tackle C++ I will understand very little about it

author: brucehoult
author_rank: Super Contributor
timestamp: December 28, 2023, 04:51:25 am
content: Quote from: CharlotteSwiss on December 28, 2023, 03:15:45 amThat doesn't matter. Most people using "C++" understand very little about it. In many companies you're not even allowed to use any of the many features added in the last 10 or 12 years, and often not features such as exceptions that were added in 1990. "It's against our coding standards". "If you use that feature, your colleagues won't understand your code".

author: fourfathom
author_rank: Super Contributor
timestamp: December 28, 2023, 05:46:52 am
content: Quote from: watchmaker on December 28, 2023, 01:33:29 amThe Arduino IDE accepts plain old C, so just program in that if you prefer. I can hack existing C++ code, but C usually does the job for me.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 28, 2023, 07:39:28 am
content: Quote from: fourfathom on December 28, 2023, 05:46:52 amSame hereFor programming the Arduino the almost only thing needed from C++ is the understanding of how to use classes. I.e. declare an object and then use the functions from within the class. "Serial" is a good example. This is an existing object, so no need to declare it. To use functions from the object the "." is used, like in "Serial.print()".

author: brucehoult
author_rank: Super Contributor
timestamp: December 28, 2023, 10:33:14 am
content: Quote from: fourfathom on December 28, 2023, 05:46:52 amNot in .ino files it doesn't.Here's a valid plain C function:Code:int friend(int n){return n+1;}Let's compile and disassemble that to check...Code:$ avr-gcc -O -c friend.c$ avr-objdump -d friend.ofriend.o: file format elf32-avrDisassembly of section .text:00000000 <friend>:0:01 96adiwr24, 0x01; 12:08 95retPerfect.Now let's put that into an Arduino sketch:Code:Compiling sketch.../Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard /var/folders/9l/dqw_ll688xn06w0059b64w280000gn/T/arduino_build_156245/sketch/Blink.ino.cpp -o /var/folders/9l/dqw_ll688xn06w0059b64w280000gn/T/arduino_build_156245/sketch/Blink.ino.cpp.oBlink:25:5: error: 'friend' used outside of classint friend(int n){return n+1;}^~~~~~Blink:25:12: error: expected unqualified-id before 'int'int friend(int n){return n+1;}^~~Blink:25:12: error: expected ')' before 'int'exit status 1'friend' used outside of classIt's using a C++ compiler, not a C compiler. There are other, more subtle, examples of C code that works differently or not at all in C++.

author: Ian.M
author_rank: Super Contributor
timestamp: December 28, 2023, 11:43:40 am
content: The Arduino IDE does accept 'vanilla' ANSI C, but as Bruce notes above, *NOT* in an .ino file. If you are coding in pure C the source file extension must be .c and if in C++ .cpp otherwise if you try to use a .ino source file, the Arduino preprocessor tries to add auto-generated forward declarations to your valid C/C++ code and usually fails miserably. The .ino file must exist, but only needs to list the #includes so the IDE knows how to find them to build the sketch.Seehttps://www.gammon.com.au/forum/?id=12625for the details and my posthttps://www.eevblog.com/forum/blog/adventures-in-avr-isp-programming/msg1152924/#msg1152924for a complete 'AVR' GCC flavoured ANSI C 'Hello World!' sketch.

author: watchmaker
author_rank: Unknown
timestamp: December 28, 2023, 02:19:37 pm
content: WoW! Thank you all. So it looks like it is "play and learn"! Small wonder it is so popular.The cost of modules is pretty interesting. Often a whole board is less than the cost of a couple transistors.Stunning.Regards,Dewey

author: fourfathom
author_rank: Super Contributor
timestamp: December 28, 2023, 04:39:47 pm
content: Quote from: brucehoult on December 28, 2023, 10:33:14 amWell "friend" is a C++ class modifier and a reserved word. Rename that function to:Code:int TestFunction(int n){return n+1;}and it works fine. But yes, there is stuff hidden under the hood that can interfere with generic C code, but it's far from hopeless. In the "friend" case, the Arduino IDE colors the word "friend" to show it's reserved. (At least the most recent version of the IDE does.)

author: rstofer
author_rank: Super Contributor
timestamp: December 28, 2023, 06:42:54 pm
content: The starter kits are handy in that they provide parts and CODE - lots of code. Explanations are included. This is better than any book because the text and parts refer to what's actually in the kit. Stuff you can actually build.You don't need a lot of C or C++ experience, the starter kit shows you how to create the building blocks of larger programs.

author: brucehoult
author_rank: Super Contributor
timestamp: December 28, 2023, 08:08:37 pm
content: Quote from: fourfathom on December 28, 2023, 04:39:47 pmOf course as someone who has been using C++ for 35 years, *I* know that. But a C programmer won't. And someone who is neither a C nor a C++ programmer but is copying code from the net can quite easily run into more subtle examples of incompatibility and have little idea how to fix it.Also, while Arduino requires a C++ compiler and the use of a few C++ features, there are many C++ features that aren't really a good idea on a machine with 2 KB of RAM, or even less (I use Arduino to program the ATTiny85, with 512 bytes of RAM). The same goes for a lot of C idioms and libraries for that matter e.g. using malloc() either explicitly or implicitly via things such as strdup().The Arduino library is quite well designed to code things that will fit on tiny machines, so you definitely want to use it, not libc.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 28, 2023, 08:34:42 pm
content: Quote from: fourfathom on December 28, 2023, 04:39:47 pmpay attention to what msg he tried to convey... he intentionally did that.Quote from: brucehoult on December 28, 2023, 08:08:37 pmthe problem is i think because we cant find "pure c" only compiler nowadays (before C++ extension). i'm myself started learning in "mix C and C++" environment, i saw things in pure C and saw things in pure C++ (anyone uses cout << cin >> ?) and got warning when tried to do C++ in *.c files, so even though i'm a neither a C nor a C++ (mix) i always keep those facts in mind.

author: watchmaker
author_rank: Unknown
timestamp: December 28, 2023, 10:18:32 pm
content: Quote from: CharlotteSwiss on December 28, 2023, 03:15:45 amWOW!! I just spent the afternoon learning the setup and doing the RGB LED exercise. I wanted to see the actual behavior of the DC pulse widths and hooked my scope to the three anodes. It was a terrific visualization of what is happening.Plus, I get how the device is set up with the programming. The "writes" are just to get the output and the digital/vs analog tells it the kind of math (binary vs integer). I never thought of using a computer in this way. To me, it was a way to get a printed output of numbers.I can see how this stuff changed grade school education. Not to mention spurring lots of innovations.THANKS!

author: westfw
author_rank: Super Contributor
timestamp: December 28, 2023, 11:00:51 pm
content: QuoteMeh. It accepts "plain old C" in the same sense that "C++ is a superset of C."Yeah, you have to avoid the new C++ reserved words, and there are a few other edge cases. And you probably want to avoid K&R v1 function-definition syntax as well, plus some other "styles" that were common if you learned C in the 1980s.But if you have a C background, you'll have no trouble writing Arduino .ino programs that look very much like C programs.

author: CharlotteSwiss
author_rank: Frequent Contributor
timestamp: December 28, 2023, 11:03:50 pm
content: The world of C and C++ is certainly complex, especially for people like me who had never experienced anything in this regard. I must say that the Arduino project helps a lot to get closer to this world by playing. In a constructive way. Small steps to begin this discovery. I am convinced that purchasing ki was the right choice, it will take time, unfortunately life is varied and complex. I would definitely like to dedicate more time to this world. I will do it in the future.There are people among you who have been eating bread and electrons for many decades. It's a passion that makes you happy, helps you not to age. It may be due to professional attitude, but I read this passion of yours in all the words you write. Thanks for this.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 29, 2023, 04:25:35 am
content: Quote from: westfw on December 28, 2023, 11:00:51 pmyou need to see his point from a perpective of a person who never experienced or aware of the existence of C++, i dont think that kind of person (or compiler) exists today, otherwise he'll be surprised why the code doesnt compile. people like you and me will not be surprised because we are generation X. thats why varying opinions depending on perpective. "friend" "was" perfectly fine to use as function name back then... similar to if you use "cout", "class" or whatever extension C++ brought, but not today... that is his point i believe.@charlotte, this point also proves why during learning C/C++, reading up on history the evolution of C and C++ and distinction of what C++ extension vs native C keywords may help in becoming a good programmer, esp if you like to copy paste old code from open source or old books. but i guess arduino is not one of it, we are talking about PC complex algorithms. arduino is a mix of C and C++, mix of printf() and classes. ymmv.

author: fourfathom
author_rank: Super Contributor
timestamp: December 29, 2023, 06:04:38 am
content: Quote from: Mechatrommer on December 29, 2023, 04:25:35 amFWIW I was unaware of the C++ "friend", but figured it out in a couple of minutes after seeing the example from brucehoult. But to your point I *was* aware that C++ and other newer languages such as C# (which I do use) have been extended far beyond the original K&R C (which I learned when it was new, after I learned Pascal, which was after I learned BASIC). No doubt a pure noob would be less prepared to deal with this type of conflict.But I still contend that you don't have to become a C++ guru to do useful programming in the Arduino environment. Learn what you need when you need it and you will go far.