18

I have played a bit around with a Arduino Uno that came in a kit with a breadboard and components. Soon I would like to make some more permanent things.

I would prefer a smaller and cheaper unit than the Arduino Uno but that is almost as easy to use as the Arduino Uno, and very similar to use.

Is the Arduino Pro Mini 328 - 5V/16MHz a logical next step? At 1/6 of the size of the Arduino Uno it is plenty small. At 10 $ a piece the price is also good.

I understand that I must solder to get it to work. That should not be a problem.

Will I also need a USB serial board to program the unit?

sa_leinad
  • 3,118
  • 1
  • 20
  • 49
Andy
  • 283
  • 1
  • 2
  • 7
  • 2
    next smaller with 328p is Nano – Juraj Nov 11 '18 at 19:55
  • 1
    ATmega32u4 chips are also a good move (same as Leonardo) for 8-bit micro. Coding is slightly different from UNO/328p (especially with serial), but you avoid the USB/serial converter. Eventually, you can make your own PCBs and use the SMD chips, for a really compact project. – MichaelT Nov 11 '18 at 20:06
  • 1
    Pro Mini, 5V 16MHz Module With Crystal Oscillator ($2.18CDN): https://www.aliexpress.com/item/Pro-Mini-atmega328-Mini-ATMEGA328P-5V-16MHz-Module-With-Crystal-Oscillator-Pins-Replace-ATMEGA128-for-Arduino/32828645889.html. PL2303HX USB to UART adaptor ($0.70CDN): https://www.aliexpress.com/item/FREE-SHIPPING-PL2303-module-USB-to-TTL-upgrade-nine-brush-board-PL2303HX-STC-MCU-download-cable/32592463585.html. – VE7JRO Nov 11 '18 at 20:12

6 Answers6

12

I think the first best choice is to remove the ATMega328p-pu chip from your Arduino UNO and incorporate it into your final circuit. The chips are only about $1.50.

That way, you can just use your UNO as a programmer instead of the final device that you deploy.

I'm not sure why there isn't more documentation about the proper way to remove the ATMega328p-pu chip and using it on your breadboard, after completing your programming.

I explain exactly how to do this on my blog: http://raddev.us/arduino/post/2018/07/03/arduino-uno-using-your-atmega328p-u-as-stand-alone

But, here are the basics. First you remove the chip. It will look like the following after you do so. (Note: I'm using the Elegoo clone of an UNO).

atmega328p-pu chip removed

Next, you apply power to pin 7 and connect pin 8 to GND.

Need A 16MHz Crystal

But, the chip won't seem to run your sketch at this point. That's because you actually need a crystal to run at 16MHz.

The UNO board has that chip installed and that is why it works. You can see it here:

16MHz crystal on UNO

Finally you add the 16MHz crystal and a couple of 22pF caps and your chip will run standalone (no UNO).

You add the crystal to pins 9 & 10. You can see all the details by reading my blog entry or reading the atmega328 datasheet.

crystal on breadboard

Finally, Just Wire Everything Else Up

After that, just wire the rest of your circuit up to the proper pins and you can run your ATMega328p-pu standalone.

It's actually a nice learning experience too.
Just buy replacement atmega328p-pu chips for your UNO and you can create all the projects you want to for very cheap.

raddevus
  • 382
  • 2
  • 14
  • 3
    You'd be well served to add some circuit protection in there, since the 328p doesn't have any of it's own. Otherwise, this is a great way to go. – SnakeDoc Nov 12 '18 at 18:09
  • @SnakeDoc Thanks. And, I agree, any circuit protection is always advantageous. An interesting note: I had a circuit built on a cheap breadboard like the one shown, powered off an old phone charger and sitting on a shelf in my garage and running for over two years with no problems. We even had a lightning strike that took out another item in the garage but my atmega328p-pu based circuit (bluetooth garage door opener) kept on running. Of course, I'm not advising people to build circuits like that but it is really cool that as a hobbyist we can do things like this. – raddevus Nov 12 '18 at 18:18
  • You're missing a few wires in that last photo. Pins 20 (AVCC) and 22 (GND) need to be connected to VCC and GND. –  Nov 12 '18 at 18:36
  • 1
    @duskwuff, I believe that is only when you're doing DAC. This is just a simple example to get someone started in the direction of using the chip as standalone. I assure you the code to blink the LED in the sample does run. Also, when I was starting out I created the circuit I mentioned in a comment above and I never connected AVCC and GND and the circuit ran for two years. Of course, i'm not saying that will always be true. Just mentioning the way the chip actually works. As always, check the datasheet for exact specs and especially if you experience something different. Thanks. – raddevus Nov 12 '18 at 18:41
  • 1
    @raddevus Refer to Table 28.8 in the datasheet: "AVCC absolute min/max: 1.8V/5.5V". Leaving AVCC unpowered is out of spec, and may cause damage. The GND pin on pin 22 isn't specifically associated with the ADC, and must be connected to GND. –  Nov 12 '18 at 18:55
  • @duskwuff I was reading over the datasheet and reminding myself too. I will keep that in mind and alter the doc soon. Thanks Edit - Wait where does datasheet say that leaving AVCC unpowered may cause damage? – raddevus Nov 12 '18 at 19:27
  • @duskwuff also section 1.1.7 says, "AVCC is the supply voltage pin for the A/D Converter, PC 3:0, and ADC7:6. It _should_ be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter." Notice the use of should instead of must. Interesting. – raddevus Nov 12 '18 at 19:35
  • @raddevus Again, table 28.8 specifies an "absolute min/max" voltage. Absolute limits always carry an implied risk of damage if the limits are violated. –  Nov 12 '18 at 20:01
  • 1
    @duskwuff Thanks for the enlightening discussion. I agree with what you are saying and will change my docs and circuits soon to insure that is always connected. FYI - I started working with ATMega328p-pu via the fantastic book AVR Programming : Learning to Write Software For Hardware (https://amzn.to/2PS9OOA) and in those first circuits the author, Elliott Williams, does not hook up those pins either. I think I was influenced by that. The book really is great though and the author is knowledgeable. Thanks again, great discussion. – raddevus Nov 12 '18 at 20:45
  • Why is there no bypass capacitor on the power pins in the breadboard picture? That is an absolute must. As close to Vcc and Gnd as possible. Hey, but it is the Internet. Anyone can publish what they want. – Rudy Nov 13 '18 at 00:43
  • 2
    @reddevus. To be more precise, the crystal that you indicated in the red box in this answer is the crystal used by the microcontroller handling the USB communication, and not by the ATmega328p-pu chip. You can see from the Uno schematics that the ATmega328p-pu chip actually uses a resonator: https://www.mouser.com/ProductDetail/Murata-Electronics/CSTCE16M0V53-R0?qs=HPA2Xx%252BU0WhPWbRcNuzhZw%3D%3D – Kavka Dec 06 '19 at 16:03
  • @Kavka That's great information. Thanks for adding. – raddevus Dec 07 '19 at 15:50
7

Check the STM32F103C8T6 development board, cost about $ 1.5, and is faster/has more memory than the Arduino Uno, and is much smaller.

It can work with the Arduino IDE, but not all libraries are supported, so check before you want to use it if your used libraries are supported, or if there are different libraries you can use instead.

Update

Differences:

                       Arduino Uno       STM32F103C8T6 Mini Dev Board

MicroController            Atmega328P           Cortex M3
MIPS/MHz                        1                   1.25
Operating Voltage [V]           5                   3.3, most pins 5V tolerant
Input Voltage   [V]            7-12               USB only
Input Voltage (limit) [V]      6-20                (USB)
Digital I/O Pins               16                   37
From them:PWM Digital I/O Pins  6                   12
Analog Input Pins               6                   10
DC Current per I/O Pin [mA]    20                    ?
DC Current for 3.3V Pin [mA]   50                    ?
Flash [KB}                     32                   64
SRAM [KB]                       2                   20
EEPROM [KB]                     1                    -
Clock Speed [MHz]              16                   72

I2C                             1                    2
SPI                             1                    2 (18 MBit/s)
UART                            1                    3
CAN                             0                    1
USB                             0          USB 2.0 FS 12 MBit        
DMA                             0          7 channels (ATsP, SPI, I2C, USART)
RTC                             0                    1
CRC                             0                    1
Unique ID                       0                    1

Programmed by                  USB                 SWD Debug (around $5)

IDE                         Arduino IDE         Arduino IDE, CubeMX, ...
Libraries                      Many               Limited

Dimensions  [mm]            68.6 x 53.4           53 x 22
Weight       [g]               25                    ?
Price (cheapest)  [$]         2.50                 1.50

Note: as written earlier, despite the mostly better specs, not all libraries are supported. Also a programmer need to be bought (only once, cost about $5).

Michel Keijzers
  • 12,759
  • 7
  • 37
  • 56
  • 1
    You can also avoid getting the programmer if you get the Maple Mini clones (same uC, almost same HW, but with a bootloader already flashed) – frarugi87 Nov 12 '18 at 08:44
  • 1
    @frarugi87 Or you can use the builtin UART bootloader (activated by setting BOOT0 high) for initial programming. –  Nov 12 '18 at 18:34
  • The STM32F103C8T6 is a great part. But it still is only 3.3v. It isn't a drop in replacement for the Uno. Try to connect it to a 5v character LCD and you will have problems, if it works at all. (the LCD) – Rudy Nov 13 '18 at 00:47
7

For my product, I went from an Arduino Uno:

Arduino Uno R3

to the Arduino Pro Mini:

Arduino Pro Mini

Yes you will need a FTDI cable for programming and serial coms to the PC, but providing you don't need coms all the time, you will only need the one cable to upload the program to each device. They can be found pretty cheap too.

However I notice that the Arduino Pro Mini is retired now, so it may be a bit harder to source (it is still available on AliExpress). So for this reason, I suggest that you instead try the Arduino Nano:

Arduino Nano

which has the added advantage of onboard USB, meaning you no longer need the FTDI cable for programming or coms.

The ATMega328P that is the processor of these 3 boards does not have native USB, which means that the board also needs to include the FTDI FT232RL IC that is used in the FTDI cable. Having this IC can add additional costs to your bottom line.

For a few dollars cheaper per device, you can use a microcontroller (such as the ATMega32U4) that has native USB coms (and hence you save on the FTDI IC). One such product is the Arduino Micro:

Arduino Micro

All of these boards mentioned are native within the Arduino Ecosystem and (apart from the retired Pro Mini) should be easy to source online or at your local electronics shop. Your Arduino Uno program will work for all of these alternatives - you just have to change the board in the Arduino IDE:

Arduino Board Selection

There is one more board that I would like to mention - the DigiSpark:

Digispark

It is only suitable for smaller programs, is limited in some of its features and is not an oficial Arduino board. Having said that, there is plenty of Arduino support - and its cheap!

sa_leinad
  • 3,118
  • 1
  • 20
  • 49
4

I like the Nano and the Pro Mini. I like to work with it on a breadboard with other modules. If there is more circuitry involved I found it much more convenient than using an Uno. There are faster processors but for a lot of projects the 16Mhz 328 is more than sufficient. And like the Uno, these two are 5 volt powered parts. Sometimes what you need to connect to doesn't work well with 3.3 volt processors.

The Pro Mini and the Nano with easily be soldered into 0.1" spaced "Veroboard" (or equivalent) If you don't mind buying cloned parts, the cost of a Nano and Pro Mini is only a couple of dollars. Buying parts off Aliexpress, or even Ebay, can save you a lot, as long as you are patient when it comes to delivery.

The module that I am now use most often is the ESP8266. It is a powerful WiFi platform that only costs a few dollars and has quite a mature Arduino framework. Often I use this as the only processor in the design. I have even used it as the basis for a data logger and completely ignored the WiFi capability. 20x4 character LCD, current/voltage measurement chip (INA219), and a SD memory card, powered by a 18650 lithium battery.

There are lots of good inexpensive options.

Rudy
  • 985
  • 5
  • 10
  • 3
    you might want to point out that ESP12 modules do NOT have .1" pin spacing, which is a bit of a nuisance. There are inexpensive breakout boards, but these are quite wide and hard to use with solderless breadboards. Other than that, they're pretty handy. For about $1 more than a bare ESP12 module you can get a Wemos D1 mini (clone) that is about as easy to use as an Arduino Pro Mini or Nano. – Llaves Nov 11 '18 at 21:58
  • Where did I say to use the ESP-12? I didn't go into a lot of detail on the ESP8266 because that really wasn't the focus of the question. I thought it was worth mentioning since a lot of people are not familiar with it. I totally support people using the Wemos D1 mini platform. It is a ready to go solution unlike ESP01, ESP12, etc. USB to serial and an onboard regulator makes a big difference. But I still feel the Nano or the Pro Mini is the most appropriate answer for the person who asked the question. – Rudy Nov 12 '18 at 23:40
  • It's hard to consider any atmega based system in 2019 in comparison to the ESP systems, so you might mention for $2 with an ESP8266 you get a 40MHZ processor, a full development board ( not a chip ), wifi, and USB-based programming and monitoring without any extra cables. And also mention the ESP32 systems, which are more expensive at $7 to $10, but contain two CPUs, a full RTOS, multiple MB of flash, adds BT to WIFI, and native USB support. Compatibility with Arduino is included, and even running the provided RTOS they include Arduino libraries. – Brian Bulkowski Dec 28 '19 at 04:30
  • The ESP8266 has a 160MHz processor. It is a great option but it does have limitations. It only has one A/D converter and a bad one at that. The digital IO pins also have quirks. Pull up resistors are on by default at power up on most. Three IO pins set the operating mode and special care must be taken. The ESP8266 also needs a decent power supply. With the ESP8266 there is a lot of code running in the background and your code must co-exist with it. I really like the ESP9266 but it is not a great general purpose microcontroller. The ESP32 is better but also with issues. – Rudy Dec 29 '19 at 14:59
4

If you want to stick with using Arduino and it's toolchain, you can order just a bare ATmega 328p (the microcontroller at the heart of the Arduino Uno) and use it by itself!

They're fairly low cost ($1.50-$3.00 range) and are breadboard friendly. For a more permanent solution, you can solder them into a proto-board (perfboard), or even a custom designed circuit board once your design gets to that level.

Here's an excellent guide from the Arduino folks about setting up an Arduino on a breadboard, using only raw components such as the ATmega 328p. This design uses an external 16MHz clock crystal, just like an Arduino Uno.

If you're OK with using the internal 8MHz clock onboard the 328p, you can do away with most of the extra components and just run the raw chip like in this guide (using the Arduino Lilypad Bootloader instead of the default Arduino bootloader). This will save even more money!

Either way, you'll need an AVR Programmer unit, since there is no USB port built into the 328p. This will be the most expensive part of this setup, but good news is you only need one, and it can program any 328p's you need. They can also be used to program non-standard chips that are capable of being programmed over Serial Tx/Rx pins, such as the ESP chips (you just hand-wire them). Very useful to have one of these if you're serious about these types of microcontrollers.

ATmega 328p Microcontroller Chip

ATMega Pin Stickers

Perfboard

AVR Programmer

SnakeDoc
  • 148
  • 5
  • 1
    If you order your ATMEGA328P-PU with the boot loader already installed: https://www.ebay.ca/itm/ATMEGA328P-PU-DIP-28-Microcontrolle-r-With-ARDUINO-UNO-R3-Bootloader-or-Not/401232444724?hash=item5d6b513d34:m:mDLpPK1-t0vsiOhYFC4DDpg:rk:4:pf:0, then a PL2303HX USB to UART adaptor ($0.70CDN) will work to upload "code": https://www.aliexpress.com/item/FREE-SHIPPING-PL2303-module-USB-to-TTL-upgrade-nine-brush-board-PL2303HX-STC-MCU-download-cable/32592463585.html – VE7JRO Nov 12 '18 at 00:10
  • I always found it odd that Arduino uses a special bootloader for programming instead of using the built-in programming interface. – user253751 Nov 12 '18 at 01:57
  • @immibis not sure what you mean exactly, but the arduino bootloaders do a lot of things that make working with the arduino's (and Atmel chips) a lot easier, including resetting of pins, switching to external clock, handing-off to your code, etc. Without it, you'd essentially need to write your own... which would be a waste of time since for majority of cases, the stock Arduino bootloader does everything you want anyway. – SnakeDoc Nov 12 '18 at 07:43
  • 1
    @immibis I think it is much easier to have a serial port interface rather than a programmer interface from the PC. Moreover, especially at the beginning, I think (personal opinion) that they wanted a complete system on a board, and integrating a programmer on the PCB was much harder than writing a serial bootloader. Consider that the first arduino boards had a serial port ([Arduino RS232](https://www.arduino.cc/en/Main/ArduinoBoardSerial)), so only one programmer was needed to program a lot of them (they were used at school) – frarugi87 Nov 12 '18 at 16:46
  • 1
    @frarugi87 that's probably true, but for real beginners, plugging in a USB cable and using the Arduino IDE to upload "sketches" is about as easy as it can be. I think they made the right move to make it super accessible, especially for those who have zero microcontroller experience. – SnakeDoc Nov 12 '18 at 17:37
  • There isn't a good reason to use the dip parts. The Pro Mini doesn't take up any more space and it is a lot less hassle. Maybe ten years ago it made sense to use a dip part when there wasn't cheap alternatives. But now with the inexpensive (dirt cheap) modules available it just doesn't make sense. – Rudy Nov 12 '18 at 23:47
  • @Rudy If you want to do your own thing, make your own packaging, or layout, save power (prolong battery life) or just make it look more professional, using the raw chips is certainly a great way to go. Plus you'll learn a lot more in the process, which makes the end result even more of a benefit. You can also help ensure people don't mess with it by plugging into the USB port, or do your own voltage regulation stuff, such as a buck-boost or whatever. Don't dismiss using the raw chips just because you can buy a Pro Mini... – SnakeDoc Nov 12 '18 at 23:59
  • @SnakeDoc The compiler could easily add that code for you, like it already adds code for you. – user253751 Nov 13 '18 at 00:10
  • @frarugi87 Makes sense for the RS232 version, for sure, but now they have a custom-programmed USB interface on-board! – user253751 Nov 13 '18 at 00:12
  • "I would prefer a smaller and cheaper unit than the Arduino Uno but that is almost as easy to use as the Arduino Uno, and very similar to use." A dip CPU is NOT as easy to use as the Arduino Uno. You are putting your values into your answer and not listening to the person who posted the question. – Rudy Nov 13 '18 at 00:13
  • @Rudy Have you tried it? (I haven't tried with this chip, but I've tried with different similar DIP uCs) – user253751 Nov 13 '18 at 00:14
  • @immibis Tried what? I have been designing commercial electronic products for almost 35 years. I'm a hardware designer. I have recently started using the Arduino platform because I wanted to do my own projects at home and the Arduino IDE and all the libraries was the easiest to start with. At work I design the electronics and then pass it on to the firmware, then software, programmers. I have designed with many different chips. I have even made a product (my code) with a PIC part with 512 bytes of code space. Efficient. – Rudy Nov 13 '18 at 00:21
  • @Rudy it's pretty darn easy if you keep using the Arduino environment. It's exactly why at least two of us here have made that recommendation, including the accepted answer! The Arduino toolchain is very mature - and as the OP advances, they can branch out into more flexible solutions such as PlatformIO etc, all while still using the Arduino libraries! Pretty neat. – SnakeDoc Nov 13 '18 at 02:36
  • @SnakeDoc As I have said above. I design electronics for a living. I can't put out a marginal design. Something that is going to only work most of the time. Industrial controls not consumer items. I think it is great that someone wants to learn. But the question asked was for a smaller cheaper unit that was easy to use. And I believe my answer fits that. The breadboard example in the picked answer shows the lack of knowledge of the constructor. And it disappoints me when I see someone learning from someone who is not ready to be teaching. – Rudy Nov 13 '18 at 03:19
  • @Rudy To summarize everything you've said - You use premade boards because you're too tired after work to make one yourself, and you've already learned all there is about uC's so everyone else should just skip learning and use premade uC boards cuz reasons and cheap Chinese clones are definitely more reliable than a home-made uC board cuz more reasons. Sorry, but you sound pretty salty right now. OP accepted his answer. OP clearly is interested in assembling their own ATMega328p custom implementation, and will still use the Arduino tooling. It's wonderful, and no skin off your back. – SnakeDoc Nov 13 '18 at 08:02
  • Unless you happen to be making and selling Arduino Pro Mini's for a living.... hmm.... – SnakeDoc Nov 13 '18 at 08:03
  • @SnakeDoc Your summary you attribute to me is pure fiction. I think you need to read the Code of Conduct because you are not acting the way expected on this site. - As I have already explained, the answer I provided was based on the original question asked and the requirements expressed. And if the person considers a new criteria then that is his prerogative. My reason for using stable modules is most newbies do not have the equipment required to troubleshoot the issues that often will come up due to a lack of understanding about stable design. They have more than enough to deal with. – Rudy Nov 15 '18 at 02:58
  • @SnakeDoc I thought you might be interested in this. https://www.esp8266.com/viewtopic.php?f=13&t=17514 – Rudy Nov 15 '18 at 03:11
  • @SnakeDoc A problem for you. I hope you can help. https://arduino.stackexchange.com/questions/57938/problem-with-arduuino-to-breadboard-mega8 – Rudy Nov 17 '18 at 04:52
2

Arduino Pro Micro clones are super cheap and all you need to program them is a normal micro USB cable. You will probably have to solder the headers to do anything useful. They are available in a 3.3V/8MHz and a 5V/16Mhz version.

Pro Micro

AndreKR
  • 190
  • 9