Warning: Declaration of TCB_Menu_Walker::walk($elements, $max_depth) should be compatible with Walker::walk($elements, $max_depth, ...$args) in /home/circuitc/public_html/arduino/wp-content/plugins/thrive-leads/tcb/inc/classes/class-tcb-menu-walker.php on line 0
Circuit Crush https://circuitcrush.com/arduino Learn Electronics, Arduino, & Microcontrollers Mon, 15 Apr 2019 17:22:08 -0400 en-US hourly 1 https://wordpress.org/?v=5.3 Get Started with Arduino in 1 Day https://circuitcrush.com/arduino/2019/03/20/get-started-with-arduino-in-1-day.html https://circuitcrush.com/arduino/2019/03/20/get-started-with-arduino-in-1-day.html#comments Wed, 20 Mar 2019 20:27:00 +0000 Introducing a 12-Step System to Take You From ‘Zero to Sixty’ with Arduino in One Day Do you want to start creating with Arduino? Are you overwhelmed or confused by the massive amount of information (and miss-information) out there? Don’t let this stop you from being the Maker you were born to be any longer. …

Get Started with Arduino in 1 Day Read More »

The post Get Started with Arduino in 1 Day appeared first on Circuit Crush.

]]>

Introducing a 12-Step System to Take You From ‘Zero to Sixty’ with Arduino in One Day

Do you want to start creating with Arduino?

Are you overwhelmed or confused by the massive amount of information (and miss-information) out there?
Don’t let this stop you from being the Maker you were born to be any longer. You can create some amazing things with Arduino and I’m going to show you how to quickly and effortlessly get started.
Not only am I an electrical engineer, I’ve been an electronics hobbyist and Arduino enthusiast for a while.
And I’ve developed a step-by-step system to help you quickly get started making with Arduino. Now I want to share that system with you…including…
  • Get started quickly – 4 crucial things you NEED to know about the Arduino and how to easily master them 
  • Start writing code in no time – learning to program doesn’t have to be complicated or require a college degree. You’ll start coding right away with these top programming “hacks”
  • Start creating NOW with these 12 proven steps hundreds of Makers have used to go from 0 to 60 with Arduino in no time flat

Find out more: How to Get Started with Arduino in 1 Day or Less

The post Get Started with Arduino in 1 Day appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2019/03/20/get-started-with-arduino-in-1-day.html/feed 2
Arduino Intermediate Model Railroad Projects https://circuitcrush.com/arduino/2019/03/13/arduino-intermediate-model-railroad.html https://circuitcrush.com/arduino/2019/03/13/arduino-intermediate-model-railroad.html#respond Wed, 13 Mar 2019 16:52:00 +0000 Want Arduino projects for your Model Railroads? Learn about object / block detection sensors, signaling, servo control, inter-Arduino communications, JMRI integration, speed measurement, turntable indexing and sound projects. All code and schematics included, as well as step-by-step instructions. Arduino Intermediate Model Railroad Projects Additional Resources: Arduino Model Railroad Animation Arduino Model Railroad Signals

The post Arduino Intermediate Model Railroad Projects appeared first on Circuit Crush.

]]>

Want Arduino projects for your Model Railroads? Learn about object / block detection sensors, signaling, servo control, inter-Arduino communications, JMRI integration, speed measurement, turntable indexing and sound projects. All code and schematics included, as well as step-by-step instructions.

Arduino Intermediate Model Railroad Projects

Additional Resources:

Arduino Model Railroad Animation

Arduino Model Railroad Signals

The post Arduino Intermediate Model Railroad Projects appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2019/03/13/arduino-intermediate-model-railroad.html/feed 0
Flyback Diodes https://circuitcrush.com/arduino/2019/02/27/flyback-diodes.html https://circuitcrush.com/arduino/2019/02/27/flyback-diodes.html#respond Wed, 27 Feb 2019 21:45:00 +0000 Flyback Diodes are used with inductive loads like dc motors and relays. Lets use a relay for an example. A common relay has a 12v 120 ohm coil. In use it draws .1 Amps. When you turn off the power, energy is pumped back into the circuit briefly as the field in the coil collapses, …

Flyback Diodes Read More »

The post Flyback Diodes appeared first on Circuit Crush.

]]>

Flyback Diodes are used with inductive loads like dc motors and relays. Lets use a relay for an example. A common relay has a 12v 120 ohm coil. In use it draws .1 Amps. When you turn off the power, energy is pumped back into the circuit briefly as the field in the coil collapses, equal to the energy used while energized. A reverse diode across the load absorbs this spike, preventing damage to the circuit powering the load. In our example, 12 Volts / 120 Ohms = .1 Amps, so we need a diode capable of handling .1 Amps at 12v. The common 1N4001 is rated for 1 Amp at 50 Volts, so this is more than adequate for this application.

Remember the diode is installed “backwards”, with the stripe facing the positive, not the negative as a diode would typically be used.

Additional Info

The post Flyback Diodes appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2019/02/27/flyback-diodes.html/feed 0
Charging Lithium Ion Batteries with the Arduino https://circuitcrush.com/arduino/2019/01/23/charging-lithium-ion-batteries-with.html https://circuitcrush.com/arduino/2019/01/23/charging-lithium-ion-batteries-with.html#comments Wed, 23 Jan 2019 13:33:00 +0000 Many of our projects are running off the common 18650 Lithium Ion battery, so today we wanted to talk about the math of charging, and of course we want to use an Arduino to manage that charge. Lithium Ion batteries need a Constant Current (CC) / Constant Voltage (CV) charge. It starts out in CC, …

Charging Lithium Ion Batteries with the Arduino Read More »

The post Charging Lithium Ion Batteries with the Arduino appeared first on Circuit Crush.

]]>

Many of our projects are running off the common 18650 Lithium Ion battery, so today we wanted to talk about the math of charging, and of course we want to use an Arduino to manage that charge.

Lithium Ion batteries need a Constant Current (CC) / Constant Voltage (CV) charge. It starts out in CC, then switches to CV to finish once the battery comes up to a specified voltage.

If you have a 2000mah battery, you typically want a charge current of half that, so multiply .5 * 2000mah = 1000 ma charge current (check your battery datasheet for recommended charge current).

We are charging 4 batteries in series, so 4 * 4.2v = 16.8v is our maximum charge voltage.

We will be using two LM317 regulators, one in CC mode, and one in CV mode. The LM317 has a 1.5A maximum with a heat sink. If you need more current, use the LM338 (5A).

To determine the correct resistor for the CC regulator, we divide 1.25v by the desired current (1A), and get 1.25 ohms. We also need to determine the resistor wattage, so multiply 1.25v * 1A and we get 1.25W (use a 2W resistor).

R1 (Ohms) = 1.25v / 1A
R1 (Watts) = 1.25v * 1A

To determine the correct resistors for the CV regulator, we need our desired output voltage (I will use 16.4v to give more life to the batteries, and less stress on an optional inverter) . We will use 220 Ohms for R1 and 2700 Ohms for R2.

R2 = R1 * ((Vout – 1.25)/1.25)

The Arduino is used to monitor voltage and current, and toggle two relays, disabling the CC regulator and enabling the CV regulator when the voltage hits 80% of target, then shutting down the CV regulator when current drops below 50ma. Active mode as well as voltage and current can be displayed on a LCD. See the tutorial.

A future upgrade will be a temperature sensor that stops charging (and discharging) when the battery temperature exceeds a predetermined value. We can also drop the load when the battery discharges to a predetermined value.

References:

https://circuitdigest.com/calculators/lm317-resistor-voltage-calculator
http://www.reuk.co.uk/wordpress/electric-circuit/lm317-current-calculator/
http://www.reuk.co.uk/wordpress/electric-circuit/lm317-voltage-calculator/
http://www.learningaboutelectronics.com/Articles/LM317-resistor-and-voltage-calculator.php

https://www.electricbike.com/introduction-lithium-18650-batteries/
http://www.rfcafe.com/references/electrical/resistor-values.htm

LM317 Datasheet
Samsung 18650 Datasheet

The post Charging Lithium Ion Batteries with the Arduino appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2019/01/23/charging-lithium-ion-batteries-with.html/feed 4
ESP8266 / DS18B20 Temperature; Ajax Web Updates https://circuitcrush.com/arduino/2018/12/13/esp8266-ds18b20-temperature-ajax-web.html https://circuitcrush.com/arduino/2018/12/13/esp8266-ds18b20-temperature-ajax-web.html#comments Thu, 13 Dec 2018 15:16:00 +0000 I wanted to monitor temperature with a ESP8266, and display the results on a web page. I grabbed a DS18B20 temperature sensor, and created a web server to display the results. I decided to use Ajax, so that the results would autoupdate without having to reload the page. The question came up, what IP address …

ESP8266 / DS18B20 Temperature; Ajax Web Updates Read More »

The post ESP8266 / DS18B20 Temperature; Ajax Web Updates appeared first on Circuit Crush.

]]>

I wanted to monitor temperature with a ESP8266, and display the results on a web page. I grabbed a DS18B20 temperature sensor, and created a web server to display the results. I decided to use Ajax, so that the results would autoupdate without having to reload the page. The question came up, what IP address did the ESP8266 grab, so I know where to point my browser. I had a I2C LCD, so I connected that to show the IP address. I probably should have assigned a static IP so that it never changes, but hey, now you will know how to use a LCD with a ESP8266.

I have the I2C LCD connected to the ESP8266 I2C pins, GPIO5 (SCL), and GPIO4 (SDA). The LoLin calls these D1 & D2 respectively. You can specify other pins in the Wire.begin() statement, but the library I’m using doesn’t expose that command. My LCD does not run on 3.3v, so I have it connected to the USB Power pin, labeled VU on the LoLin.

The DS18B20 I connected to GPIO14 (D5), GND, and 3.3v, with a 4.7k Ohm resistor across the D5 and 3.3v.

When I put the IP address displayed on the LCD (or in serial monitor if you are not using a LCD) in my browser, I get the following display:

My next modification will be to email me when the temperature climbs above or drops below my preset “acceptable range”, indicating a problem with my HVAC system.

Libraries:
OneWire and DallasTemperature found in Library Manager

The post ESP8266 / DS18B20 Temperature; Ajax Web Updates appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2018/12/13/esp8266-ds18b20-temperature-ajax-web.html/feed 1
Build a $200 Computer for Christmas https://circuitcrush.com/arduino/2018/12/05/build-200-computer-for-christmas.html https://circuitcrush.com/arduino/2018/12/05/build-200-computer-for-christmas.html#respond Wed, 05 Dec 2018 13:04:00 +0000 Do you want to learn Computers, Electronics, and Programming? For the last 40+ years kids and adults alike have been building their own computers instead of buying prebuilt, preloaded systems. Times have changed, and so has hardware and software. Some of the coolest tech comes in kit form, so not a lot of building is …

Build a $200 Computer for Christmas Read More »

The post Build a $200 Computer for Christmas appeared first on Circuit Crush.

]]>

Do you want to learn Computers, Electronics, and Programming?

For the last 40+ years kids and adults alike have been building their own computers instead of buying prebuilt, preloaded systems. Times have changed, and so has hardware and software. Some of the coolest tech comes in kit form, so not a lot of building is required, but you can still put it together, and customize it the way you want.

For the budding programmer or electronics engineer, one of the least expensive ways to put together a full blown linux and IOT programming environment is with the Raspberry Pi. The new 3B+ is more powerful than previous versions of the $35 computer, and with onboard WiFi and Bluetooth, very flexible.

You can build a media server, a VPN device, firewall / router, security system, phone system, automated home control, and much more. Learn to program in Python, or even C/C++. Build web based apps with PHP and MySQL. The I/O pins allow you to read sensors and control relays and LED’s. Your imagination is the limit! See Build a Home Automation System!

Let’s see if we can build a complete computer system for $200 or less!

Raspberry Pi 3B+
The heart of the system, this single board computer includes the processor, ram, drive (sd card), video and audio, ethernet, WiFi and Bluetooth. A complete starter kit with power supply, case, sd card, HDMI cable, etc.
Costs about $85

Raspberry Pi 3 B+ (B Plus) with 1.4 GHz 64-bit Quad-Core Processor
1 GB RAM
Dual Band 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac Wireless LAN
10/100 Ethernet
32 GB Samsung EVO+ Micro SD Card (Class 10) Pre-loaded with NOOBS
USB MicroSD Card Reader
CanaKit 2.5A USB Power Supply with Micro USB Cable and Noise Filter
Premium Raspberry Pi 3 B+ Case and more

Wireless Keyboard / Mouse Combo
This wireless keyboard and mouse combo makes it easy to use your new Raspberry Pi without wire clutter, and allows some distance between the units.
Costs about $40

Comfortable palmrest
Single usb wireless receiver
Over 2 year battery life

HDMI Monitor
You can use your existing HDMI enabled TV, or you can get this 20″ LED HDMI monitor with built in speakers. This monitor gets the audio over the HDMI cable, so no external speaker / wire clutter. VESA wall mount ready. 2x HDMI ports, so another HDMI device can also be connected.
Costs about $70

Sensor Kit
For the electronics experimenter, add an optional project pack that includes 38 I/O gadgets, including temperature, relay, joystick, sound, and much more, with convenient solderless breadboard and Raspberry Pi I/O connector. Costs about $45

The post Build a $200 Computer for Christmas appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2018/12/05/build-200-computer-for-christmas.html/feed 0
Python: Floating Point vs. Decimal https://circuitcrush.com/arduino/2018/11/27/python-floating-point-vs-decimal.html https://circuitcrush.com/arduino/2018/11/27/python-floating-point-vs-decimal.html#respond Tue, 27 Nov 2018 16:27:00 +0000 In our Arduino projects (programmed in C/C++), we often use a Raspberry Pi for collecting data, and the Python programming language. Math with floating point is inherently risky, because a decimal number does not store exactly in binary. in python,1.1+2.2 = 3.3000000000000003 not the 3.3 you might expect. we can force the result we are …

Python: Floating Point vs. Decimal Read More »

The post Python: Floating Point vs. Decimal appeared first on Circuit Crush.

]]>

In our Arduino projects (programmed in C/C++), we often use a Raspberry Pi for collecting data, and the Python programming language.

Math with floating point is inherently risky, because a decimal number does not store exactly in binary.

in python,
1.1+2.2 = 3.3000000000000003

not the 3.3 you might expect.

we can force the result we are looking for by importing the Decimal module, and setting the desired precision (2 in this example):

>>>from decimal import *
>>> getcontext().prec = 2
>>> Decimal(1.1)+Decimal(2.2)
Decimal(‘3.3’)

Arduino doesn’t have a Decimal function, it uses floating point, but you can work around this by using Fixed Point Arithmetic

The post Python: Floating Point vs. Decimal appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2018/11/27/python-floating-point-vs-decimal.html/feed 0
Why can’t I upload to my Arduino Nano? https://circuitcrush.com/arduino/2018/11/16/why-cant-i-upload-to-my-arduino-nano.html https://circuitcrush.com/arduino/2018/11/16/why-cant-i-upload-to-my-arduino-nano.html#respond Fri, 16 Nov 2018 18:41:00 +0000 For all of you out there with Chinese NANO clones, or older Arduino NANO’s, there has been a recent change. The upload baud rate has been bumped up from 57600 to 115200, and that causes a upload error. avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf6 The solution …

Why can’t I upload to my Arduino Nano? Read More »

The post Why can’t I upload to my Arduino Nano? appeared first on Circuit Crush.

]]>

For all of you out there with Chinese NANO clones, or older Arduino NANO’s, there has been a recent change. The upload baud rate has been bumped up from 57600 to 115200, and that causes a upload error.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf6

The solution is at hand!

Go to

Tools > Processor > Atmega328P (Old Bootloader)

and your upload woes should be solved!

The post Why can’t I upload to my Arduino Nano? appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2018/11/16/why-cant-i-upload-to-my-arduino-nano.html/feed 0
Electrolysis Issues with Soil Moisture Sensor https://circuitcrush.com/arduino/2018/09/26/electrolysis-issues-with-soil-moisture.html https://circuitcrush.com/arduino/2018/09/26/electrolysis-issues-with-soil-moisture.html#respond Wed, 26 Sep 2018 17:26:00 +0000 One problem with testing for moisture in soil or for free water is electrolysis of the electrodes. As material is removed from one electrode and deposited on the other (a byproduct of using a dc current), the resistance changes, and the values coming from the sensor start to drift. One way to solve this is …

Electrolysis Issues with Soil Moisture Sensor Read More »

The post Electrolysis Issues with Soil Moisture Sensor appeared first on Circuit Crush.

]]>

One problem with testing for moisture in soil or for free water is electrolysis of the electrodes. As material is removed from one electrode and deposited on the other (a byproduct of using a dc current), the resistance changes, and the values coming from the sensor start to drift.

One way to solve this is to flip the polarity of the current each time you do a read. The following code will change the polarity of the pins (and the equation evaluation) each time through the loop.

This circuit will print the word “Triggered” if it senses moisture (even skin moisture) and light up the onboard LED. You could have additional sections of code for varying levels of moisture (very wet, wet, dry, very dry), based on the analog results.

Wiring:

Probe pin 1 – A0 //analog input
Probe pin 2 – A5 //digital output
2M ohm resistor between A0 (analog input) and A4 (digital output)

Code:

int state=0;
int aValue=0;

void setup() {
  // put your setup code here, to run once:
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:

  if (state==0){
    digitalWrite(A4, HIGH);
    digitalWrite(A5, LOW);
    aValue=analogRead(A0);
    Serial.println(aValue);
    if (aValue<200){
    Serial.println(“Triggered”);
      digitalWrite(13, HIGH);
    } else {
      digitalWrite(13, LOW);
    }
 
    state=1;
    delay(500);
  } else if (state==1){
    digitalWrite(A4, LOW);
    digitalWrite(A5, HIGH);
    aValue=analogRead(A0);
    Serial.println(aValue);
    if (aValue>800){
      Serial.println(“Triggered”);
      digitalWrite(13, HIGH);
    } else {
      digitalWrite(13, LOW);
    }
    state=0;
    delay(500);
  }

}

The post Electrolysis Issues with Soil Moisture Sensor appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2018/09/26/electrolysis-issues-with-soil-moisture.html/feed 0
Long Distance Serial with RS-422 https://circuitcrush.com/arduino/2018/09/20/long-distance-serial-with-rs-422.html https://circuitcrush.com/arduino/2018/09/20/long-distance-serial-with-rs-422.html#comments Thu, 20 Sep 2018 19:09:00 +0000 PC’s used to have RS-232 ports to connect things like mice, modems, printers, etc. Then technology moved on to USB. RS-232 had a maximum distance of 50′, and USB is 9′ (USB 3.0) to 16′ (USB 2.0). If you really need to send data a long distance, RS-422 might be the trick. It uses two …

Long Distance Serial with RS-422 Read More »

The post Long Distance Serial with RS-422 appeared first on Circuit Crush.

]]>

PC’s used to have RS-232 ports to connect things like mice, modems, printers, etc. Then technology moved on to USB. RS-232 had a maximum distance of 50′, and USB is 9′ (USB 3.0) to 16′ (USB 2.0). If you really need to send data a long distance, RS-422 might be the trick. It uses two pair of wires, and CAT 5 is just fine. You communicate up to 4900′. Arduino’s and other microcontrollers use TTL logic (3v to 5v for a HIGH, 0v for a low), and need a converter to work with other signals. We are using a inexpensive TTL to RS-422 converter called a YL-128. This module uses a Maxim 490 chip.

By connecting a Arduino to a YL-128 on each end of the wire, you can communicate as if the two Arduino’s were side by side and connected directly.

Connect one Arduino RX1 to the YL-128 RXD pin (RO), and the Arduino TX1 to the YL-128 TXD pin (DI). Connect a second Arduino and YL-128 on the other end of the cable in the same manner.

Connect the two YL-128 modules Y-A, Z-B, A-Y. and B-Z.

You can then load a serial test sketch like the one at https://www.hackster.io/harshmangukiya/serial-communication-between-two-arduino-boards-d423e9

The post Long Distance Serial with RS-422 appeared first on Circuit Crush.

]]>
https://circuitcrush.com/arduino/2018/09/20/long-distance-serial-with-rs-422.html/feed 2