Could an Arduino do all these tasks please?

Thread Starter

Rich:-)

Joined Oct 14, 2016
50
Please be gentle with me as I am not familiar with Arduino but I have a project in mind and would like to use this as a reason to learn it.
So before I start I'd like to know if it's possible for one Arduino to perform all these functions, or maybe it would need two and I set the priority between them on the output stage.... or maybe there is a better controller to learn for this job?

The project is to control an LED spot light on so it can be a light sensitive DRL, but can switch to being a spot light or a variable output ramping alert "flasher".

1. I would like to use the PWM output via a FET to set three brightness levels low - Med - Full.
2. Read a light sensor to automatically switch between low and medium brightness (which will be as a day/night DRL setting).
3. Read a momentary switch (SPST) and if pressed override the above and go to full brightness (spot light mode)
4. Read a second momentary switch and if pressed override all above and perform a ramped brightness "flash" a set number of times and then revert back to previous state.

I'm guessing maybe have function 1-3 on one Arduino with function 4 on a separate one that overrides at the FET stage.

Any advice?

Many thanks, Rich.
 

Ya’akov

Joined Jan 27, 2019
9,068
This is trivial and I don't know why you think number 4 requires something additional. All of these things can be done with an Arduino or Arduino compatible MCU.

If you use an ESP32 or some other WIFi equipped MCU you can even do all this via an app in addition.
 

dl324

Joined Mar 30, 2015
16,839
I agree that this would be a trivial problem for any Arduino.

If you're planning to supplement functionality in an automobile, what country are you in? Some countries have regulations on lighting.
 

Thread Starter

Rich:-)

Joined Oct 14, 2016
50
Great news, thanks.

The reason I ask is that I have zero experience with Arduino but I read somewhere that when deciding if you need an Arduino or a Raspberry Pi, ask yourself "does it need to do 1 thing or many things?", if it's many then the Arduino isn't the one.
I suppose it's a question of what the writer of that article considered to be separate things.

So by asking this question here I was just wanting to avoid waste time learning something that wasn't going to be suitable... so now I shall buy a kit and start teaching myself to program.
 

Thread Starter

Rich:-)

Joined Oct 14, 2016
50
If you're planning to supplement functionality in an automobile, what country are you in? Some countries have regulations on lighting.
I'm in the UK (England).
This might end up on my motorcycle. The only questionable function is that ramp flash but I'm hoping to make it more of a varying shimmer effect so it gets attention without qualifying as a flashing light.
 

dl324

Joined Mar 30, 2015
16,839
if it's many then the Arduino isn't then one
There are times when an Arduino doing many things is better than a Pi doing many things. It depends on which is better for which and that's where experience comes in.

Any Pi will have significantly more resources than Arduino. If I need network connectivity, WiFi, time services, Pi is definitely better (IMO) than Arduino.
 

dl324

Joined Mar 30, 2015
16,839
This might end up on my motorcycle. The only questionable function is that ramp flash but I'm hoping to make it more of a varying shimmer effect so it gets attention without qualifying as a flashing light.
I hope you carry enough liability insurance if you're in an accident and they tag your modifications as a cause. Your insurance company will bail on you and you'll have to pay for compensation.
 

Thread Starter

Rich:-)

Joined Oct 14, 2016
50
Yes... that's something to consider.
If I limited the functionality to simply DRL or spot light I'll be fine as both are legal here, and my motorcycle already has an OEM light sensitive headlight/DRL.
For insurance it would just class as accessory lighting.
 

dl324

Joined Mar 30, 2015
16,839
For insurance it would just class as accessory lighting.
I'm sure insurance companies here would do anything to get out of having to pay out.

My auto insurance fought me for over 5 years for an underinsured motorist claim I made for a driver on her father's inadequate policy. The expert witness my insurance company used wasn't even at the right accident and the insurance company still managed to deny most of my claim. I was t-boned and he claimed it was a side swipe and couldn't have possibly caused the injuries my daughter and I sustained. He was probably told to go to the scene of the accident years after the fact. By then, they had replaced that intersection with a turnabout. The state finally had enough deaths at that intersection to do something about it.
 

wayneh

Joined Sep 9, 2010
17,496
I'm sure insurance companies here would do anything to get out of having to pay out.
Yup, including outright refusing to pay a valid claim. I once got caught in flood water and my engine sucked enough water to ruin it. Allstate claimed the engine failed because I didn't have oil in it. (True, after a rod went thru the oil pan!) Failing in a flood was just a coincidence, they argued.

Of course that was ridiculous and I later learned from local dealers that Allstate had a reputation for screwing people in similar scenarios. A manager had decreed that they needed to get their numbers up and that was one way to do it.

They eventually settled with me to avoid court, but it wasn't enough and I'm still spitting mad 30 years later.
 

ErnieM

Joined Apr 24, 2011
8,377
The reason I ask is that I have zero experience with Arduino but I read somewhere that when deciding if you need an Arduino or a Raspberry Pi, ask yourself "does it need to do 1 thing or many things?", if it's many then the Arduino isn't the one.
I suppose it's a question of what the writer of that article considered to be separate things.
So to get the thread back on track...

Yeah I would imagine the "things" the author had in mind was run a web browser or a document editor or a paint program or...

You are basically only doing one thing here, controlling the light by using a few switches.

Yeah, we keep calling that "simple" because we have done it a double dozen times already, but the first one was hard.

Aside: my favorite blinky light was to have a LED match the brightness curve of an incandescent bulb over a voltage range of 8 to 28 VDC. No knobs, switches, just apply the voltage and match the brightness. Oh, and fit it all in a package about the size of the metal tab on a pencil. Did I mention the voltage polarity could be either way?

One microscopic bridge rectfier, one current source, a switched constant current sink, and a micro processor in the middle and I had it.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
The reason I ask is that I have zero experience with Arduino but I read somewhere that when deciding if you need an Arduino or a Raspberry Pi, ask yourself "does it need to do 1 thing or many things?", if it's many then the Arduino isn't the one.
I suppose it's a question of what the writer of that article considered to be separate things.

Or the writer of the article doesn’t use Arduinos and read somewhere that they couldn’t do many things and just repeated it.

I have an Arduino Mega, that controls 11 RC servo motors, plays sound clips, processes sounds, scans it’s surroundings for objects, communicates over a Ethernet network, all simultaneously while running a proprietary language run-time module.

So Arduinos are good for doing many of some things.
 

Thread Starter

Rich:-)

Joined Oct 14, 2016
50
I've found the article that I'd read.

https://makezine.com/2015/12/04/admittedly-simplistic-guide-raspberry-pi-vs-arduino/

and this is what he said, his rule of thumb.

" Think about what you want your project to do. If you can describe it with less than two ‘and’s, get an Arduino. If you need more than two ‘and’s, get a Raspberry Pi. "

He did go on to say that was an over simplification though, I obviously took his rule too literally.

There are many projects I'd like to attempt using Arduinos, like making a multi-channel voltage data logger and then having a live onscreen oscilloscope like display. This would be a very useful tool for my electronics projects and for battery testing.
It's daunting though as I have no programming experience so I'm starting from scratch.

Thanks for the advice though, no doubt I'll be back asking questions once I have a feel for it.

Rich.
 

Ya’akov

Joined Jan 27, 2019
9,068
I've found the article that I'd read.

https://makezine.com/2015/12/04/admittedly-simplistic-guide-raspberry-pi-vs-arduino/

and this is what he said, his rule of thumb.

" Think about what you want your project to do. If you can describe it with less than two ‘and’s, get an Arduino. If you need more than two ‘and’s, get a Raspberry Pi. "

He did go on to say that was an over simplification though, I obviously took his rule too literally.

There are many projects I'd like to attempt using Arduinos, like making a multi-channel voltage data logger and then having a live onscreen oscilloscope like display. This would be a very useful tool for my electronics projects and for battery testing.
It's daunting though as I have no programming experience so I'm starting from scratch.

Thanks for the advice though, no doubt I'll be back asking questions once I have a feel for it.

Rich.
To be clear an Arduino (or more properly Arduino compatible MCU because there are many very good choices that are not Arduinos in any way except sharing the development environment) and a Raspberry Pi are two different things.

The RPi is not a more powerful Arduino, it is an SBC (Single Board Computer), something more suited to computationally intensive projects. It runs an ordinary operating system and has relatively limited interface hardware of the type used in automation projects.

On the other hand the Arduino is an MCU (Microcontroller Unit). It runs an RTOS (Real Time Operating System) and is more suited to things that require acting quickly with sensors and actuators. Depending on which you choose, the Arudino's peripherals include many serial ports, SPI, and I2C interfaces for connection to other devices and peripherals, multiple ADCs (Analog to Digital Converters) to read voltages, DACs (Digital Analog Converters) to make voltages, PWM (Pulse Width Modulation) interfaces to create control signals, and DIO (Digital I/O) pins to send and receive on/off signals for control and sensing.

Also compared to the Arduino, the RPi is a power hungry beast, and it has many parts that are useless for MCU type projects like HDMI and multiple USB interfaces.

Don't imagine I am saying the Arduino is "superior" to the RPi, I am certainly not. I use RPis and really like them. I am saying the right tool for the right job, and there is no time when I can imagine choosing between the two based on "how many things I want to do". That really doesn't make sense.

The way to choose is by what you want to do, By your requirements. In your case you need an MCU, not an SBC. There are very few cases I can imagine where I'd say, "well, I could do this on an Arduino but it's too complicated for the poor little thing so I will use an RPi".

Learning each is a very good thing. They are two important tools. But the RPi is not a more powerful Arduino.
 
Last edited:

wayneh

Joined Sep 9, 2010
17,496
So to get the thread back on track...
LOL, yes sorry I forgot to answer the question before launching my rant!

The four tasks can easily be done with Arduino. I'm a complete noob to Arduino and even I feel comfortable saying that the four listed tasks are a piece of cake. Literally they are "day one" projects you could accomplish as soon as you have your hardware (Arduino, cable, computer) and software (the IDE) up and running. I've actually used a light sensor as in #2. Adafruit TSL2591
 

djsfantasi

Joined Apr 11, 2010
9,156
...The four tasks can easily be done with Arduino. I'm a complete noob to Arduino and even I feel comfortable saying that the four listed tasks are a piece of cake. Literally they are "day one" projects you could accomplish as soon as you have your hardware (Arduino, cable, computer) and software (the IDE) up and running. I've actually used a light sensor as in #2. Adafruit TSL2591
..,if you already are comfortable coding.

Otherwise, it’s a few day effort.
 

SamR

Joined Mar 19, 2019
5,031
People tend to forget that Arduino is a "Development Board" for the AT MCU chips. In other words, it has all the communication, power supply, and accessory add ons to support the chip. Instead of using a development board simply integrate the MCU chip into your design. At some point it may be cheaper, both in time and materials, to use an Arduino Nano or Mini instead but using a full-blown Uno or Mega is an overkill quite often.
 

wayneh

Joined Sep 9, 2010
17,496
..,if you already are comfortable coding.
Ah, good point. I'm comfortable enough coding that I didn't even think about that aspect, once you helped me find the language reference. But even so, I've done quite a bit by using the sample code and just tweaking it a bit. For instance I have a bunch of NeoPixels. You adjust the sample code for the number you have in series. Pretty straightforward. I'd have a much harder time starting with a blank sheet.
 

djsfantasi

Joined Apr 11, 2010
9,156
People tend to forget that Arduino is a "Development Board" for the AT MCU chips. In other words, it has all the communication, power supply, and accessory add ons to support the chip. Instead of using a development board simply integrate the MCU chip into your design. At some point it may be cheaper, both in time and materials, to use an Arduino Nano or Mini instead but using a full-blown Uno or Mega is an overkill quite often.
Agree! Many people don’t realize that Arduino is a platform with many board variations.
 
Top