Αναζήτηση

Powered By Blogger

Jan 25, 2018

Internet connected power usage monitor

Internet connected power usage monitor:

Our homes are filling with energy hungry devices. Some of them are constantly active like fridge, routers, lighting, some switched off or on stand-by. Each of them takes some portion of energy that reflects on the end month bill. Some things you can control, but some not. So in order to hunt inefficient nodes you need some sort of energy usage monitoring.

You can find lots of implementations where some are simple indicators, other are advanced and web enabled.



RasPi_energy_monitor


TSalwach @ github.com have built his own version of energy monitoring system which looks really promising. His implementation monitors all three phases where he extracts several parameters:

RMS Voltages and currents on each phase

Apparent power (product of RMS voltage and RMS current)

Real (active) power

Reactive power with inductance/capacitance indication (time delay method *)

Power factor

Frequency (zero crossing detection with linear interpolation)

Energy

Tariff indication

Costs of energy and alternative cost (on single tariff)
He used two microcontroller boards to for this task. First one is Raspberry Pi which takes care of web accessibility, data storage and interpretation. The other is Nucleo board with STM32F072RB ARM microcontroller. This is a front end which collects data from AC sensing transformers.

Arduino based MPPT solar charger shield

Arduino based MPPT solar charger shield:

When you are harvesting solar or wind energy, you want to take most of it. For this you need efficient power converter which would take raw energy and convert it to proper voltage level for charging your batteries or powering electronics. Soldernerd have build an Arduino shield dedicated for charging lead acid battery. He used a solar panel with voltage output around 17V which had to be converted to 14V for lead battery.

arduino_solar_charger


This obviously required step down (buck) DC to DC converter which takes 17V – 18V from solar panel and converts it to 12V – 14V as efficient as possible. Microcontroller takes care of generating PWM signal which automatically adjusts to maintain output voltage level. Charger is capable to protect battery from overcharging when voltage of battery reaches 14V. Charger is capable to drive 30W power to the battery.

Troubleshooting your ESP8266

Troubleshooting your ESP8266:

ESP8266 module is a great wireless module with some processing power and I/Os. Especially if you are new to it you may find some things not clear enough or struggle while programming, uploading firmware or simply configuring. Rui Santos have written a troubleshooting guide on how to avoid those common obstacles. He talks about where to download NodeMCU flasher, how to configure its settings.



all_esp_modules_featured


Other most common pitfalls also are covered that might frustrate you. Even unbricking of FTDI programmer is covered. If you find yourself in desperate situation when trying to run ESP8266 this troubleshooting list may save you tons of time.

Wireless energy monitor using ESP8266 module

Wireless energy monitor using ESP8266 module:

Most of us are concern about energy usage. This helps to reduce bills, have a little impact on saving planet and be conscious about things you never thought being important. For the right task you need right tools. Brian Dorey have been successful on building energy metering. His previous Raspberry Pi based solar data logger gave him enough experience to move on with new idea of mains energy meter. This time he decided to use ESP8266 wireless module to do the main load. It has enough processing power to deal with sensor data also there are plenty of Arduino based libraries to make development easier.



energy_meter


His energy meter was designed to do three measurements: mains current, mains electric usage and gas usage. All three data streams had to be gathered in three different ways. First of all mains current. He used iSnail current sensor which simply outputs 0-5V for 0-100A current range. All he had to do is to read sensor output voltage with ADS1115 16-bit ADC from Texas Instruments. The data could be read using I2C interface.

He used clever method to detect mains energy usage. It turned out that installed meter has an LED which blinks every single Wh is used. By capturing LED blink with phototransistor he was able to collect and accumulate the value.

Third thing he wanted to do is to measure gas usage. Since there is no electricity flow the measurements had to be done in different way. His gas usage meter uses mechanical wheel with small magnet. So he used reed switch to capture wheel turns and this way accumulate gas usage.

Brian used FRAM memory chip to store accumulated values in case of power cut. For this he used FM24CL04B 4Kb FRAM from Cypress which can also be accessed via I2C interface. The second part of his meter was to send data using wireless transmission. For this purpose he used expanded the functionality of his Raspberry data logger to accept XML formatted data which then could be fed in to web server. If this project looks interesting, all project files are available on Github.

Setting up ESP8266 based DS18B20 sensor temperature monitoring with Emoncms

Setting up ESP8266 based DS18B20 sensor temperature monitoring with Emoncms:

If you are looking for ways of measuring and logging temperature data online, then you can try this one. Jhon_Control describes his setup in this instructable where uses ESP8266 module as microcontroller platform where DS18B20 probe is attached. As you may already know, ESP8266 has two programmable GPIO where one was used for reading temperature using 1-wire protocol.



The temperature data is sent via wireless interface, but additionally it can be read via serial interface where other debugging information is present. The other part of project is where temperature data goes. He has chosen OpenEnergyMonitor (Emoncms) – the web platform which can be freely installed on your local host computer and even Raspberry Pi. Here you can have nice representation of data including graphs, history, calculations, and other fancy stuff. You can start with single sensor, then expand to multiple and even join data from different sources and locations.

Control ESP8266 GPIOs with Android

Control ESP8266 GPIOs with Android:

ESP8266 is a great small WiFi module that carries a microcontroller which can be programmed to do basic IO controls. Having WiFi functionality gives number of possibilities to access module remotely where you can control things withing reach of your network coverage. Rui Santos suggests building a simple Android app which could be used as control panel to ESP module.



In his tutorial he goes through necessary steps of programing ESP8266 module with LUA script and so building Android application with MIT App Inventor. App Inventor is very easy to use and you are able to create simple applications within hour. The app building consist of GUI designed and visual code blocks (similar to scratch on Raspberry Pi). In his example he demonstrates how to control two LEDs from Android app. The code can be easily expanded for more functionality in necessary.

Monitoring three phase power usage with Arduino and keypad shield

Monitoring three phase power usage with Arduino and keypad shield:

This project is second iteration of DIY Life. Previously he has built a single phase power meter using similar technique. He wanted to keep things very simple, os he used only non-contact current measurement only by using Talema AC1030 current sensors on each phase line. They are capable of capturing 30A nominal and 75A maximum current. In order to measure power accurately a voltage measurements should be taken. But for sake of simplicity, voltage is only taken as 220V.



The only focus is to measure current correctly which depends on burden resistor selection and measurement drop voltage through Arduino analog input. Input current then must be calibrated with known load. Rough estimate can be made with 100W light bulb. If you are considering building this three phase power meter, be sure to simulate project on provided Autodesk Circuits simulator. Here you can tweak your circuit and test sketch code.

Tracker Applications For The Cell Phone

Tracker Applications For The Cell Phone:

The GPS phone tracking apps make it easy to keep in track of some essentials in life. It can be used to:

  • Find friends and family members: specially kids to get the directions to their exact locations.
  • Find your phone: The tracking app’s website can be checked to find a lost phone.
  • Stay connected: By just checking the GPS tracking map know your friends’ whereabouts.




The cell phone tracker app would do it all very easily. It is an easy to use app with the latest technologies which would help you to stay connected two people and devices in real time that matter the most. Let us talk about some tracker apps the features and how they would help.


  • mSpy

mSpy cell phone tracker is the best and number one rated app. It is the most favorite and trusted tracking app amongst the people around the globe which can be proven if you go through the reviews of this app. This application needs a special mention undoubtedly. It offers its customers many useful tracking features to monitor once it is installed. It is not detectable on the targeted device. The main features and functions that mSpy offers are keylogger.


  • Highster mobile

This app has found its rank on the top list because of its affordable prices as well as its features. This is one of the cheapest software that can be used to monitor and track other devices. It can work without a root or a jailbreak and can support lots of devices depending on your needs. It is easy to use Highster mobile with all the functions of this application. It is able to track SMS and MMS messages, pictures, videos calls, browsing history of social networking sites and many more things. It can also track phone theft. The Highster mobile application is able to work on iPhone and iPads with the iOS versions as well as on Android mobiles too.

Find the social media messages of Messenger, Skype, WhatsApp, Facebook etc

  • Wi-Fi network control
  • call blocking
  • data wipe and remote lock.
It is compatible on all Apple products as well as Android products. Its software has been rated the topmost when it comes to the compatibility to devices. It can be quickly and easily installed.

3) Flexispy

This app offers spilling the professional way. It is built with very powerful features and is supported to the Apple and Android devices as well as the Blackberry. The activities of the targeted phone can be tracked by using this Mobile Spy program easily. Its main features include reading SMS and MMS messages, GPS fine tracking, social media surfing, website and applications spying. There are many extra advanced features to this app which may need payment of extra money. It is one of the most expensive tracker app for the cell phones.

4) iKeyMonitor

This is a good middle ground choice in terms of its features and prices. It has a few added functions mainly we with a keylogger but does not have very advanced features. To easily track your loved ones this is a good choice. The core program of this app is keyloging to track the targeted phone. It is easily done with this app. It can track passwords, websites, emails, social media messages, notes etc. If your device is not rooted or jailbroken you may not be able to have access on some of its features. This app is supported and has compatibility to Apple as well as Android phones. This app supports 10 languages including Chinese and Japanese. You can take a 3 day trial for free.

4) PhoneSheriff

This tracker app is a popular tracker app amongst the parents. Though it does not run undetected on the targeted phone but yet it has been found to be very useful. There are two options available in this app- filtering and logging. Filtering feature provides you to block apps, websites, and receive alerts in your child’s phone. It also has an alarm time restriction and remote locking in case of theft. In the loging feature parents can access the Internet history, text messages, and photos and then there is the GPS tracking too. It is compatible for all Apple products but must be jailbroken along with Android and Blackberry products too.

When we compare all the tracking apps available in the market we can conclude that mSpy cell phone tracker app ranks on the top most. It is the most globally accepted and used tracking app and a favorite amongst all types of customers.

New Arduino IoT development board unveiled: MKRFOX1200

New Arduino IoT development board unveiled: MKRFOX1200:





This new IoT development board, which measures just 67 x 25mm in size, provides Makers with a low-cost solution for adding Sigfox connectivity to their DIY projects.

The MKRFOX1200 takes the functionality of the Zero, throws in Sigfox’s global LPWA network, and shrinks it down into a smaller form factor. Sharing a similar footprint as its fellow MKR products, this board features a Microchip SAM D21 32-bit Cortex-M0+ microcontroller at its core, along with an ATA8520 RF transmitter module. Impressively, the MKRFOX1200 is capable of running for over six months on a pair of standard AA 1.5V batteries.

The MKRFOX1200 is equipped with an attachable GSM antenna and can be programmed using the familiar Arduino IDE. But that’s not all. Those who purchase the board will also receive a two-year subscription to the Sigfox service, which includes full access to Sigfox’s messaging system, cloud platform, dashboard, webhooks, APIs, and more.

The first version of the MKRFOX1200 is compatible with Sigfox Radio Configuration Zone 1 (868MHz, 14dBm), meaning it is only supported in network-covered regions of Europe, the Middle East, and South Africa.

Sigfox anyway will operate in other new countries in the next few years.




Build an open source Laser Reflection Barrier

Build an open source Laser Reflection Barrier:







It allows us to detect the presence and passage of an object thanks to the combination of a laser diode which emits a light ray and a phototransistor which detects reflected light.



Robotics applications and industrial control systems normally make use of optical systems in order to detect proximity and passing of objects, taking advantage of light interruption or light reflection on a surface of the object to be detected. In this article, we want to show you the project of a laser barrier: however this is not an interruption-type barrier, which needs the object to be detected to pass through a meter and a photodetector, in fact, this is a reflection barrier: in our circuit, a laser projects a ray of focused and infinitely-collimated light and any object passing in front of it will reflect a portion of it, which will be intercepted by a lens on its way back and focused on the sensible surface of a photo-sensible component. In this barrier, therefore, the object to be detected doesn’t have to interrupt a ray of light but direct it towards a photodetector. One advantage of this type of device is that it doesn’t require the placing of a sensor at a distance, with the inevitable wiring required, in fact, it concentrates all the electronics needed in just one place and therefore it is ideal for mobile systems like wheeled robots or robots on tracks. Typical detection distance is 80 cm but he can reach a maximum of 1.5 m; everything depends on how dark and absorbent the object is, in other words, how much light does its surface reflects. The circuit, thanks to its nature, can be used in order to detect obstacles, as a unit counter on a conveyor belt, counter for people passing through a gate etc.









Circuit diagram

So, let’s take a look at the circuit, where we can see that it employs a laser as the transmitter and a phototransistor-based module (labeled H2) as the receiver. The beam emitted by the transmitter is reflected on the surface in front of it and it hits the lens (its purpose is to focus the reflected light on the phototransistor) of the emitted by the LASER and avoids disturbances from other light sources.

Laser diode is a small pointer (which is a component integrating a laser diode which is cooled by the dedicated casing, a voltage regulator, and a collimator lens) and it is labeled LASER in the diagram and is powered through the Q1 transistor (a BC817 mounted in common emitter configuration) which base is piloted by the 180 kHz rectangular signal locally produced by an oscillator; this is labeled H1 on the circuit diagram. For every high logic level coming to the 1-pin of the oscillator (2-pin being the 5 V power source of the oscillator module), the transistor goes in saturation and powers the laser diode, which emits a light impulse; during the process, the transistor is in interdiction and the laser diode is turned off. When on, its current is limited by Q1’s collector resistance (R5).









The light impulses are sent out frontally and when they hit an object with a surface capable of reflecting at least part of them, they come back to the circuit, where part of them hit the phototransistor’s lens that conveys them on the exposed junction; if the portion of reflected laser light reaching the phototransistor is sufficiently intense, the junction shows free charges (we are talking about electrodes, because transistor is an NPN, although for every electron moving out you also get an electron hole…) forming the base current, which is then amplified by the collector’s electric field, thanks to the 5 V power reaching the phototransistor’s collector from the 3-pin (ground – 1-pin – relates to the emitter’s resistance). The phototransistor makes the signal of its emitter available on 2-pin and the signal is sensible to infrared and visible light; it is in common collector configuration, so its collector is powered through contact 1 and contact 2 provides around zero volts with no light and about 4 V on the base when receiving light.

Q2 transistor, which is a BC817 also mounted in common collector configuration, is in saturation when on standby due to the pull-up resistor R7, which polarizes its base through R9; the condition is highlighted by the lighting of LED labeled DAT, which current is limited by R6 resistance. When the phototransistor is hit by a light of sufficient intensity, its collector drops from 5 V to a little less than 0.7 V, such voltage is not enough to keep the polarization of Q2’s base, which goes now in interdiction and its collector switches to high logic level. This line can be read by a microcontroller in order to detect the presence of an object; high logic level is 5 V and the low logic level is around 0 V, so the line can interface with logic systems operating at TTL levels. The DAT LED repeats the output status of the same name and inverts it, in fact when this one is on due to the phototransistor receiving light on its base (which means an object is present), the output is at low-level, while when there is no light detected, it turns off and DAT output goes to logic level 1.









Note that the choice to pilot the laser diode with a rectangular-shaped wave instead of a continuous signal comes from the necessity to make the sensor immune to lights and environmental disturbances, in fact, if the laser was constantly on, DAT would have (in case of light coming on the phototransistor right after the reflected) a voltage which may be influenced by environmental light, since the phototransistor could be constantly conducting if sufficiently lighted or hit by other light radiations falling within its sensibility spectrum. On the other hand, if we emit light impulses of a certain frequency we can use a receiver module with filter and have it receiving only those impulses, discarding continues light components. In fact, the H2 has an 180 kHz signal filter on its output (2-pin) which allows only signals produced by laser impulses pass.

The use of a bandpass filter on the circuit output discriminates signals, eliminating possible light impulses external to the detection system based on our circuit; besides, it relieves the possible microcontroller interfaced with DAT contact of such duty. Note that the high on-off frequency of the laser does not interfere with the detection since the impulses, although short, are infinitely longer than the short delay introduced by the reflected light hitting the phototransistor. The entire circuit is powered by a somewhat flexible voltage that can range from 2.5 V to 12 V thanks to an integrated switching regulator (labeled U1) which keeps its output to 5 V regardless of load conditions and the voltage on Vcc input compared to ground. Power voltage is filtered locally by the electrolytic capacitor C1. Switching is based on a PT301 integrated circuit, which is a high-efficiency step-up DC/DC compact, equipped with PWM Adaptive Current Mode regulation. Inside it we can find an error amplifier, a ramp generator and a voltage comparator to implement PWM modulation (it compares the ramp signal with the continuous component relegated on the FB pin by the resistive divider R1/R2 and filtered by the capacitor parallel to R1) in addition to a N-channel enhancement-mode MOSFET to pulse on the inductance and to extract PWM’s impulses and its respective driver stage. The internal MOSFET can commute currents up to 300 mA, so if you need to handle higher currents, you can use the auxiliary output (EXT pin) to pilot a higher powered external MOSFET; in this case the output corresponding to the internal MOSFET ‘s drain (LX pin) goes parallel to the external MOSFET’s. The particular thing about the integrated is that it can start up and function with voltages less than 1 V (0.8 V being the minimum) at its input, this makes it ideal for battery-powered applications; the integrated can provide 3.3 V and 100 mA when powered by an alkaline 1.5 V battery and 5 V with 300 mA when powered by a Li-ion cell (1s) or Lipo cell (3,7V). The extremely high efficiency (over 90%) is also guaranteed by the low ON-resistance of the MOSFET and the high commutation frequency of 500 kHz allows to scale down commutation and filter components, that is the L1 inductor and the C3 capacitor (C4 too actually, which is a residual filter at 500 kHz).









This switching functioning is as follows: after the start, through L1 inductance and D1 diode, the integrated receives current (5-pin, Vcc); C3 and C4 start to charge up and, right after that, the integrated starts functioning and its internal circuitry (i.e. the comparator) sends a positive impulse on the MOSFET’s gate causing a short-circuit (ON status) between its drain and its source and therefore all the current flows towards ground; during this interval, the integrated is powered by the voltage coming from C3 and C4.

In the meantime, the inductor charges up and right after that the MOSFET goes into interdiction, then the energy stored in L1 is discharged (since the inductance does not keep it but tends to keep the current right before MOSFET’s interdiction, thus generating an inverted extra voltage with positive polarity on the diode’ anode) through D1 diode, from which it passes on to Vcc, C3 and C4, then to the output of the DC/DC converter to power the % V line (The LED connected in series to R8 resistance signals the presence of output tension of the converter).

Based on the tension coming back on FB pin, the comparator sets the width of the next voltage impulse to send to the MOSFET’s gate, which closes once again the coil in short-circuit for a period that is as longer as the voltage detected by FB is lower (and vice versa) thus charging the inductance again. The cycle starts over as described and goes on till power is cut off.

The integrated continues working once powered up because the CE pin is directly connected to Vcc; if we connect it to ground, on the other hand, everything goes in standby; in this condition, the converter is down and absorbs just 14 µA.



From openstore

Laser sensor board


Controlling our simple CNC Miling Machine via USB

Controlling our simple CNC Miling Machine via USB:







Let’s print the PCBs by means of our CNC machine, that this time has been fitted with a controller that connects to a PC via USB, that draws the control signals and that regenerates timed pulses, simulating the parallel port.



In this post you had the chance to learn about and to evaluate our new CNC milling machine, equipped with a 9,000 rpm electro-spindle and with a compact PVC chassis, and available in assembly kit. This machine, that stands out for the excellent value for money (which is suitable for an amateur CNC machine) has been thought mainly for engraving plaques (such as those for the mailbox, the intercom, the door) and plastic elements (even in POMs, Delrin included). It is then surely possible to work with wood and, without overdoing it, it is possible to engrave (but at a low depth) aluminium plates. In this article we will show you how to use it, for the purpose of engraving printed circuit boards by means of an open source software and a refined hardware solution that enables the management via USB, from the PCs that do not have a parallel port.

As with most CNC machines, even ours is supplied with a 3-axes control board that is interfaced to the parallel board, so that it is possible to drive it by means of software of the Mach 3 kind, that converts the G-code into pulses that are directly produced on the parallel port. Since many desktop PCs and all the notebooks no longer have a parallel port, we thought to a solution that will be described in these pages, and that enables to directly drive it via USB, and therefore by means of all the modern computers. We created this specific board since – in order to manage the CNC machine via USB – it is not sufficient to use a traditional USB/parallel adapter; in fact, as the data would be sent on a virtual LPT and in serial form (since the USB is a serial) and then recomposed in parallel form with a certain delay or, worse, with unequal delays among the bits: this would bring to a situation with movements on the three axes that are not perfectly synchronized, and therefore to mistakes when manufacturing the workpiece.

On the other hand, our proposal is that of a hardware that – by starting from the USB and by taking advantage of the open source software – enables to reconstruct the command pulses for the CNC control board on the machine. It, therefore, enables to keep the original electronics and adds a device that is something more than a simple interface.









The system

In order to understand the usefulness of the interface, it must be said that – in common CNC machines that work on LPT port – the command is usually given by the manufacturing software (e.g.: Mach 3) that starts from the file in the G-code language and extracts the pulses and sends them directly on the lines of the parallel, so to make the corresponding axes advance for a certain number of steps/mm. In practice, Mach 3 executes the G-code and emits specific pulses for the motors, one for each parallel’s pin, and they are synchronized and temporally coherent among them.

If we tried to communicate via USB by means of an adapter, there could be – because of the latency – some synchronization problems among the pulses (since Mach 3 commands the motors via the parallel’s pins and the lines via drivers) and temporal coherence. It is therefore not recommended to use a USB/parallel adapter.

We worked around the problem and created something that is actually a converter subsystem of the commands sent by the CNC control software: a board that connects to the USB on a side while – on the other one – it connects to the 3-axes controller board’s parallel of the CNC machine, via a DB-25 connector. The board converts the received commands, it extracts them from the serial strings arriving on the USB and reconstructs the commands on a parallel connection, by reassigning them the right timings and the temporal coherence, by means of the pulses of all the command lines.

The reconstruction of the command pulses on the parallel – starting from the commands received on the USB – is carried out by an ATmega2560 microcontroller interfacing an USB/TTL converter. We loaded the grbl firmware on the microcontroller: thanks to that, our board receives the G-Code coordinates via USB, and locally generates the pulses on its own parallel, that drives the printer’s original controller. Because of the way the chosen firmware operates, we may not use Mach 3, but only a program that works on USB, such as grblControl, that sends data concerning the coordinates in the format read by our board.



Circuit diagram

Let’s take a look at the board’s circuit diagram, that revolves around the U1 microcontroller, that is to say, the same ATmega 2560 found in the Arduino Mega and Fishino Mega boards; at the start (after the power-on-reset), the microcontroller initializes the PE0 and PE1 lines (respectively as input and output for the data that has been exchanged on the USB, by means of the U3 converter), while PL0, PB6, PB5, PB4, PH4, PH5, PA7, PA6, PA5, PA4, PA3, PA2, PE4, PE5, PK0, PB7, PH3 are assigned to the parallel that has been “reconstructed”, with which to communicate with the CNC controller board. Given that it is a bidirectional parallel, some lines have been initialized as I/Os and other ones as outputs; more precisely, all the lines corresponding to EN, DIR, STEP, RL are outputs (since they send the command pulses to the drivers of the 3-axes board, that is to say, the controller board for our CNC machine), while LIM1, LIM2, LIM3 and LIM4 are outputs, since they are needed in order to read the possible limit switches that it is possible to apply to the machine.

In the following figure helps to understand which ones are the bidirectional I/O lines and which ones are the input lines (printer’s state signals).









On the other hand, the SS, PH0, PH1, PA1, PL3, PL4, PL5, PC0, PC2, PC4, PC6, PF2÷PF7 and AREF lines are actually free and available for possible future developments and evolutions concerning the firmware; we reported them on the CN1 and CN2 connectors for the purpose.

The PK1 line has been assigned to the FEEDH, while the PK2 has been assigned to the CY-ST: both have been initialized by the firmware as inputs, with the pull-up resistor assigned, and they are needed in order to manage the suspension of the cycle. In practice, it is needed to connect to it some normally open buttons that are connected to ground. By pressing the one that is connected to FEEDH the manufacturing is paused, in the sense that only the command series left in the microcontroller’s buffer is executed: after that, the system is paused, the stepper-motors are halted and it waits for a restart command. The bogie and the tool holder head are left in the position in which they were when executing the last command left in the buffer.

In order to restart the cycle, you will have to press the button connected to CY-ST, that works as a “restart” command: the machine’s control software – if fitted for the purpose of recognizing it – will receive and execute it, and so it will restart the data sending on the virtual parallel that is assigned to the USB.









On the other hand, ESTOP is initialized as an input (still with the internal pull-up resistor assigned), and it must be connected to a possible red STOP emergency button. In this case, when it is pressed, the relay output is disabled and the PWM SPIN one as well (for the purpose of stopping the electro-spindle), and our board communicates the stop to the program that is used for managing the CNC machine. The latter requires a manual restart of the manufacturing, that may be restarted from the beginning or from the point in which it was forcibly stopped (in the latter case, please make sure that the restart position is the correct one, otherwise the workpiece will come out poorly).

The ATmega’s PH6 line is initialized by the firmware as an output, with an internal PWM module assigned, and it is used in the case we wanted to directly control the rotation speed of the electro-spindle’s shaft: in fact, it emits pulses that control (they are conveniently buffered by the NOT U2 logic port and amplified in current by the NPN T3 transistor, that is mounted as a common emitter and used as a static switch) the T4 power MOSFET’s gate, at whose drain the PWM SPIN output for the electro-spindle commanding refers to (the electro-spindle should, therefore, be connected between the PWM SPIN output and the power supply’s output positive). In that case, it is needed to join the ground of the electro-spindle’s power supply with the board’s one, as close as possible to the MOSFET’s source, given that the latter operates as a static switch and that it commutes the PWM current pulses on the motor.

The output for the signal of the direction control has been assigned to the PE3 line. It is useful in the case you wanted to drive the electro-spindle’s motor by means of a MOSFET bridge, that enables the inversion of the current flow.

If you prefer the traditional control (the on/off one implemented by the actual 3-axes CNC controller board), the PH3 line drives the NPN T2 transistor, whose collector powers the usual relay with which the 48Vcc power supply’s line on the electro-spindle is commutated.









Please notice that in this project the control of the electro-spindle’s power relay does not occur by means of the output placed on the CNC’s 3-axes controller board, but it is “carried out” onboard, so that it is possible to implement even the proportional control via PWM.

As for the limit switches, we have to start with a small digression: the basic CNC does not have any limit switches, therefore the zeroing of the positions on the three axes (X, Y, Z) must be manually carried out, by ordering the control program to execute a given number of steps, until the position we consider to be the zero is reached. For each production, the machine starts from the current position of the tool holder head and the plate, since it gives the movement coordinates concerning it.



If you’d like to have some references, such as the one for the Home position, you will have to mount (in addition to the existing hardware) some lever microswitches, so that they may detect the said position, for each axis. The said microswitches must be fixed so that their lever is pressed when the corresponding sliding part in the mechanism is in such a position so to correspond to the home position. Please notice that on the grblControl’s user interface (that’s the software we will be using when managing the CNC machine) we have both the Machine coordinates and the Work coordinates: the first ones are those of the machine and they may be obtained via the limit switches or by zeroing the machine, after having manually brought the electro-spindle to the desired position and after having reset – by means of the dedicated buttons – the position. The second ones are on the other hand those corresponding to the ongoing production.

By means of the limit switches it is possible to define the maximum movement on each axis so that the moving parts do not exceed the maximum travel, and so to prevent pointless collisions.









The microcontroller may be locally reset by means of the P1 button, that acts on the /RST line (that is normally kept at high logical level by the R14 pull-up resistor), or remotely: two possibilities are contemplated, that is to say via USB by means of the specific command given from the computer and by means of the Arduino IDE, during the bootloader activation stage (in this case the USB/TTL converter’s DTR is brought to a low logical level and by means of C5 it supplies a negative reset pulse) or by means of the board’s RESET input, to which a clean contact must be applied, so that it closes the electrodes and sends the T1 transistor into saturation, so that the latter’s collector brings /RST to the logical zero. Please notice the Schottky diode, that is used to turn off the negative pulse that would occur at the ends of the R14, when the U3 converter’s DTR returns to a high logical level.  

Let’s continue with the analysis of the circuit diagram, and see the U3 USB/TTL converter, that is the typical FTDI FT232RL integrated circuit that converts the signals of the USB line in TTL (0/5V) format, and that deals with the due timings; it is an interface of the Device type and supports the USB 2.0 Full Speed communication. On the D+ and D- input lines there is D4, a dual, bidirectional Zener protection diode, that suppresses possible high voltage pulse noises that may be picked up by the USB cable: that is something we should not rule out if we are using the machine in an environment in which other tool machines are operating.  

As for the power source, the board draws from the USB +5V, by virtue of the quite limited absorption of the logic; clearly the USB powers the microcontroller and the LEDs, in addition to a minimum of discrete logic and transistors that are onboard. The USB port’s 5V reaches the power line through the D1 diode, that is used in order to protect the computer’s +5V line, in the case in which the in-circuit serial programming connector (ICSP) is disconnected, without the USB cable being disconnected from the computer. From the diode’s cathode the power – that is well filtered by C4 and C8 – goes through the further filtering of the L1 coil, that cleans it from possible noise pulses (along with C6, C7 and C4, C8, L1 forms a CLC pi filter), and through the microcontroller’s port.

The relay’s coil ( powered by 5V) is powered by the 5V coming from the USB, so to prevent that its commutation disturbs the microcontroller’s functioning.

During the normal functioning, the ATmega2560 microcontroller waits for the arrival of data strings from the USB (on the PE0 pin) and it unpacks them at their arrival, extracts the commands and puts them back together again in parallel form, according to the timings that are required by the 3-axes set board.









The grbl firmware

We explained that the installed firmware is grbl; since it is not compatible with Mach3, as for the CNC control software we had to choose one among the compatible solutions that we will describe in these pages, and in the next installment. Grbl is a firmware that was born for the purpose of parsing the G-code and for its conversion in commands on the three axes of a CNC machine. Therefore the G-code sends the coordinates for the movement on the three axes (for example, in order to trace a square we need 4 coordinates and therefore 4 commands: from a point to the second one, from the second one to the third one, from the third one to the fourth one and from the latter to the first one), according to this typical format:



G0 Xn Yn



In which G’ is the command imposing the movement at the highest speed allowed by the CNC (also known as Quick Movement) and X and Y are the coordinates, with n indicating the position to be reached on each of the specified axes . Similarly, a command defines where to bring the axes’ movement (endpoint) and the speed at which to do it: that’s G1, whose syntax is of the following kind:



G1 X7 Y18 F500



in which the F parameter is the movement speed, also known as Feed Rate, that in our machine corresponds to the number of steps per time unit that are carried out by the stepper motor.









In the case of commands imposing a linear movement, our machine converts the coordinates in the commands into steps to be given to the motor (also, keeping the microsteps in mind), so to carry out the movements required by the commands. Grbl has been created for the Arduino world and therefore it may be installed on boards that are based on Atmel’s ATmega microcontrollers, and that have preloaded the bootloader, by means of the same Arduino IDE. In our case, given that it is an open firmware, we customized it by modifying some parts, and especially those that define the structure of the CNC to which the controller board will be paired. The firmware may be downloaded from github.

The conversion of the G-code instructions

into commands that are directed to the motors for the axes’ activation follows certain rules and is carried out by following a certain logic; moreover, grbl supports some functioning modes and standard managements, such as those of the limit switches, of the emergency stop button, of the electro-tool’s adjustment speed, etc.

In Listing 1 you will see an important part of the firmware (the version we are using is the  GRBL9FMEGA2560), in which the machine’s operational parameters are defined.

Listing1

#ifdef DEFAULTS_FuturaElettronica
 
// Description: CNC2018 NEMA 17 stepper motors.
 
// www.futurashop.it/cnc
 
#define MICROSTEPS 8
 
#define STEPS_PER_REV 200.0
 
#define MM_PER_REV 1.25 // 1,25 mm/rev leadscrew
 
#define DEFAULT_X_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV)
 
#define DEFAULT_Y_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV)
 
#define DEFAULT_Z_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV)
 
#define DEFAULT_X_MAX_RATE 500.0 // mm/min
 
#define DEFAULT_Y_MAX_RATE 500.0 // mm/min
 
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
 
#define DEFAULT_X_ACCELERATION (100.0*60*60) // 100*60*60 mm/min^2 = 600 mm/sec^2
 
#define DEFAULT_Y_ACCELERATION (100.0*60*60) // 100*60*60 mm/min^2 = 600 mm/sec^2
 
#define DEFAULT_Z_ACCELERATION (100.0*60*60) // 100*60*60 mm/min^2 = 600 mm/sec^2
 
#define DEFAULT_X_MAX_TRAVEL 185.0 // mm
 
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
 
#define DEFAULT_Z_MAX_TRAVEL 60.0 // mm
 
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
 
#define DEFAULT_STEPPING_INVERT_MASK 0
 
#define DEFAULT_DIRECTION_INVERT_MASK 224 //((1<<Z_DIRECTION_BIT))
 
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)
 
#define DEFAULT_JUNCTION_DEVIATION 0.02 // mm
 
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
 
#define DEFAULT_DECIMAL_PLACES 3
 
#define DEFAULT_REPORT_INCHES 0 // false
 
#define DEFAULT_AUTO_START 1 // true
 
#define DEFAULT_INVERT_ST_ENABLE 1 // true
 
#define DEFAULT_INVERT_LIMIT_PINS 0 // false
 
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
 
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
 
#define DEFAULT_HOMING_ENABLE 0 // false
 
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
 
#define DEFAULT_HOMING_FEED_RATE 25.0 // mm/min
 
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
 
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
 
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
 
#endif
Among the parameters, we may notice MICROSTEPS, that indicates a possible reduction to the microstep mode (that must be exactly like that in the 3-axes controller board), STEPS PER REV (steps/rev for the motor at the corresponding axis), MM per REV, that is the distance on the axis per each revolution (1.25 is due to the fact that we are using M8 threaded rods, having a 1.25 mm pitch). The settings for the axes follow; in particular, please notice that the STEPS PER MM are the steps required for a 1 mm movement, that are obtained by means of the following calculation: step/rev x microstep/mm x mm/rev. MAX RATE is the linear speed, that depends on the frequency of the pulses driving the stepper motors, and it may be set between 500 and 6000 (we chose 500); that’s the maximum idle speed. The maximum speed when manufacturing on the other hand depends on the resisting force met by the electro-tool.

The section that enables to communicate the axes’ travel and the presence of possible limit switches to the machine is an interesting one: DEFAULT_X_MAX_TRAVEL indicates the  travel on the X axis (185 mm), DEFAULT_Y_MAX_TRAVEL indicates the travel on the Y axis (200 mm) and DEFAULT_Z_MAX_TRAVEL (60 mm) indicates the travel on the Z-axis (electrospindle). SOFT_LIMIT_ENABLE concerns the enabling of the firmware limits (at 0 they are disabled) while HARD_LIMIT_ENABLE enables the reading of the limit switches (it must have 1 as a value). HOMING_ENABLE enables (when set to 1) the automatic return to the HOME position.

Therefore, after having downloaded the software in the GRBL9FMEGA2560 version, you will have to edit it by means of the Arduino IDE and set the parameters as in the section shown in the Listing 1 , otherwise the machine will operate in an improper way (for example, the movement might exceed the acceptable one, with the risk to damage the mechanism).



As for the connections, please follow the figure, and remember that the power source of the electro-spindle’s power transformer has to enter through the V_SPIN clamps and exit through SPIN, and to respect the indicated polarity (therefore the external relay of the 3-axes controller board is no longer needed).  Af for the usage, you will have to connect the USB / parallel board’s USB socket (by means of a USB A/B cable), and the board’s DB-25 connector to the CNC 3-axes controller (by means of a male/female cable, having two DB-25 at the ends). If the electro-spindle’s power is commutated by the board’s relay, you will have to connect the power rectifier bridge’s positive and negative poles to the corresponding poles of the V_SPIN junction box, and the electrospindle’s wires to the SPIN’s + and -; please notice that, since they are clean contacts, it is actually possible to swap the places of the terminal boxes, that is to say that V_SPIN may be used in order to connect the motor and SPIN may be used in order to receive the 48Vcc power.









As regards the power source, please remember that the board described in this article does not require any power supply in order to operate: in fact, it draws the 5 volts needed from the computer, by means of the USB socket it is connected to. The electro-spindle’s power is simply commutated, but it does not reach the electronic parts.

The adapter board must be inserted in a dedicated plastic container. As for the latter, it is needed to create a window for the USB connector, another one for the DB-25 and another one for the passage of the wires for the electro-spindle and for the possible limit switches that you might have added to the basic CNC machine. It will be possible to fix the emergency stop button (to be connected to the dedicated input contacts) on the container, or close to the CNC (maybe in a box for external electrical systems, a watertight one).

The same goes for the reset button, that you will put on a side of the container, and for the possible pause button (FEEDH) and for the restart one (CY-ST).









Conclusions

Well, we are done, at least as regards the hardware. In the next installment we will show you how to use the interface/CNC whole, for the purpose of crafting printed circuit boards, and without printing anything, without photoengraving, felt pens, films, PCB development, and acid solutions. Here they are literally engraved, by means of a specific tool mounted in the electro-spindle.

As usual, we will start from a gerber file (that is the standard, nowadays, as for the industrial manufacturing of PCBs). The first thing to do is to acquire a CAM, a computer assisted design software, for the creation of elements and mechanical systems. In our case, we will explain how to work by means of FlatCam, that may be downloaded from Internet, at the following webpage: http://flatcam.org/. Once it has been downloaded and installed, please start the FlatCAM program. As for the CNC control software, let’s choose one among the ones that are compatible with our hardware and with the grbl firmware: there are many open source ones; among those offered by the market, we chose grblControl, whose usage will be described in depth in the next installment.

As for now, we will limit ourselves to analyze its main aspects, that is to say the installation and the elements that may be found in the work screen; in the next article, in which we will see how to use if for the printing, everything will be clearer.

The software is free to use and may be downloaded at the https://github.com/Denvi/Candle webpage, in the form of a compressed folder; by unpacking it, the grblControl folder will be obtained: inside of it, we will find the grblcontrol.exe executable file. By clicking on the corresponding icon, it is possible to start the program, whose work screen is the one shown in the figure.









In the central box you will find the workpiece’s design, while in the upper part of the screen there is the menu bar, including the File, Service and Help menus: for example, the first one enables to open and save the file on which you are working on, while the settings are found in the second one.

On the right, you will find the control panel, with the State section found in the upper part, the Control one found in the lower part,  and so on. State indicates the CNC machine’s condition (idle or working) while the Work coordinates and Machine coordinates indicate the coordinates at which the three axes are located: in the first case the ones concerning the work being executed are displayed, while the ones concerning the machine are displayed in the second case.

In the Control box, the commands for the manufacturing and the buttons (the two ones on the right) for zeroing the coordinates are gathered. There is also the Spindle box, in which it is possible – if the PWM speed control is activated on the board  – to modify the electro-spindle’s revs/min. The console box shows the commands being executed and enables the possibility to give them in G-code.



From openstore

CNC controller USB card

CNC mechanics – kit 200x180x60

Spindle motor 36 Vdc – 300 watt

set board 3 axes + accessories

Switching power supply Mean Well 24 Vdc 150 W

Bipolar stepper motor NEMA 17 – 1,5 A



Adafruit Has Announced Two New Products: Pysense and Pytrack Boards.

Adafruit Has Announced Two New Products: Pysense and Pytrack Boards.:





Adafruit has announced the arrival of a couple of new products to its ever-growing range of electronic components in the form of the PyCom Pytrack and Pysense.

The new Shields work with all PyCom boards including the LoPy and WiPy 2 and its add-on daughterboard that will make creating geo-tracking projects even easier, thanks to its GPS module, accelerometer and micro SD card slot.

The Pysense is an add-on daughterboard and environmental sensor equipped with:

  • Ambient light sensor
  • Barometric pressure sensor
  • Humidity sensor
  • 3 axis 12-bit accelerometer
  • Temperature sensor
  • USB port with serial access
  • LiPo battery charger
  • MicroSD card compatibility
  • Ultra low power operation (~1uA in deep sleep)~
The Pytrack is for those who need geo-tracking system. This board is equipped with:

  • Super accurate GNSS + Glonass GPS
  • 3 axis 12-bit accelerometer
  • USB port with serial access
  • LiPo battery charger
  • MicroSD card connector for storing datalogs
  • Ultra low power operation (~1uA in deep sleep)
Click here for more information on the new PyCom Pytrack And Pysense.






The 1sheeld Virtual People Counter

The 1sheeld Virtual People Counter:







A virtual shield and a smartphone, with the addition of ultrasound sensors that allow us to detect passage and direction of anyone crossing a passage.

Most of Arduino’s success is also due to the fact that the base features of this board can be expanded by simply adding shields, which are boards containing hardware that is specific for each application. The possibility to add new hardware on the existing base board also provides almost countless development options and encouraged the most important manufacturers of components and electronic devices to propose an innovative and interesting solution.

Do you want satellite localization? Add a shield with a GPS receiver! Do you want an application with a graphic display? All you have to do is add a shield with a GLCD (Graphic Liquid Crystal Display). Nowadays, for each function, there is a dedicated shield, which is commercially available in numerous options based on the manufacturer. In this scenario, the team of Integreight had an absolutely genius idea, thinking about the potential of interaction between an Arduino board and a recent smartphone.

Actually, many functions carried out by the shield are already present in a smartphone, which is well equipped in terms of built-in sensors; besides, it has a sophisticated communication section ranging from Bluetooth to 3G. Finally, in integrates a high-res display. Well, Integreight team thought that every feature of a smartphone could be represented on a shield for Arduino; all they had to do was establish a communication with Arduino and they were set. That’s where the idea for 1Sheeld came from, that is a unique Arduino shield that allows taking advantage of all the features of a smartphone; the pun is intended and it indicates that it’s just one single shield for many functionalities.









So, if we need satellite localizer in our project, instead of buying a specific shield, we can take advantage of the GPS receiver of the smartphone, and when we need a graphic display we can use the smartphone’s one. Naturally, communication sections and support for sending emails, SMS or excessive social networks is also available for our applications.

In total, Integreight was able to implement more than 40 virtualized shields with 1Sheeld; the complete list is available here.



1Sheeld is composed of two hardware blocks, one being the smartphone; the other one is a specific interface shield based on an Atmel ATmega162 microcontroller and a Bluetooth module that is simply used to allow our Arduino board to communicate with the smartphone. The biggest effort by the developers was to develop an application to run on the smartphone, trying to obtain a very user-friendly product that has at the same time the maximum operational flexibility possible to allow the user, with just a few taps on the display, to customize the desired interface. The Bluetooth shields interconnect Arduino to a smartphone, where the active application initializes and uses the sensors required, which act just like they are on Arduino and can be accessed anyways; this is remarkably convenient.









Unique shield and virtual hardware

Now, let’s take a more in-depth look at this product and how it can be employed, by also making use of the electric diagram illustrated in the previous pages. 1Sheeld is proposed as an absolutely standard shield for Arduino Uno/Arduino Mega. Its power voltage can manually be set to 3,3 V or 5 V through the POWER-SW deviator, which allows the shield to also function with 3.3 V boards, provided their pins are compatible with Arduino. Anyway, the shield’s logics also works with voltage picked by the deviator’s slider: when POWER-SW is 5 V, the U1 regulator takes the 3.3 V necessary for the Bluetooth module, which has to work at 3.3 V., The board uses a standard Bluetooth module (Bluetooth 2.1) labeled BT-HC06 in the electric diagram, allowing it to communicate with a smartphone up to around 10 m distance.









The Bluetooth module is normally reset through R7; using the Q1 MOSFETs, when the microcontroller puts its PE0 line to a logic level high, the RST terminal of the module goes low and reset is deactivated. The UART inside the Bluetooth module is interfaced with the virtual serial implemented in U2 by PB2 and PB3 I/Os and through two 74LVC1G125 buffers used as level adapters when the shield works at 5 V: in this case, in fact, PB3 line of the microcontroller provides TTL impulses that are adapted to 3.3 V by the IC1, while the module’s UTX provides 0/3,3V impulses which are then translated to 0/5V by the IC2.

1Sheeld communicates with the Arduino board using the internal UART module, therefore we want to be able to use the Serial Monitor feature of Arduino while it’s working. PIO1 line of the Bluetooth modules drives, through the R3 resistor, the BT-LED providing signals on connection activity.









In order to allow Arduino to be programmed by PC, the shield has the UART-SW deviator that allows excluding communication between Arduino’s UART and 1Sheeld. The LEDs labeled TXD and RXD (pins PA6 and PA7 of the micro U2) regulate the activity on the serial port.

On the board, there is also a reset button that replicates the functionality of the reset button on the Arduino board.

Now, let’s see how to activate this shield: first things first, we have to go on the reference website where we can find a section dedicated to tutorials and one dedicated to community projects. The first step is to download the Arduino library, that can be found under the Download page; we can also use the dedicated tool provided with the latest version of the Arduino’s IDE (version 1.6.7 or later) and go to sketch> library inclusion> library management and then select onesheeld and install it ; all the sketches in this post refer to version 1.8.0 of the library.









You can get to know the shields right from the start by trying out the numerals sketches already available in the examples.



OUR PROJECT

In this post, we propose instead a general utility application, a people counter. If you don’t know what this is, we can tell you it’s a system capable of detecting both the passage of people through an opening and the direction of said passage; this way we can have both a visual and acoustic indication of the passage and specifically count who goes in and who goes out in order to verify a possible difference and understand if someone is still inside a business establishment after working hours.

So, our application can be useful for the business owner in order to receive an acoustic signal on his or her smartphone to know if someone enters the shop when the owner is in the back; but it can also be a simple way to count people going in during a trade show or an event, everything on a device that we don’t always have to remember picking up or adding to our equipment because it’s always with us.

We have also designed a domestic application because we can also use our project to know if someone enters in a room or to know if your child has just trespassed a forbidden zone, the applications are really countless.

However you choose to employ it, the most interesting part of the project is that the information related to the passage of a person is directly provided on your smartphone, along with an indication of a number of people passed through and a vibration and acoustic modification.

We provided two options, one if you just want to know the number of people passing and one if you want to keep a record of people going in and out. So, let’s suppose there is a passage and we want to count people crossing it, we could’ve also used some photoelectric barriers and run the wires to the transmitter and the receiver from both side of the passage, on the other hand, in this project we wanted to use some simple (and cheap) ultrasound sensors capable of identifying the passage of people based on the distance measured.

As a sensor, we have used the affordable MISDIST04 which is an ultrasound meter with a 1 cm precision from a distance of a few meters. By placing this sensor on a door jamb facing the opposite door jamb, based on the measure provided by the sensor we will be able to evaluate if a person or an object has crossed the passage.



In the figure you can find the electrical wiring needed.



















As for powering the system, we recommend using a small switching, high performance 5 V output power supply and a type B USB email port compatible with Arduino. You can power Arduino also through its plug connector provided you use a power supply with a voltage between 7 and 12 V, better if it’s a switching power supply for higher performances, such as a 12 V switching power supply available in our store with code AL12V1A2.

The technique used for this application involves reading the measure provided by the sensor at set intervals and comparing it with the previous measure: if the measure provides a sensibly reduced value, it means that an object passed in front of the sensor. For better accuracy, we are going to discard all the measures considered unreliable, such as those less than 10 cm and over 150 cm; moreover, we are going to prevent successive readings for a prefixed period after deducting the crossing of one person.

The core code lines, in this case, are those setting the parameters described above, which are the working parameters of the sketch:

long maxDistance=150;

long triggerDistance=50;

long deadTime=1000;



Where maxDistance represents the maximum reliable measure, over that value the reading is discarded, while the triggerDistance parameter indicates the measure’s limited variation besides which we consider that a person certainly crossed the passage; deadTime parameter is inhibition time between one reading and the next one, which is useful in order to avoid that fluctuation in distance measured lead to errors when detecting the crossing of a person. The program section referred to counting passing people is listed here.

Listing1

inUS();
 
if ( currentDistance>10 && currentDistance < maxDistance)
 
{
 
if (previousDistance-currentDistance > triggerDistance && millis()-triggerTime > deadTime)
 
{
 
triggerTime=millis();
 
count++;
 
-> gestione 1sheeld <-
 
}
 
previousDistance=currentDistance;
 
}


The inUS() function is used in order to read distance measured by the sensor; correspondent value is then placed in the variable currentDistance. Only when the crossing of one person is detected, the variable count is incremented by one. During our tests, in order to display this value on the PC we used a virtual serial port implemented but they library softSerial which data were sent to the DC through a USB/serial converter; this because when 1Sheeld is active the UART module of Arduino cannot be used to communicate with the personal computer.



Now, let’s get to the more interesting part, how to integrate 1Sheeld’s features in this project. In order to make everything ready we have to work on the smartphone side and first of all we’re going to install the official 1Sheeld application directly from Google store on Android.



The app can also be downloaded from your web browser by visiting the page download where you can get the Android version and libraries.

Next, let’s activate the smartphone’s Bluetooth functionality (if it’s not already activated) and launch the app: first, the app will ask us to detect 1Sheeld (figure shows the research app for 1Sheeld devices via Bluetooth);









then we will have to connect (figure shows the screen once a connection is established).









Now we can choose the suitable virtual shields for our application:









since we want to see the tally on the smartphone’s display, we need an LCD Shield;









we also want an acoustic notification with each passage, so we are going to use a Buzzer Shield.









Next, we want to be able to manually reset the tally, so we can use a Button Shield ;









finally, we want to implement a light vibration, therefore we select the Vibration Shield.









In case we want to use the system in order to detect intrusions or unauthorized passages, we also have the chance to send a notification to the smartphone using a dedicated Notification Shield.









In Listing2 we report the code lines to include the 1Sheeld library and enable the functionalities requested. As suggested by the developers, it’s recommended to only enable (via the command #include) the shield you are going to use, in order to save energy. In Listing 1, under the voice “1Sheeld management” we are going to insert the program lines that allows to interact with the smartphone.

Listing2

#define CUSTOM_SETTINGS
 
#define INCLUDE_VIBRATION_
 
#define INCLUDE_LCD_
 
#define INCLUDE_BUZZER_
 
#define INCLUDE_PUSH_BUTTON_
 
#define INCLUDE_NOTIFICATION_
 
/* Include 1Sheeld library. */
 
#include <OneSheeld.h>


As you can see in Listing 3, the lines allowing to send data to the smartphone are really simple and basically are a call to the decide function.

Listing3

Buzzer.buzzOn();
 
Notification.notifyPhone(“Someone pass!”);
 
LCD.clear();
 
String stringOne = String(count, DEC);
 
String dataText = “Count= “ + stringOne;
 
char charBuf[16];
 
dataText.toCharArray(charBuf, 16);
 
LCD.print(charBuf);
 
delay(50);
 
Buzzer.buzzOff();
 
Vibration.start(1000);


In order to display the numeric value, however, we have to convert it into a char array; other than that, instructions are pretty intuitive.

Some functions can be omitted as needed, e.g. notification is useful only in case of occasional although important passages, however, it has the advantage to let us know the exact time when the crossing took place. The tally reset management is operated by the following code lines:

 if(PushButton.isPressed())
 

 
 {
 

 
   count=0;
 

 
   LCD.clear();   
 

 
   LCD.print(“Count= 0”);  
 

 
 }




As you can see, tally reset management takes place by reading the status of the button implemented in the smartphone.



LET’S GET TO WORK

Very well, now that we have established how the firmware works and how we can work from the app, let’s get to the core of the project: on the application main screen, all we have to do is tap on the icon on the left to include the shield in the project; by clicking on the shield icon in the top right corner we will start the communication with the shield and system will be operative: really simple and intuitive!

In the shield, the blue LED called BT-LED will go from blinking to steady to indicate that communication has been activated and the system is ready. You can select it by swiping the shield you want, passing from tally visualization to volume regulation for the buzzer, to a screen where you will find the button to reset the tally value.



DETECTING PASSAGE DIRECTION

For specific applications, we thought about a system variant that involves using two ultrasound sensors placed at a distance of around 25 cm one from the other. This way, upon the passage of a person one sensor, will be activated first and then the second one, and the sequence depends on the direction; this way, we can understand if the person is going in or out. In other words, the ultrasound sensors will detect an increase and a decrease of distance from the body of the person in sequence.









Taking figure as a reference, we can say that a person going in will first encounter sensor 1 and then sensor 2, vice versa the person will first encounter sensor 2 and then sensor 1 if they are going out. All we have to do is check both sensors and memorize which one provided the signal first, then wait for the signal from the second sensor in order to determine if the person is going in or out; the functioning principle is really similar to the one used by rotation encoders to determine rotation direction of a knob.









Of course, if the second reading doesn’t arrive within a prefixed time period, the system will decide that the person has not crossed the passage completely and therefore will not count them.









The sketch written for this variant of the system is called contapersone2US.ino and the visualization on Serial Monitor of debug data is available in the previous figure; the result on the smartphone’s display can be seen in the figure , showing us the representation of alphanumeric virtual display implemented by the LLC Shield.









In this last case, since we have implemented it, passage direction can also be indicated, meaning if the subject is going in or out; the tally will increase by one if the person is going in and will decrease by one if the person is going out.

By placing such a system at the entrance of a room we will be able to know the number of people inside, of course with some limitations which are due, for instance, to more people overlapping or disturbances of various nature due to clothes flapping in the air because of air gusts or strong ventilation in the room. In fact, the system cannot detect the simultaneous crossing of more people, in that if there is no space between the one in the front and the one in the back, only one passage will be detected.



Conclusion

We conclude here our analysis of 1Sheeld and a couple of applications made possible by it.

We think we managed to make you understand, in these pages, the potential and the features of the product, so much so that you can easily imagine what applications you can implemented by taking advantage of the numerous virtual shields you have at your disposal, especially those hard to implement with a classic hardware shield for Arduino, for instance the message sending through social networks (which would require a Wi-Fi shield and a lot more hardware) or vocal recognition. With 1Sheeld, on the other hand, you can immediately use a Voice Recognition Shield to identify vocal commands, or a Camera Shield to acquire and analyze video clips.









In conclusion, based on what we have explained, you can experiment by yourself on the possibilities offered by a solution portfolio containing over 40 virtual shields.

Enjoy!



From openstore

Switching power supply 12 V-1,2 A

Arduino Shield for Android smartphones

Ultrasonic range finder 2-450 cm