Arduino Training Kit For Schools | Botshop
Diet Duino, Arduino low energy consumption for battery powered projects

Diet Duino, Arduino low energy consumption for battery powered projects

skeleton duino

To run an Arduino on battery power requires 2 things:

  1. First, you need to sort out the hardware because even if you put your Arduino to sleep (we will look at that soon) it is only the Atmel chip that will sleep, the rest of the components like power led, regulators and so on will still be very much alive
  2. Next, you can programmatically put the Arduino into different kinds of sleep modes that will drop the power consumption to μA’s

First sort the hardware power consumption.

When you want to use a battery source like a coin cell, the Uno is not an option it consumes on average 48mA without sensors and so on connected to it. Even a 9V will not last a day.

Our skeleton Duino performs much better at about 30mA and is already much better at about 40% energy saving compared to the Uno but there is more we can do…..

We created the Diet Duino to bring this down even lower to 16mA, that is about a 1/3 of the consumption of an Arduino Uno.

skeleton duino working

You can get the Diet Duino here: Diet Duino

We accomplish this by removing the power led (still a led on pin 13 if you want to see a power led – but make it blink slowly on the off and very quick on the on cycle so it uses as little power as possible) and most importantly, we use a rather expensive imported voltage regulator that is VERY energy efficient.

Now let the Atmega chip go to sleep wherever possible.

When be put the Diet Duino into sleep mode it is too low to measure, We can measure up to around 20 μA but looking at the only thing that consumes power – the voltage regulator we look at about 4uA.

Some perspective on sleep mode.

When you put an Arduino in sleep mode it does not take long for it to go to sleep or to wake up, it happens in milliseconds. This means that you can already replace all your normal Delay calls in your Arduino with “real sleep” commands with a very cool Arduino library that you can find here: Low-Power library from Rocketscream

It is very easy to use and you will find lots of information from the link above. The statement LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); puts the MCU in SLEEP_MODE_PWR_DOWN for 16 ms to 8 s, depending on the first argument. It disables the ADC and the BOD. Power-down sleep means that all chip functions are disabled till the next interrupt. Further, the external oscillator is stopped.  Only the level interrupts on INT1 and INT2, pin change interrupts, TWI/I2C address match, or the WDT, if enabled, can wake the MCU up. So with the single statement, you will minimize energy consumption to 3 uA. If you read the library documentation you will find lots of other settings to use.

To give you an example: If you measure temperature once ever 1 minute, the measurement takes maybe 1 second, that means your Arduino can sleep for 56 seconds.

In conclusion, with the Diet Duino and some basic programming, you can get over a year on one coin cell.

The Diet Duino is available here: Diet Duino low energy

 

 

 

How to use a PH probe and sensor

How to use a PH probe and sensor

If you worked with PH metering before you will know that PH values range from 0-14. Where PH 0 Will be very acidic, PH 7 will be neutral and PH 14 very alkaline. Water is near a PH 7 and this is usually around here that we will need to monitor PH of many things. A swimming pool, for example, should be slightly alkaline at 7.2, hydroponics systems around 6 (for optimum plant nutrition takeup) and aquaponics around 6.8.

I wrote this PH probe and sensor “how to” because it is not as straightforward as one would think (but quite easy when you understand the ins and outs) mostly because there is not a lot of information on this on the Internet, surely not detailed information.

We will first look at the ph probe module board and then the PH probe because both the PH probe and sensor have to be set correctly:

  • offset setting
  • limit setting
  • sketch to test the board analogue range
  • sketch for PH reading and calibration.
  • calibration of PH probe
  • PH probe usage

The ph probe module in this tutorial is available on our site here: PH probe module BNC connector

ph probe sensor module

PH Probe Sensor Pinout
TO – Temperature output
DO – 3.3V Output (from ph limit pot)
PO – PH analog output ==> Arduino A0
Gnd – Gnd for PH probe (can come from Arduino GND pin) ==> Arduino GND
Gnd  – Gnd for board (can also come from Arduino GND pin) ==> Arduino GND
VCC – 5V DC (can come from Arduino 5V pin) ==> Arduino 5V pin
POT 1 – Analog reading offset (Nearest to BNC connector)
POT 2 – PH limit setting

PH probe module Offset and how to use it.

This board have the ability to supply a voltage output to the analogue board that will represent a PH value just like any other sensor that will connect to an analog pin. Ideally, we want a PH 0 represent 0v and a PH of 14 to represent 5V.

BUT there is a catch……, this board by default have PH 7 set to 0V (or near it, it differs from one PH probe to another, that is why we have to calibrate the probe as you will see later on), This means that the voltage will go into the minuses when reading acidic PH values and that cannot be read by the analog Arduino port. The offset pot is used to change this so that a PH 7 will read the expected 2.5V to the Arduino analog pin, the analog pin can read voltages between 0V and 5V hence the 2.5V that is halfway between 0V and 5V as a PH 7 is halfway between PH 0 and PH 14,

You will need to turn the offset potentiometer to get the right offset, The offset pot is the blue pot nearest to the BNC connector.

To set the offset is easy. First, you need to disconnect the probe from the circuit and short-circuit the inside of the BNC connector with the outside to simulate a neutral PH (PH7). I took a piece of wire, strip both sides, wrap the one side around the outside of the BNC connector and push the other side into the BNC hole. This short-circuit represents about a neutral PH reading of 7.

ph probe and sensor

ph sensor arduino connection

There are two ways you can do the adjustment.

If you have a multimeter handy you can measure the value of the PO pin and adjust the offset potentiometer until  PO measures 2.5V.

I prefer to just use the sketch below. Just download it to your Arduino as you will with any other sketch, open serial monitor and view the reading there. All this sketch does is to print the volts it receives from the analog pin and print it to the serial monitor. It of course first changes the digital value to volts to make it easier. Now simply turn the offset pot until it is exactly 2.5V. You can learn more about reading voltages and digital representation of volts here: https://www.arduino.cc/en/Tutorial/ReadAnalogVoltage

Offset sketch

void setup() {
 // initialize serial communication at 9600 bits per second:
 Serial.begin(9600);
}

// the loop routine runs over and over showing the voltage on A0
void loop() {
 // read the input on analog pin 0:
 int sensorValue = analogRead(A0);
 // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
 float voltage = sensorValue * (5.0 / 1023.0);
 // print out the value you read:
 Serial.println(voltage);
 delay(300);
}

PH limit setting

There is another pot that acts like a limit switch. Basically, the D0 pin on the sensor board will supply 3.3V to the pin until a preset PH value (that you set with the limit pot) is reached, at this point a red LED will light up and the pin will go down to about 0V.  I did not play with this much but suppose it can be handy if you want to activate a buzzer or something if a certain PH is reached, it will work great on an Arduino digital port – that will go high from about 2V up. This will work if the PH value goes higher than the set value. If you want it to trigger something when the PH goes lower, you need to monitor the digital pin to trigger when the digital pin goes low. You will unfortunately not be able to set this limit between two values, either if the pH goes up to high or if the PH drop to low. Programmatically you of cause can do an upper and lower limit.

Connecting and calibrating the PH probe.

The hard part is over and this offset does not have to be set again, even if you change PH probes. We have PH probes available here: PH probe Electrode BNC connector

Here is a couple of things to know about PH probes:

  1. The probes readings change over time and need to be calibrated every now and again to make sure the value is still the same and be adjusted if it did change.
  2. You need at least one PH buffer solution to calibration your PH probe. They are available at many different PH values, A buffer solution of 6.86 and 4.01 is most common as it covers the range of most applications. If you are only going to use one buffer solution make sure its value is near the value range you will use in your normal tests – if it is pool water a buffer solution of 6.86 is usually near enough.
  3. Buffers come in pre-made solutions or as a powder. I prefer the powder because it is cheaper and does not have an expiration date. The powder is easy to make up as well, I suppose it depends on the power you will use, the one I use you add the powder to 250ml distilled water and stir until all powder is dissolved. It will last about a month once you added water to it.
    buffer solution powder
  4. A PH probe takes some time to get to the right value, allow it to be in the liquid you want to measure for at least two minutes or longer, it does not mean it will be stable at one ph value, it will jump around a bit between 3 or 4 values but on the last digit, for example,  between 6.84 – 6.88
  5. PH values differ in different temperatures, although that might sound cumbersome, in the temperature range between 10 – 30 degrees Celcius the PH does not differ and from 30 degrees Celcius it goes up with about a pH of 0.01 to 50 degrees Celcius that is about 0.06. In most uses, it will be below 30 degrees Celcius and temperature do not have to be calculated in.

Hook up your PH probe after you removed the wire you used to short-circuit the BNC connector and download the sketch below.

PH measurement sketch

float calibration = 0.00; //change this value to calibrate
const int analogInPin = A0; 
int sensorValue = 0; 
unsigned long int avgValue; 
float b;
int buf[10],temp;
void setup() {
 Serial.begin(9600);
}
 
void loop() {
 for(int i=0;i<10;i++) 
 { 
 buf[i]=analogRead(analogInPin);
 delay(30);
 }
 for(int i=0;i<9;i++)
 {
 for(int j=i+1;j<10;j++)
 {
 if(buf[i]>buf[j])
 {
 temp=buf[i];
 buf[i]=buf[j];
 buf[j]=temp;
 }
 }
 }
 avgValue=0;
 for(int i=2;i<8;i++)
 avgValue+=buf[i];
 float pHVol=(float)avgValue*5.0/1024/6;
 float phValue = -5.70 * pHVol + calibration;
 Serial.print("sensor = ");
 Serial.println(phValue);
 
 delay(500);
}

A note on buffer solutions: do not CROSS CONTAMINATE! What I mean by this is to not take the probe from one buffer solution to another or from a liquid sample you tested to a buffer solution without rinsing it thoroughly with distilled water first. You will change your buffer solutions ph and your calibration will be off.

When you place the probe in the first solution you might be surprised at how far off it can be, it’s normal though. Remember to leave the probe in the solution for at least two minutes to stabilise. In the script’s top line you will see a variable called “calibration”.  Change this value to the difference between what you see in serial monitor and the buffer solutions value, for example, if you read 5.81 and the buffer solution is 6.86 you should change the variable’s value to 2.05.

Upload the changed sketch and see how the value looks now.

Some ideas for you.

You can add a potentiometer to your project and program that to change the calibration for you. You always run a risk that the pot might be adjusted my mistake so a button with a 5-second delay can be programmed to put the unit in calibration mode.
This becomes great if you add an LCD screen to it and if you add the calibration value in EEPROM so it holds it even if the PH project is powered off.

How about adding a buzzer to the 3.3V limit output to notify you when the PH is out of range. Usually an upper or lower will be enough, in most applications, you will either be worried about high or low PH values but not both. If this is a problem and you need the PH to be in a certain range you can easily do that programmatically and have the buzzer on a digital pin. If it is crucial you can even add a GSM module to this so you can get an SMS or how about a dosing pump to automatically get the PH back in range.

I just might, but do not hold your breath (so much to do but so little time) :-), do something like that in the future with our cheap Skeleton Duino.

PH probe and sensor conclusion

If you go through these steps once it becomes as easy as pie. All the parts, even those I mention in the ideas section is available on our site.

 

Types of electronics power modules tutorial

Types of electronics power modules tutorial

power modules tutorial

The different types of electronics power modules tutorial and how to choose the right one for you.

If you click on our power supplies and modules category you will see many different power supplies and modules, there are adjustable ones, buck, boost, step-up, step-down, constant current, low power, high power and the list goes on and on. Hence this power modules tutorial.

The one thing all these different units have in common is that they all manage/change power in one way or another. Usually, they change a high voltage to a lower voltage, most commonly used power supplies also change AC current (from your house plug for example) to DC as required by most electronics. The popular 12V power supplies used on Arduino’s are a good example that changes AC to DC and lowers the 220V Volts to 12V

A power supply is a complete unit with wires inside a case where a power module is just the electronic circuit board.

Raspberry Pi Power Supply LM2596 Adjustable Step Down Power Supply module DC

In the rest of this power modules tutorial, I will refer to power modules but it is the same for power supplies.

The amps a power module can handle are probably the first thing you will look at when getting yourself one.

When developing projects we need more than a mere 12V power supply, we need to supply different power to different parts of a circuit and change it in ways to charge batteries and all kinds of other thigs, hence the big range of power modules.

When working with these modules you will often can a module that is bigger than the required input e.g. 12V for an Arduino Uno although all components require 5V and then from this supply make the voltages less as you go along.

Power usage

Once you decided on the voltage you will require you will need to think about the amps you will need. You need to understand that a voltage is supplied by a power supply and the wrong voltage will destroy your components but the amps it uses are drawn from the supply as needed by the components. Different components need more power than others.  One component might need 12V and 100mA and another 12V but 300mA. Together they will require 400mA.  The formula for power is V x A, thus you will need, in this example 12V x 0.4A thus a minimum of 4.8 Watt of power. Becuase amps are not ” pushed” into the circuit like voltage but “pulled” in as required by the components you can and should use a supply that can provide more than the required amps like a 1A supply. You want the supply to not work at its highest rating as to not put an unnecessary strain on them. An over worked unit will be very hot to the touch, a unit with amps to spare will be slightly warm to the touch.

Step-up, step down, buck and boost.

The word “buck” had me a bit confused when starting with these modules until I figured out it is just another word for step-down. A step-down unit just means you are going to make the volts less. This is done with a voltage regulator IC.

Boost is another word for step-up, this means you are going to make the supplied voltage more. This is done with devices called inductors.

To further explain these modules I will discuss a couple that is often used, why you will use them and shortly how to use them. As we explore some of these modules you will also learn about adjustable and constant current modules.

Adjustable 3A Ultra small power module

The most basic buck module, its small, can handle quite a big amount of current and its voltage can be adjusted.Adjustable 3A Ultra small power module

Way to the top right-hand side in the picture you can see the holes where you can connect your power source. The left side is where the adjusted power will be available to connect to your circuit. You should see the little adjustment pot that you will adjust to the correct required voltage, it’s the component near the bottom right next to the “+” sign.

This module is small but can deliver up to 3A and can adjust power sources between  4.5V to 28V down to
0.8V to 20V.

It is important to note that this unit itself uses a bit of voltage (as does most) to do the adjustment, normally around 0.8-2V, the higher the voltage is to adjust the more volts it uses itself.  You will thus need a voltage input that is 1-2V higher than what you want the output to be. If you use a 5V input you should easily get the unit to adjust between 0,8V and 4.2V, a 12V input 0.8V – 11V and so on.

to adjust these modules you need to hook it up to power and then use a multimeter on the output side to adjust the screw to the correct voltage.

You can look at the full specs here.

Adjustable Power step down module with Voltmeter

Next up is a similar module then discussed above, also a buck module,  but this one comes with a voltmeter for easy adjusting the power output without the need of a multimeter.

LM2596 Adjustable Power Converter

In fact, if you use a 12V 2A power supply with this product you have quite a neat desktop power supply. It has 2 buttons so you can check both the input and output voltages on the screen and small LEDs indicating if you are looking at input or output volts. These types of modules are best used as power sources while doing development, not final products (like the one discussed previously) except if your project will need a permanent voltage meter. I use them all the time while developing and testing products and the screw terminals are very useful to attach different products without having to solder them.

If you look at the components on this board you can see there is quite a difference compared to the first ultra small board we looked at. The main thing is that the ultra small board is as basic as they come to make the board as small as possible to incorporate them into final products. This board we look at right now is more expensive and another reason why I use them just as desktop power units to save on costs on final products.

However, they also use more powerful voltage regulators that can handle up to 40V input and 37V output for bigger voltage projects. It also has bigger stabilising capacitors that are very useful to have while developing higher voltage projects, stabilizing caps help to keep the output voltage very smooth even if the input voltage is not.

You can get all the specs for this module here.

AC-DC 220V to 12V power module

You do not need a bulky 220V to 12V power supply, especially if you are going to have a low power design.

This module takes 220V AC on the one side and supplies 12V DC on the other side. A WARNING though, you work with 220V power, it can kill you! But these modules are great when you insert them in your home build PC boards to make things look neat. I do not recommend them to new comers but introduce them here as part of the power modules tutorial as education. From this output, you can then add. for example. an ultra small step-down module to get the volts exactly where you want it to be just as you would with a normal 12V power supply.

More about these units here.

This concludes our look at basic power modules Next week we will look at more advanced modules in part 2 of this tutorial.

 

Skeleton Duino Review

Skeleton Duino Review

skeleton duino working

We designed this little board here at Bot shop as our solution to saving costs on using Arduino in our projects. Using an Arduino Uno on a finished project is firstly a bit expensive, throwing money in the water on components etc. not used in a final product. Secondly, the Uno board is unnecessary big for a final project that in itself mean bigger more expensive cases, thirdly it consumes unnecessary power (4x more than the Skeleton Duino) especially if you think of using batteries.

You can get one here.

You might be aware of the fact that in its basic form you just need the Atmega microcontroller, the crystal and 2 caps. A good idea is a 5V voltage regulator as well so you can use power sources bigger than 5V. The male rails, USB converter chip (quite expensive), 3.3V regulator, power jacks etc just add to cost and size of the board. All these are great while you develop but will not be used in a final product.  Jumper cables that fall out become a nuisance etc.

We use the Arduino Uno to develop our projects because it is easy to upload the code, push in jumper wires and get things to work. Once completed, we look at other boards for the final project. We used the Arduino mini but that is still a bit pricey and we do not like the SMD micro controller and having to go through the troubles of uploading sketches with an ISP uploader.

Eventually, we used strip board to have the Atmega, crystal and capacitors on a small board for projects but that looks nasty. Worth than that is building it on stripboard, the cutting away of tracks and soldering connection wires is a pain.

Here is an example of a pic from the Internet of such a board.
Uno stripboard

So we came up with the Skeleton Duino board. There is zero fluff, no USB to TTL to program the chip. no headers and a socket to plug in Atmega IC’s instead of the SMD chips.

Programming the Atmega micro controller

The whole idea is to program the chip on your Arduino Uno, take it out of the ic socket and then put it into the ic socket of the skeleton Duino. I hope it is needless to mention that you need the Uno with the micro controller in a socket not those with the Atmega SMD chip.  It does have a power LED, status LED and a 5V voltage regulator on board but that’s it.

Power consumption.

Unexpectedly actually, this board has quite a low power consumption because there are no additional voltage regulators. resistors, IC’s and so on. An Arduino

An Arduino Uno uses without anything connected to it 45 mA. The Skeleton Duino uses 9mA. This is important if you use batteries as a power source, they will last x 5.6 times longer.

Features:

  • The power terminals uses 2.54 pitch if you want to use screw terminals
  • 5V regulator
  • Power LED
  • Status LED
  • Dimensions: 45mm x 25mm
  • ……uh, ok that it.

We sell these boards on our site here.

 

 

 

 

Bot shop EL wire how to

Bot shop EL wire how to

Electroluminescent wire – EL wire how to

Yes, it looks impressive that is for sure! But it might seem a bit daunting to newcomers…… it is not. There are only a view things you need to know.

In the past, you needed to be quite skilled to use lighting to set moods, use in displays, in home decor and so on, now it became easy. In this EL wire how to you will learn everything you need to be an expert in electroluminescent products and it will take you no more than 15 minutes to learn.

Some quick technical stuff

el wire how its made

It is actually quite simple to understand. By introducing very low alternating current (but high voltage) to a layer of phosphor the phosphor will glow. Phosphor when glowing has an aqua blue colour.

To get different colours of EL wire a coloured plastic sleeve is used on the outside of the EL product. This is how EL product manufacturers can produce different colours

el wire colours

The colours are limited to 10 colours: Aqua (fluorescent blue), Lime (fluorescent green), red, blue, green purple, orange, yellow, pink and white

The way to introduce electricity to phosphor can be seen in the first picture above, you take a  piece of copper wire and coat it with phosphor, then you take 2 very fine wires and turn it around the phosphor coated wire like a spiral over the whole length of the wire. You now put the one wire of a power supply and connect it to the phosphor coated copper wire and the other wire of the power supply you connect to the 2 thin wires.

The power source – inverter

One of the reasons we did this how to is because there is a lot of confusion around the power requirements for electroluminescent. The first thing to know is that EL products operate best at a Voltage of between 80V-140V (120V is optimum).

WHAT? Electroluminescent (EL) PRODUCTS OPERATES AT 120V, THAT CAN KILL YOU!!! LUCKILY THERE ARE NEARLY NO AMPS SO IT IS SAFE. 

If you touch bare open wires you might feel a very slight shock – so the connection points should never be exposed. Later in this how to you will see how to make your own connections (if you do not get pre-made el products with connectors already on them) and cover the bare wire with heat shrink tubes, We sell both types in our shop here.

The power source alternates the voltage at around 800 Hz. That simply means it first sends + voltage to the one EL wire and negative voltage to the other side and then switches the – and + voltages around, what is impressive is that it does this switching 800 times in a second, That’s fast!

To make this long story short – you need an EL inverter.
IMPORTANT. Inverters have different power ratings. The lower the power rating the smaller the length of EL wire it can handle. A small inverter is usually able to handle about 3 meters. You do not have to turn it into rocket science, you just need to be “nearish” to those specs, All inverters have a description on what length of EL wire it can drive

So be careful with this though, don’t use a short piece on an inverter that is meant for longer pieces, your EL product’s life expectancy will be drastically shortened. So basically if you have 3 meters or lower use a 3meter inverter rather, it will last longer

Power efficiency, heat and life span.

How long will it run from a battery and how many hours of light will it produce. EL products are very power efficient because of the low amps (current) it uses. There is no other light source this efficient.

Two AA batteries driving 3 meters of EL wire will last 10 hours plus!
No heat is produced at all, cold to the skin
EL wire life span is about 8000 hours, if you have it on every night it will last 1000 days

Using EL wire

El wire can be shaped any way you like. You can also cut it shorter and if you like you can put on connectors on the offcuts (more about that soon)

Becuase the EL wire got a plastic casing you can use PVC glue to glue it anywhere. For wearables like shirts and hats, you can sew it to the wearable by sewing a “loop ” around the EL wire and the piece of fabric. There are no hard and fast way on how to stick it to stuff, above is only ideas

Cutting and putting connectors on EL wire.

Easy as pie. Below is a video that shows exactly how to do that. You will need a soldering iron, solder and a wire stripper (or Stanley knife) we sell an El solder kit here that include the connectors, shrink wrap tubes and end caps. They use a heat gun in this video to shrink the tubes but a lighter will work great as well.

It is important to note that when you cut EL wire the end that is cut of must be isolated in any way you like so that the copper wire and 2 thin wires do not touch each other.

 

 

And that concludes this EL wire how to. So, head over to our EL wire shop category here, get some EL wire and accessories and create some fun stuff.

Our Lithium Battery Charging module review

Our Lithium Battery Charging module review

Lithium Battery Charging module

Lithium Battery Charging module

There will come a time that you want to have your project mobile. The easiest way to accomplish that is with batteries and if you want to get a bit fancy, rechargeable Lithium batteries.

I am reviewing the lithium Battery Charging module that is also available from us here. It is a low-cost unit that is affordable enough to build into your projects directly without having to worry to open a box, removing the batteries for charging and then put it all back again. Except for saving on the cost of a charger you now have an easy to charge project.

Power to the board.

It comes with a USB connector to connect to a 5V power source. This is handy because you can connect the module to a computer USB port or a 5V power supply, your cell phone power supply will work great. This module also has a place to solder 5V power supply power wires directly to the board as well.

Functionality

Lithium charger functions

From the picture above you can see the 2 status LEDs on the Lithium Battery Charging module. The charge LED indicates that the battery is charging and the second LED lights up when the battery is fully charged.

Most of the work is done by the TP4056 IC, it is a constant-current/constant-voltage linear charger IC designed specifically for Lithium ion batteries and comes with many features including automatic recharging and is able to supply 1A charging current! You will find these chips in cell phones, cameras, charging doc stations etc.

Hooking it up is easy, supply the Lithium Battery Charging module with 5V and then hook up the battery via 2 wires to the bat+ and bat- power through holes on the board (this require soldering).

Specifications

  • Input voltage: 5V
  • Maximum charging current: 1000 mA
  • Charge cut-off voltage: 4.2 V + / – 1%
  • Battery overcharge protection voltage: 2.5 V
  • Battery over-current protection current: 3 A
  • Input interface: Micro USB or 5V to power terminals
  • Dimension: 2.6 x 1.7 cm

Changing the charging current

Out of the box, this unit supply 1A constant current to the batteries but that might be too high. It is recommended that when you charge a battery you should charge them at 37-40% of the battery capacity(in mAh). If you are charging a battery of 1000mAh capacity, you should adjust the resistance in a way that the current offered is approximately 370mA-400mA.

Now, this is my only drawback in using this module, you will need to manually replace the resistor. It is an easy process but still a bit of extra work to get exactly the amps you require. I was hoping for a variable resistor but the problem with this is that you will blow the chip if you set the resistance too low, that you will do very easily if you turn a variable resistor just a bit too far to the wrong side.

In the picture earlier you can see the resistor you need to replace if 1A is too high for your batteries. It is easier than you probably think right now, simply use a soldering iron to heat up both sides of the resistor at the same time to remove, put the new one in place and heat up each side to solder it back in place. If you do not have an SMD resistor use a normal 1/4 watt resistor, cutting the legs as short as you can.

Here is a table to work out the size of the resistor you will require:

Resistor (k)BAT amps (mA)
3050
2070
10130
5250
4300
3400
2580
1.66690
1.5780
1.33900
1.21000

Summary

Cheap, easy to use and it can charge bigger Lithium batteries than expected with ease. With the drawback of having to solder in a different resistor to get the correct charging current comes the benefit of being able to charge any chargeable Lithium battery at its optimum levels.

Wifi Scale project for Wemos D1 board Part two

Wifi Scale project for Wemos D1 board Part two

wemos d1 project

Scale project for Wemos D1 part 2- from pallet wood 

Now that we got the scale to work with an Arduino it is time to see how we will get it to work with a Wemos D1 board so that we can view the scale data from a Wifi connection on a web browser. This can also be a web browser on a cellular phone if you so wish. In short, we want to now expand our project to an IOT (Internet of things) scale. This scale project for Wemos D1 part 2 focus on the wifi part of this project, in part one we focus more on the load cells and amplification so first have a look (there is a link above).

Getting the D1 to work with the Arduino IDE.

In our review of this board, we gave details on how to get it to work with your Arduino IDE in the “Use your Arduino IDE to program the chip” section.

To recap:
  1. To install drivers remove all previous esp boards download and
  2. install http://www.arduined.eu/files/CH341SER.zip
  3. next open file>preferences
  4. enter http://arduino.esp8266.com/stable/package_esp8266com_index.json in the additional board manager urls area
  5. open tools>board>board manager
  6. search ESP8266 and
  7. install “esp8266 by ESP8266 community” version “1.6.5-947-g39819f0”
  8. next restart the Arduino IDE then select
  9. tools>board>WeMos D1 R2 & mini
  10. select upload speed at 115200 baud

 

Scale project for Wemos D1 – Hooking up the load cell HX711 amplifier

In part one of this project, we showed you how to connect the load cells to the amplifier board as well as to an Arduino Uno. We also talked about the pin differences between the Arduino and Wemos D1. Below is a picture again as well as a diagram connecting the amp to the Wemos board.

In the code, we also show, as comments in the pinouts for the Arduino.

Wemos D1 pin assignments

Wemos diagram

The LCD screen pinout can also be seen in the code.

LiquidCrystal lcd(0, 2, 4, 14, 12, 13); // WEMOS pins differ from UNO pins translated to uno would be (8, 9, 4, 5, 6, 7)

Scale project for Wemos D1: Explaining the code

Connecting to your WIFI network

To connect to a WiFi connection we use these 2 libraries (all the WiFi libraries will be automatically installed with the ESP8266 files when you add the board to your Arduino IDE):

#include <ESP8266WiFi.h>
#include <WiFiClient.h>

Next, you need to enter your WiFii details to connect to the network. Look for the lines below in the code and change the **** with your network name and network password.

const char* ssid = "*********"; 
const char* password = "*******";

Setting up the board as a web server

The first thing to understand is that we want to setup the D1 as a web server. If you are not familiar with web servers it basically means that we want to hand out web pages to web browsers for displaying when the web browsers connect to the D1 board. Hence the name web server – it serves web pages to your browser when the browser connects to it.

In the code (see below) you will use a library called ESP8266WebServer.h and the code to start the web server is simple:

ESP8266WebServer server(80);

The (80) specify the port the server should listen to and is standard as all web browsers by default try to connect to web servers on port 80. A port is nothing more than a number that distinguishes what data is intended for what application on a server. Thus, a web browser will connect to the web server and communicate that it wants to connect to the software that is assigned the number 80. Port numbers are of cause very important when you have many applications like FTP, email etc on one server,  else there is no way you will know for what application the data to your server is for.

Web page code

A web page is a text file with very basic code in it, this code is called HTML, In short, HTML code tells your web browser how to display and what to display on the web browser. It tells your web browser things like the size, font and colour of the text, where to find the images in the web page, where on the page the images must display and so on. (Note, that the images are not “in” this text file but rather a link to where the browser will find it on either the Internet or in the web servers file directory). A web browser thus “understand” HTML code and will generate the page you see in the web browser according to this code.

Here is an example of HTML in the code we will use soon:

webString=”<html><head><meta http-equiv=’refresh’ content=’3′> </head><body>Weight: “+String((float)value)+”kg</body></html>”;

This image below is what you will see in your web browser:

browser view plain

In short all web page code start with <html> and end with </hml> . We then have the <head> tag that gives your browser information like the name of the page and so on, in the example above we use the “refresh” tag that tells the web browser to reload the page, in this case, every 3 seconds. This is required because we want the web page to refresh by itself so it will display the weight of the scale when the weight changes. The <body> tag tells the browser what it should actually display in the browser window and the </body> tag tells the browser when the end is reached of what should be displayed.  In between the body tags we display the Weight from the scale in the browser.

If you spice up your HTML knowledge a bit you can make it look better. I added a picture and some other formatting to the code so it shows our logo.

webString=”<html><head><meta http-equiv=’refresh’ content=’3′> </head><style>body {background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style><body><img src=’https://www.botshop.co.za/wp-content/uploads/2017/03/logowebsite2.png’><br><b>Weight: “+String((float)value)+”kg</body></html>”;

Here is the result:

browser view formatted

Connect to the D1 web server

Once your server is running use your web browser to connect to the D1. In the URL field in your web browser type the IP address (see below on where to get it) of your web server and press Enter. In our code, we created an additional page called test. To get to it use your ipaddress/test e.g 192.168.0.1/test

Get your IP from serial monitor. We simply used the code below to get the IP address you should connect to and that will display in serial monitor for you to know what the IP is. You can also display it on the LCD display if you so wish.

Serial.print(“IP address: “); // displays ssid and IP on serial monitor and also IP on LCD
Serial.println(WiFi.localIP()); //

Code

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <HX711.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(0, 2, 4, 14, 12, 13); // WEMOS pins differ from UNO pins translated to uno would be (8, 9, 4, 5, 6, 7)

#define DOUT 16 // uno pin 2
#define CLK 5 // uno pin 3

float value;
String webString=””;
#define calibration_factor 21900 // Do Not change unless other load cells are used
HX711 scale(DOUT, CLK); // initialize load cell amplifire

const char* ssid = “*********”; // function as metioned in bellow comments
const char* password = “*******”; //

ESP8266WebServer server(80); // starts server on port 80

const int led = 13;

void handleRoot() { //
digitalWrite(led, 1); //
server.send(200, “text/plain”, “please enter correct page”);
digitalWrite(led, 0); //
char temp[400]; //
} //

void handleNotFound(){ //
digitalWrite(led, 1); //
String message = “File Not Found\n\n”; //
message += “URI: “; //
message += server.uri(); //
message += “\nMethod: “; //
message += (server.method() == HTTP_GET)?”GET”:”POST”; //
message += “\nArguments: “; // typical error 404/page not found
message += server.args(); //
message += “\n”; //
for (uint8_t i=0; i<server.args(); i++){ //
message += ” ” + server.argName(i) + “: ” + server.arg(i) + “\n”; //
} //
server.send(404, “text/plain”, message); //
digitalWrite(led, 0); //
} //

void setup(void){
pinMode(led, OUTPUT);
digitalWrite(led, 0);
Serial.begin(115200);
WiFi.begin(ssid, password);
lcd.begin(16, 2);
Serial.println(“”);
scale.set_scale(calibration_factor); // calibrate scale
scale.tare(); // zero scale
/*
while (WiFi.status() != WL_CONNECTED) { // I have disabled this to allow client to play with device,
delay(500); // What this does is it waits for the WiFi to be connected
Serial.print(“.”); // and while waiting it displays which ssid it is trying to
lcd.setCursor(0,0); // connect to I was thinking to add a script to show all
lcd.print(“Connecting to”); // available ssid’s so the client can select which one to use
lcd.setCursor(0,1); // using the keypad on lcd shield and also enter the password
lcd.print(ssid); //
} //
delay(750); // allows enough time to see that its connecting
*/
Serial.println(“”); //
Serial.print(“Connected to “); //
Serial.println(ssid); //
Serial.print(“IP address: “); // displays ssid and IP on serial monitor and also IP on LCD
Serial.println(WiFi.localIP()); //
lcd.setCursor(0,1); //
lcd.print(WiFi.localIP()); //

if (MDNS.begin(“esp8266”)) {
Serial.println(“MDNS responder started”);
}

server.on(“/”, handleRoot); //home page

server.on(“/test”, [](){        //enter IP followed by /test
char temp[400]; //to display scale value
value=scale.get_units(), 0; //
webString=”<html><head><meta http-equiv=’refresh’ content=’3′> </head><body>Weight: “+String((float)value)+”kg</body></html>”; //this line has an automatic refresh built in it is also the string to display the value
server.send(200, “text/html”, webString); //
}); //

server.onNotFound(handleNotFound); // 404 error

server.begin();
Serial.println(“HTTP server started”);
}

void loop(void){
server.handleClient(); // monitors user interaction on web
value=scale.get_units(), 0; //
lcd.setCursor(0,0); //displays scale vallue and ip on lcd
lcd.print(“Wheight: “); //
lcd.print(value); //
lcd.print(“kg”); //for some reason this jumps around alot
delay(1000); //
}

scaleCode text file

 

Scale project for Arduino and Wemos D1

Scale project for Arduino and Wemos D1

wemos d1 project

Scale project – Arduino and WiFi scale (see part 2 of this tutorial) from pallet wood

This scale project is built around the Arduino Uno and part 2 of this tutorial around the Wemos D1 development board. In its basic form, it will display the weight of an object on an LCD display and in the next tutorial in a web page using WiFi. This project can of cause be expanded even more to capture the weight in a database and so on. Here are lots to learn, from weight load cells all the way to Wifi with the D1 board that is cheaper than an Arduino Uno. We have a review  of the Wemos D1 here:

When doing an Arduino or Wmos D1 scale project there are a couple of things to know, The first is the development board itself, then the coding that can be done directly from an Arduino IDE and then some HTML coding to create the web page when doing the WiFi parts. If you are already coding Arduino projects you have very little learning to do on the coding of the Wemos D1 board.

 

The Wemos D1 board is designed to be similar than an Arduino Uno and you will immediately recognise the power headers and I/O header.

If you are not planning to use the scale as a wifi project the Arduino Uno will be just fine.

The D1 microcontroller is much more powerful than that of an Arduino

Saying that… you can easily build this scale using an Arduino Uno if you prefer.

One thing that stands out from the D1 is that it uses the very powerful ESP8266 chip that is a microcontroller and Wifi chip all in one. What’s even more impressive is that the microcontroller is much more powerful than an Arduino microcontroller with much more memory for your wifi projects.

Read this post first: Before you move on, read this blog post that has much more details about the Wemos D1 development board and how to set it up for the first time. https://www.botshop.co.za/wemos-d1-review-wifi-development-board/

Let’s look at the scale first.

To build a scale you need 3 parts: load cells, an amplifier and then a micro controller to interpret the results and display it somehow. The micro controller can be one of many, including a WeMos D1, ESP8266 controller, Arduino and Raspberry Pi.

load cell image

Load cells come in many different types and if you plan on working with them extensively you will need to read up on all the types available. In this tutorial, we use  50kg load cells that is one of the products we sell on our site here. You will need 4 load cells that you must place on the 4 corners of a solid base that will act as the weighing platform of your scale.

The 4 load cells can handle 50kg each so you will end up with a scale that can measure up to 200kg.

scale frame   load cell

It does not have to be fancy, we used a couple pieces of pallet wood to create the base as shown in above picture, then you need to drill big holes for the cells to fit, note the correct way to fit the cells in above picture.

The HX711 load cell amplifier

Load cells operate at very small voltage changes, therefore an amplifier will be required. We sell the HX711 Load Cell (Weight) Amplifier that works perfectly with the load cells.

Below is a diagram on connecting the cells to the amplifier. The diagram and code below are for an Arduino and in our next tutorial, we will show you how to connect it to a Wemos D1 to change your scale into an “Internet of things” project.

load cell amplifier

Below is the code to get it going for your Arduino. It will print the weight out in Serial monitor for now.

#include "HX711.h"

// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0

HX711 scale(A1, A0);

void setup() {
 Serial.begin(9600);
 Serial.println("HX711 Demo");

Serial.println("Before setting up the scale:");
 Serial.print("read: \t\t");
 Serial.println(scale.read());

Serial.print("read average: \t\t");
 Serial.println(scale.read_average(20));

Serial.print("get value: \t\t");
 Serial.println(scale.get_value(5));

Serial.print("get units: \t\t");
 Serial.println(scale.get_units(5), 1);

scale.set_scale(2280.f); 
 scale.tare();

Serial.println("After setting up the scale:");

Serial.print("read: \t\t");
 Serial.println(scale.read());

Serial.print("read average: \t\t");
 Serial.println(scale.read_average(20));

Serial.print("get value: \t\t");
 Serial.println(scale.get_value(5));

Serial.print("get units: \t\t");
 Serial.println(scale.get_units(5), 1); 
 Serial.println("Readings:");
}

void loop() {
 Serial.print("one reading:\t");
 Serial.print(scale.get_units(), 1);
 Serial.print("\t| average:\t");
 Serial.println(scale.get_units(10), 1);

scale.power_down(); 
 delay(5000);
 scale.power_up();
}

LCD screen

Next, you will need a display and here you have many choices. The easiest to use is the I2C LCD display. We also have a basic LCD display that is cheaper.

Whats the difference? The I2C LCD shield has an extra board connected to the normal LCD shield, turning it into an I2C device, that means it has much fewer wires to connect and it is much easier to program with. The little I2C board take away allot of the job the Uno had to do.

That concludes our scale project, our next tutorial will take this scale and change it into a wifi (internet of things) scale using the Wemos D1 board.

Part 2 of this project is here!

Wemos D1 review  Wifi development board

Wemos D1 review Wifi development board

ESP-12E WeMos D1 review

Wemos D1 review

This board has quickly become our board of choice when we do Wifi project development. It looks just like an Arduino Uno and many Arduino shields will work with this board. We sell them here at Bot Shop – https://www.botshop.co.za/product/esp-12e-wemos-d1-wifi-board/

We created a scale project using this board, you can read more about the project here:

We pulled in a weight from scale sensors but without much changes, you can do the same with any type of sensor.

The D1 microcontroller is a beast compared to the Arduino Uno

The WeMos D1 uses the ESP 8266 microcontroller that is 2 x faster than an Uno, has 160Kbs of Ram compared to the 2K of an Uno and a 100x  the amount of  Flash memory! And each I/O pin is interruptable!

Most importantly is that it has embedded Wi-Fi and the centre point of this wemos d1 review.

Microcontroller specs

• A 32 bit RISC CPU running at 80MHz
• 64Kb of instruction RAM and 96Kb of data RAM
• 4MB flash memory
• Wi-Fi
• 16 GPIO pins
• I2C,SPI
• I2S
• 1 ADC

The only area the Arduino chip is better is that it has 6 ADC’s and the D1 just one, although that will very seldom a problem as you have both I2C and SPI on the chip, it is still worth taking note of this. If you need more ADC’s it is easy to add a multiplexer to increase the amount of ADC’s.

Use your Arduino IDE to program the chip.

The Arduino IDE can be used to program the D1. The Wemos D1 have a USB to TTL chip on board for direct uploading of programs via USB directly from your PC. The chip used is the CH340G chip and unfortunately, a driver needs to be installed for some versions of Windows that does not include this driver. If your Windows version does not recognise the board it can easily be downloaded and installed, doing a Google search on “CH340G driver” will show many download links.

In this Wemos D1 review we do not want to go to much into details regarding programming but I have good links to follow, Also have a look at our scale project mentioned earlier in this review.

The next thing you will need to do is to add the Wemos D1 board to the list of boards already in the Arduino IDE. Here is an instructable on how to do that, it is pretty good http://www.instructables.com/id/Programming-the-WeMos-Using-Arduino-SoftwareIDE/

Oh, you will be able to upload to the board. To get the WiFi to work is not as difficult as I thought it will be, I used this instructable to do so: http://www.instructables.com/id/Programming-a-HTTP-Server-on-ESP-8266-12E/

Pin assignments

Something to note is that the pin assignment between the D1 and Uno is different. The Uno has the onboard led connected to pin 13 and the D1 to pin 14 as can be seen from the table below, If you, for example, upload the blink sketch to the D1 you will first need to change the sketch by replacing all calls to pin 13 to pin 14.

Wemos D1 pin assignments

Some things to be aware of.

  • As discussed the pinout differences, of cause the power pins are at the correct places.
  • Becuase of the pinouts some Arduino shields will not work out of the box, you will need to change the pin mappings. As an example, I had an LCD shield working in minutes without much effort.
  • The normal Arduino libraries will not always work, the LCD shield library worked with no problem though.

Wemos D1 review Summary.

Well, you can’t beat the price nor the ease of use. Microcontroller + Wifi for the same price as an Uno. I will always use my beloved Arduino Uno because of the amount of libraries and code available on the Internet but…. as soon as I need to use WiFi in my projects I will go for the Wemos D1 without a second thought. We also have a much smaller WiFI board for production here:

You can get yours from us here  https://www.botshop.co.za/product/esp-12e-wemos-d1-wifi-board/

 

Official Arduino Day 2017

Official Arduino Day 2017

Arduino day will be taking place on 1 April 2017, many haven’t even heard of it, so what is all the fuzz about.

What is Arduino Day?

Arduino Day is a worldwide birthday celebration of Arduino. It’s a 24 hour-long event – organized directly by the community, or by the Arduino founders – where people interested in Arduino get together, share their experiences, and learn more. whether you are newbies, makerspaces, hackerspaces, fablabs, associations, teachers, professionals, or any other user group Arduino day is for all who are fascinated by Arduino.

What will Arduino Day offer?

You can attend an event or organize one for your community. It doesn’t matter whether you are a Maker, an engineer, a designer, a developer or an educator: Arduino Day is open to anyone who wants to celebrate Arduino and all the amazing things that have been done (or can be done!) with the open-source platform. The events will offer different types of activities, tailored to local audiences all over the world.

Some projects from previous Arduino Days

What will we be doing for Arduino Day?

On Arduino Day we will be hosting an Arduino Beginner to Intermediate Training course for ages 10 and up! Have you subscribed to our newsletter? We will have an Arduino Day sale and will send details in our newsletter.

What you will learn on the training:

  • The internal working of Arduino.
  • Some key elements to programming.
  • Electronics around your program.
  • Four projects will be built excluding the bonus project.
  • Time will be given to chat to trainers in person.
  • trainers will be available if there is any confusion during the projects.

What you will need:

  • 5 LED’s
  • 5 resistors between 150E and 1k
  • 10k Potentiometer
  • Jumper cables
  • Arduino
  • Laptop

For those that do not have the components needed, we do have two options for you.

  1. When filling out the Registration form, select the number of small training kits.
  2. You could get our Monster Kit, also by selecting it on the registration form.

Please return filled out registration forms to kin@botshop.co.za