Unsure about which Arduino to start out with for my project! - Page 1
Forum section: electronics / beginners

author: Monkey123
author_rank: Newbie
timestamp: May 28, 2018, 03:56:07 pm
content: So I have 0 experience with electronics and little programming knowledge, but I want to make a project and learn as I go.If I can make it work. I might pay someone to build it properly, and maybe even, in the future launch it as a product.The thing is, I’m thinking I should start out with an arduino, but I’m not sure if eg. The Arduino Uno will cut it, as this device will need a pile of sensors. Can soneone point me in a good direction to start out.Here is the list of stuff.GPSGSM (the least power hungry imaginable)Bluetooth low-energy (BLE)Humidity SensorTemperature SensorAccelerometerThe device will ultimately need to be as small as possible, and run for a long time on a couple of Lithium-ferrite 18650’s, but for now I’m only worried about trying to make something that works.I don’t think there are many analog connections there. Maybe the temp and humidity, but running on battery, it might be more accurate to have them digital as well.Hence, I’m mostly worried about the amount of digital and serial ports I will need. Is it possible to do with an Arduino Uno, or is there something else, that’s well documented that I could use?And just to make the whole project a bit crazier, I will ultimately need the GSM sms communication to be asymmetrically encrypted using keys that are negotiated through bluetooth. Is stuff like this even possible on a cute little Atmel mcu?Thanks in advance!

author: picandmix
author_rank: Frequent Contributor
timestamp: May 28, 2018, 04:27:00 pm
content: Hi,The short answer is an Arduino Uno Clone bought for about £5 on Ebay, from uk or do you use Norway ?The reason, as a beginner you may electrically damage it during your tests and the genuine Arduino Uno is quiet expensive.The Uno may or may not have enough memory or ports to complete your whole project, but one of that complexity should be completed as separate modules that can be readily built and tested on the Uno as it has the easy to use plug in headers etc.As your whole project nears completion your will be better placed to judge what device is needed for the final build.While the Arduino IDE is a good starting point, for larger coding you may find the features of Atmel Studio 7 with the free Visual Micro plug in for Arduino a much more versatile tool.

author: rstofer
author_rank: Super Contributor
timestamp: May 28, 2018, 05:27:10 pm
content: You're right to be concerned about IO limitations but you didn't give us any info on how your sensors communicate.You can tie a bunch of sensors to an I2C port and this only requires two wires for a bunch of devices since they have their own internal addresses. Just make sure that the devices on the bus have unique addresses.SPI is another protocol and it takes 4 pins for the first device plus an additional pin for each subsequent device unless you get clever with CS'. You could use a 3 line to 8 line decoder to use just 3 pins to address 8 devices.RS232 or TTL serial is the least friendly because you can't share the bus between multiple devices unless you change the serial stream to something like RS485. I suspect your GPS and GSM will want to use a serial bus and you probably only have one.So, without knowing anything about your sensors, it is impossible to say how many pins you need. You could always start with a Arduino Mega 2560 and work down.http://www.circuitstoday.com/arduino-mega-pinout-schematicsThe Arduino Nano is also a good choice and there are lots of clones. It has a more usable form factor and plugs right in to prototype boards. It gives up nothing except board space over the Uno.There are certainly uCs that are more suitable to multiple IO channels than the Arduino. Any of the STM32F boards will have more pins and more peripherals. But, without knowing how the sensors communicate there isn't much to say.

author: TomS_
author_rank: Frequent Contributor
timestamp: May 28, 2018, 05:44:59 pm
content: Quote from: rstofer on May 28, 2018, 05:27:10 pmSomething like a 4052 can take care of the "I only have one UART available" problem. It has a pair of 1:4 muxes in a single package, so you can use one to switch Arduino TX to one of 4 devices, and the other to select Arduino RX from the same 4 devices. The two muxes are bi-directional so either one can do TX or RX, and they are both driven by the same select pins, so they both switch at the same time. Ive used them a couple of times in various projects.Then it becomes mostly a "software problem", rather than hardware, in terms of communicating with multiple UART based devices - configure the 4052 to select to the appropriate device, (re)configure the UART module as/if required, send and receive bytes, job done. You may just need some pull ups on the TX lines out of the mux to prevent the inputs from floating at the other side.Perhaps a little more complexity, but its just a single chip and some resistors, so its not tooooo bad.

author: rstofer
author_rank: Super Contributor
timestamp: May 28, 2018, 06:05:49 pm
content: Yes, but...As I understand GPS, it sends a serial message whether you want it or not. What you would like to do is capture each character in an interrupt routine and assemble the message. You almost certainly don't want to poll for a message. This isn't going to work with any kind of MUX arrangement, you would have to select the device, wait for the start sequence (which will be, on average, half a message away) and then start assembling. In the meantime, the CPU is blocked.There are a lot of uCs that have multiple serial ports. Sometimes the development boards don't bring them all out to pins, sometimes they do. It is not uncommon to have 4 available serial ports.In the 'stamp' form factor, I like the mbed LPC1768. Depending on SPI and I2C requirements, the mbed can have as many as 3 serial ports.See pinout here:https://os.mbed.com/platforms/mbed-LPC1768/The first SPI channel doesn't conflict with a serial port. Both I2C channels conflict with a serial port and the 2d SPI channel conflicts with the 3rd serial port.So, whether this works comes down to what comm methods are required.

author: TK
author_rank: Super Contributor
timestamp: May 28, 2018, 06:09:50 pm
content: Most of the peripherals today use 3.3V and the Arduino UNO and clones are 5V. I like the Seeeduino because it has the 3.3V - 5V switch. Or you can go with a 3.3V Arduino clone or derivative like the Teensy or the STM32F103 boards that are very cheap on eBay.

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 28, 2018, 06:18:56 pm
content: As for GPS, it typically sends continuous (or very frequent) data packets. But if you aren't interested at the moment, you can simply ignore it. Then when you want to know where (or when) you are, simply decode the next incoming packet. There are SBC boards with integrated GSM and that may be a bigger factor than simply choosing Arduino simply because it is the "popular kid". And for projects (or products) designed with the future in mind, @TK has a good point about going forward with 3.3V vs. old-school 5V.It seems very unlikely that after development and optimization, you will end up with the same make/model SBC as you start with, so it is probably better to start with a (code compatible) version that is breadboard-friendly and has plenty of I/O pins for development. Teensy is a pretty impressive platform IMHO.

author: chris_leyson
author_rank: Super Contributor
timestamp: May 28, 2018, 06:25:48 pm
content: You can buy the Genuino UNO from R.S. for £17.25 which isn't too bad a price considering Maplin were selling them for £25 ! Get the UNO with the DIL ATmeg328P because if you accidentally short an ouput and the chip goes pop you can always replace it. The ATmega328P only has one UART, one SPI and one I2C port but it should be enough to get you started.Eventually look into getting a breakout or development board that will run at 3V3 as well as 5V and it will probably need an external supply. There are a few temperature, humidity and accelerometer sensors that will work at 5V and 3V3 but you have more choice if you stick to 3V3. Try Adafruit or CoolComponents in the UK for sensor boards.Anyways, a UNO isn't a bad place to start if you're leaning hardware and software and you can buy sensor boards from companies like Adafruit. Once you've got something working then think about migrating from 5V to 3V3.For battery operation you need to run the ATmega328P at a much lower clock frequency as well as running it at 3V3. For example, an ATmega328P draws 20mA at 5V when running at 16MHz ! Also, if you need two UART, SPI and I2C then use the newer ATmega328PB, not available in DIP package unfortunately.

author: rstofer
author_rank: Super Contributor
timestamp: May 28, 2018, 06:37:56 pm
content: Quote from: TK on May 28, 2018, 06:09:50 pmHere is an article re: changing the Uno voltage to 3.3Vhttps://learn.adafruit.com/arduino-tips-tricks-and-techniques/3-3v-conversionIn theory, the chip can't run at 16 MHz on 3.3V.Until the IO configuration is settled, I wouldn't lock into an Arduino. If the 5V isn't a problem, the Mega 2560 brings out 4 serial ports.The other problem with the Uno is the limited RAM and flash. 32k of code isn't a lot and 2k of RAM is nothing.The Arduino product comparison:https://www.arduino.cc/en/Products/Compare

author: Monkey123
author_rank: Newbie
timestamp: May 28, 2018, 08:04:14 pm
content: Quote from: rstofer on May 28, 2018, 06:37:56 pmThe LiFePO4 Batteries that I intend on using run on a nominal 3.2V, so that might not cut it. I will probably put two in series, and throw something like a small buck converter it, in which case, 5V might actually be better than 3.3

author: Monkey123
author_rank: Newbie
timestamp: May 28, 2018, 08:19:40 pm
content: Quote from: chris_leyson on May 28, 2018, 06:25:48 pmATmega328PB Looks pretty nice. Everything is DIPpable in the end!

author: Monkey123
author_rank: Newbie
timestamp: May 28, 2018, 08:22:48 pm
content: Wow so many great suggestions.This info will keep me busy for a while! Thanks and keep’em coming.

author: C
author_rank: Super Contributor
timestamp: May 28, 2018, 08:36:09 pm
content: Think of what has been said so farStarting to small can be a problem.You have very little space for your program and you data. You have few pins you can use to interface your things.From Arduino IDE it is no harder using the 2560 then something less and you gain more code space, data space and pins and peripherals.But today is 3.3 volt logic with 5 volt a thing of the past.Again the Arduino IDE has options these days using other processors like ESP32, STM32 and others that work at 3.3 volt logic levels.Some like the Teensy but this is high dollar compared to STM32Money and ease counts. When you jump up to current micro-controllers you get more for less cost.One interface that a lot of the newer micro-controllers have is a CAN bus interface. A true interface built to work between micro-controllers. SPI & I2C are not designed for this as these are more Micro-controller to peripheral chip in close local area.You could easily destroy what you start with do to bad connections. Do you want to destroy something that costs around $2.00 or Over $10.00So I would suggest that you bypass the 5 volt logic and other messes and start with 3.3 in the form of a $2.00 STM32 board.You might also want to have second choice of ESP32 as you can find many examples and this contains Bluetooth.Both can be breadboard friendly.

author: chris_leyson
author_rank: Super Contributor
timestamp: May 28, 2018, 10:11:53 pm
content: Quote

author: C
author_rank: Super Contributor
timestamp: May 28, 2018, 11:35:54 pm
content: When you compare the spec's ofATmega328PB to the stm32f103c8t6Look at which is one of manyATmega328PBATmega328PB Summary Datasheethttp://ww1.microchip.com/downloads/en/DeviceDoc/40001907A.pdfSTM32F103C8http://www.st.com/en/microcontrollers/stm32f103c8.htmlThis chip can be in many packagesA google search for"stm32f103c8t6 board" gives many results"stm32f103c8t6 arduino" gets more infoIncluding some YouTube videosC

author: TK
author_rank: Super Contributor
timestamp: May 28, 2018, 11:45:47 pm
content: Just one important comment, most of the STM32F103 boards out there comes with the native bootloader. You need to burn a new bootloader t(I think it is the MAPLE MINI bootloader) o be able to use it with the Arduino IDE

author: C
author_rank: Super Contributor
timestamp: May 29, 2018, 12:03:46 am
content: With STM32 you can use a"st link v2" for allYou can get a cheap clone or use one built in to most discover boards from SThttps://www.youtube.com/results?search_query=arduino+st+link+v2+

author: james_s
author_rank: Super Contributor
timestamp: May 29, 2018, 12:12:46 am
content: I've modified a number of the $2.50 Arduino Nano clones to be 3.3V, it was not hard to do and they work fine. Lots of other options out there but if you are starting from zero you have a long road ahead. The electronics part is pretty trivial but I'd expect it will take several months to a year to become proficient with the coding depending on how hard you work at it.

author: brucehoult
author_rank: Super Contributor
timestamp: May 29, 2018, 01:43:49 am
content: An Arduino Uno or similar hasn't got anywhere near enough processing power or program space to run actual code for GSM, GPS or even Bluetooth so you'll be looking at connecting it to specialised modules that have a lot more processing power internally. Bluetooth software alone is 50 or 100 KB or more, while the Uno has only 32 KB.And what do you want to do with all this data afterwards?The 2 KB of RAM in a Uno doesn't go very far to accumulating data long term. It can be ok if you're immediately sending it on to somewhere else, or maybe storing to an SD card.The Uno (or bare 328 AVR) probably has enough I/O connections to do what you want, but it will be the processing that determines if you need an ARM or RISC-V or other beefier processor with more RAM and MHz.

author: james_s
author_rank: Super Contributor
timestamp: May 29, 2018, 03:46:38 am
content: "0 experience with electronics and little programming knowledge" pretty much means either stick together a number of modules that each contain a bit of their own intelligence in the case of something like BlueTooth, or a very steep learning curve to code it all from scratch using something like an ARM core. I don't want to discourage the latter approach, but I don't want to see someone get frustrated and give up when they bite off more than they can chew either. Just something to keep in mind.

author: Brumby
author_rank: Unknown
timestamp: May 29, 2018, 04:13:06 am
content: If you've had no programming experience in the microcontroller world, the Arduino path isn't a bad way to start - IMHO.I'd also recommend getting a MEGA 2560 for your initial development. This gives you heaps of I/O and you can concentrate on getting your application going. Once functional, you can then look at rationalising down to a physically smaller board and the 2560 can be used for future projects.There are some caveats, though. If you need to plug in a keyboard to the Arduino or need the Arduino to present to the host as a USB keyboard, you will need to look at the options for doing so, as not all Arduino variants have the same capabilities.

author: rstofer
author_rank: Super Contributor
timestamp: May 29, 2018, 02:29:11 pm
content: Arduino versus all the others...Every possible project that can be done with an Arduino has been done and is documented on the Internet. That statement may be a reach but it's pretty close to accurate.It is quite helpful to gather bits and pieces from other working projects rather than rolling your own from scratch.The mbed compatible STM boards as well as the LPC1768 mbed itself are far more capable platforms but the number of documented working projects isn't anywhere close to the Arduino.I sure wouldn't be touting the Arduino IDE once I found that I could install an add-in to Microsoft Visual Studio and use a real IDEhttps://www.visualmicro.com/The IDE, by default, uses some regrettable colors, especially the error messages. On my screen, with my color vision, they are unreadable. Yes, with a bunch of searching of the Internet, it is possible to find a way to fix that. Having done that, the IDE is still crap.With the mbed compatible boards, you can use the online toolchain and install nothing. The created executable is downloaded and all you have to do is drop it on the board which is acting like a mass storage device. It's just like dragging and dropping any other file. Hit the Reset and you're up and running.If you need to get down and dirty debugging interrupt routines and other hardware related issues, the STM-Link V2 is quite nice.If the STMs are an option (and they should be, they have a BUNCH of peripherals and gobs of memory) buy the book "Mastering STM" by Carmine Noviello and follow along as he installs the tools along with Eclipse for the IDE. Do it his way, it is far more likely to work out.I would think the hardware design for a project like this would be fairly straightforward, even for a beginner. Not knowing how to program embedded systems is a much bigger issue. It's going to take a ton of research to get up to speed on that. Again "Mastering STM" may help.

author: picandmix
author_rank: Frequent Contributor
timestamp: May 29, 2018, 05:56:10 pm
content: Quote from: C on May 29, 2018, 12:03:46 amHi,Would appreciate some advice, a friend has a stmF411re Nucleo board they do not use as such, and it has its own snap off StLink board.Can this be used to re-program the bootloader on one of those stm32103 boards to be used as Ardunio ?Do we need to actually need to snap it off, seems there are a lot of jumpers and header pins on the StLink section, so thought it might be possible to program another external device while attached the to Nucleo section ?thanks

author: C
author_rank: Super Contributor
timestamp: May 29, 2018, 09:20:59 pm
content: Quote from: picandmix on May 29, 2018, 05:56:10 pmJust some find details to help all.ST Link V2 is ST's programming tool.As STM32 micro-controllers can be run a many different voltages this is covered.The ST link v2 that is included with the discover boards and others is a more limited version built to work at that voltage.From the ST documentation I have seen, you have many options.1. You can snap off the Link v2. The documation I have seen their is two sets of holes on each side of snap point that you can add a headers. If you connect the headers with a cable it;s back working. but Now a separate limited ST Link V2.2. Remove solder jumper or cut traces. Have seen this option in most ST documentation. Adding headers lets you local program or program something else STM32 at same voltage.All the ST documentation about the boards I have seen have real good documentation of the many options a board has.So Yes it can program a STM32 chip.ArdunioPeople often miss that the Ardunio IDE can do it's programming many ways.The normal is installing a bootloader which then allows programming over serialThe Ardunio can use ST Link V2 to program STM32 chips.The ST Link V2 uses JTAG SMD to program & debug a chip.STM32 chips have the two connections for this connection.The STM32 chip could be blank. SMD can program, read, write, erase and can be used to debug a chip.In AdditionA lot of STM32 chips come with a Rom Memory boot loader. Capabilities very by chip and the interfaces of that chip.You sill often find that a STM32 that has USB can be programmed over USB.Was looking at one STM32 that had a CAN bus interface that you could use to load a program. A different STM32 could not via CAN as it had a different Rom Memory boot loader.ST Application note AN2606 lists the ways the Rom memory boot loader can function.http://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD00167594.pdf/files/CD00167594.pdf/jcr:content/translations/en.CD00167594.pdfthe STM32103 is SWD or USART1 using the Rom Memory boot loader.ST sets the standard on how it worksYou can load firmware that is a boot loader with different capabilities like a Ardunio boot loader which uses an Ardunio standard.soST link V2 via SWD always.A program that can do ST serial protocal via USART1Ardunio after loading Ardunio boot loader firmware.is what the chip can do.Google "stm32f103c8t6 bootloader"The cheap stm32 boards are often called "Blue Pill"C

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: May 30, 2018, 10:00:46 am
content: I would start of using a Arduino/ Genuino UNO clone from eBay, the go for few bucks since you’ll probably destroy a few since you’re a beginner. You should be able to build the project around a ATmega328P (Arduino UNO MCU) running on 3.3V since many sensor nowadays run on 3.3V and run it on its internal 8MHz and prescale it for power saving.You could also use anESP32that has plenty of I/O pins, built in WIFI and Bluetooth, 4M flash and loads of Ram, it also runs on 3.3V and can be programmed through the Arduino IDE just like the UNO.Personally I would probably use the ESP since it has the inbuilt Bluetooth but the whole project should work just fine on an Arduino UNO!