Why Arduino when you can Pi?

Arduino
Arduino ProMini, Uno, and Nano on expansion board.

Why Arduino?

The greatest advantage to using the Arduino family of microcontrollers for DIY electronics projects, is that they are ubiquitous.  Since they are so available, they are inexpensive and you can find open-source software to get started.

If you’ve ever had the opportunity to work with an Arduino Uno microcontroller board, then you’ve probably executed the flashing LED example.  Going further, you might attach a button, or switch, to trigger the LED or to turn it off making the project interactive.  There are many sensors that could be connected to the Arduino Uno and setup to trigger events, such as the LED flashing, using threshold values that we would need to experiment with in order to figure out what settings work best for creating the effect we want.

While the examples that come with the Arduino software and the examples included with libraries are an excellent start to a project; the Arduino family of microcontrollers is often grossly underutilized in many projects.  Sure microcontrollers are limited in how many instructions they can run; hitting the program size limit doesn’t take very long when you want to control more than a few blinking LEDs.  Even with creative variable handling and custom libraries, eventually, there is a need for another microcontroller or to move to a larger one, even a Raspberry Pi.

In my Alien Invasion Slot Machine project, I tried to push the Arduino closer to its limits.

Time Management and state and trigger flagsf0zk2etiagml1az-medium

At its most basic, a microcontroller loops through a set of instructions handling each action with the focus of The Red Eye of Sauron from Lord of the Rings.  There are a few interrupts that can be configured should an event be so important to receive the full attention of the microcontroller.  Using some form of time management creates a state machine. If x amount of time has passed since x event, then do something and so on…

“The behavior of state machines can be observed in many devices in modern society that perform a predetermined sequence of actions depending on a sequence of events with which they are presented. Simple examples are vending machines, which dispense products when the proper combination of coins is deposited, elevators, whose sequence of stops is determined by the floors requested by riders, traffic lights, which change sequence when cars are waiting, and combination locks, which require the input of combination numbers in the proper order.” https://en.wikipedia.org/wiki/Finite-state_machine

There are rare instances where: RTOS, AI, neural networks exist on microcontrollers, but that’s best left to software-oriented systems such as a Raspberry Pi.

After trying many different timer and time management libraries I felt they were either too much or not enough of what I was wanting in my timers.  A set of timers that are easy to set, keep track of their own state, and each have their own trigger flags.

Button assumptions

buttons

Interacting with an electronics device such as a microcontroller or computer system is relatively easy and typically provided as an example for developers looking to use the device in their project.  Press a button and an LED illuminates. A button or switch may seem like a simple sensor input, but it’s not.

The device’s system resources are consumed waiting and watching for a button press. When we use a button in a project we typically think of it being activated when pressed.  Then what? What should happen if the user holds the button in the active position? Will the button be counted as pressed once, or is the program going to count each second, or x amount of time, as another button press?  Does the program need to know that the button has been released?

Hardware and wiring

wiring harness

Rather than using the Arduino Uno and a protoboard or breadboard for this project, I’m using the Arduino Nano on an expansion board.  Keep it simple using common wiring colors, keep it modular so connections can be made with ease, keep your project sustainable; a part can be replaced rather than the entire system.  The DuPont wire connectors that come with prototyping starter kits makes it easy to create your own custom wiring connections. The wires are easy to solder when a more permanent connection is needed.  I make custom wiring harnesses for neater, cleaner, and more easily connectable modules.

 

Raspberry Pipi3

The latest version of the Raspberry Pi v3 uses a Linux OS and is a computer that can do so much more than an Arduino Uno, why not just use it for everything?  While it is possible to do many of the same tasks as you would do with the Arduino Uno or variant, it’s not always best.  The Arduino Uno and variant microcontrollers are best for doing the same actions, over and over again, such as reading a sensor and doing something with the value.

As I mentioned previously, you can do a lot with a Raspberry Pi, and depending on how much you are doing, it won’t take too long before you discover it has limits.  When the Pi overheats, it will either freeze or shutdown, hopefully, the processor has a heatsink.

More Info:

Please share with friends and follow to receive a notification when I publish a new article.

Starting a Smart Indoor Garden

What’s at stake?  Are you providing life support or inadvertently executing a death sentence?  Are you improving the system, or adding more dependencies?

Bigger than a window herb garden but smaller than a greenhouse?

hydro-diagram-final

A basic, low-cost, reliable, indoor garden is a controlled environment typically in the form of a tent inside a room, inside a garage.  You have one or two AC-powered ventilation fans, recirculating and/or one is the intake and the other is the exhaust.  You have two super bright fluorescent lamps connected to a mechanical/digital timer controlled AC outlet providing the plants with their appropriate light-cycle.  Your plants are contained in soil, or a basic deep water culture hydroponics system. A large plastic reservoir with multiple grow baskets containing clay pellets partially submerged in the nutrient solution being aerated by an aquarium-style air-pump that’s connected to an air-stone, creating bubbles, preventing stagnation, keeping the culture healthy. 

image11
small hydro garden setup

 

temp humidity display

 

An inexpensive household digital temperature and humidity gauge provides daily readouts including minimums and maximums.

lux

 

 

The next “smart” enhancement can be to use a temperature controlled AC outlet for at least one of the fans helping to keep the temperature and humidity in range while reducing the power consumption being used by a continuously operating fan motor.

 

 

Next Up:  Digging Deeper into Indoor Gardening

More Info:

Please share with friends and click follow to receive a notification when I publish a new article.

Why DIY when you could buy?

You value the project because you are able to customize and experience the process of its creation, both physically and mentally.

Practical Reasons:

  • Integrity and dependency on specific vendor:  Complete packages are limited in capability and scalability, also they often include unwanted strings attached, i.e. Advertisements; company owns your data for purposes of profiting by selling for marketing purposes.  Mass produced products are typically not designed for longevity. Can the equipment be repaired or is it disposable?
  • People have complex preferences and want more customizable, possibly less expensive solutions, typically with the trade-off related to labor, can be improved or perform to preferred standards
  • Interest in learning and/or educating others:  You enjoy or have an interest in the activities associated with the process of a subject.
  • Necessity:  Resources and costs vary by region.
  • What else?

Cost considerations

Many items can be purchased locally or sourced from the Worldwide market through the Internet.  I don’t know about you, but I rarely have money to spend on projects and whenever possible reusing and re-purposing junk is ideal.  Many of my projects contain parts I’ve purchased at local dollar stores and items found through eBay online vendors. Online researching, reviewing, and sourcing materials

Time

It takes time to learn how to use tools and equipment successfully, let alone, have the time to actually make the project meet your expectations.  Will you take the time to safely use the equipment necessary to complete the project?  Are you able and willing to troubleshoot problems as they arise?

Time used for the project is time that could be spent with family, friends, learning something more important, etc.

Skill and Ability

Even though it may pain me to swallow my pride, I try not reinvent the wheel.  If I don’t have direct experience performing a task, I take the time to research how others have approached similar problems.  It is best to learn from others before making a serious mistake simply because I don’t want to appear stupid. Practice makes permanent. We cannot expect to become experts on a subject overnight, it’s okay not to know how to do something, try to find someone who can help, take small simple steps towards achieving the goal.

Resources for DIY Hacking Electronics:

For electronics projects, reliably wiring the hardware and designing the software to operate using an Arduino variant or Raspberry Pi, is a challenge.  Hacking Electronics – Simon Monk ( link to Amazon ).  Regardless of your experience level, this book is an excellent resource, what tools are needed, when and how to solder, and many basic fundamentals of working with modern electronics.  The second edition, includes Raspberry Pi.

Next up:  What is a “smart” garden?

Please share with friends and click follow to receive a notification when I publish a new article.