Skip navigation
1 2 Previous Next

DIY Test Equipment

21 posts
sherbieny

Raspberry PI - Ohmmeter

Posted by sherbieny Sep 23, 2017

An Ohmmeter device using Raspberry PI 2B with ADS1015 as ADC

 

https://github.com/Sherbieny/Ohmmeter-Pi

http://fritzing.org/projects/pi-ohmmeter

Setup

  • Items needed:
    • PC or Laptop
    • Raspberry Pi (I used model 2B)
    • ADS1015 12bit ADC converter (if you use 1115 which is 16bit, there will be slight changes)
      • Breadbord, wires, resistors
      • Adafruit assembled Pi T-Cobbler Plus - GPIO Breakout (Optional)
  • Circuit setup
    • Refer to fritzing diagrams in schematics folder
  • Configuration
    • SSH, VNC or anyother method of communication enabled between the Raspberry PI and the user PC
      • My case was
        • Laptop with Ubuntu 16.04 LTS
        • Raspberry PI 2B with Raspbian Jessie release 2017-01-11-raspbian-jessie.img
        • SSH communication through ethernet cable
  • Deployment instructions
    • As per the schematics folder
      • Connect Raspberry with Adafruit T-Cobbler
      • Connect T-Cobbler onto the breadboard
      • Connect ADS1015 onto the breadboard
      • Do the wirings as described in the schematics folder
      • In the circuit diagram I made a note about the location of the UNKNOWN resistor

https://github.com/Sherbieny/Ohmmeter-Pi#information-sourcesInformation Sources

https://github.com/Sherbieny/Ohmmeter-Pi#built-withBuilt With

  • VIM text editor
  • GCC compiler

I started this post as a Wifi Analyzer... but the more I got into it the more it became a complete handheld network analyzer for wireless as well as wired for performing basic network functions such as speed tests and pings, on up to measuring signal strength and identifying noise.

 

Here are the requirements:

 

  • Small form factor (hand held) not much larger than your palm (5 in. screen range), I'm thinking a strap across the back side of your hand
  • 4 hour minimum rechargeable battery
  • Touch screen
  • measure dBm/SnR and log/graph over time appropriately
  • function for measuring attenuation
  • Channel identification
  • Googleing I found a couple of build guides for more inspiration - A complete network analysis tool for the Pi (NetPi) and a spectrum analyzer from Adafruit
  • It would also be cool to bring in a floor plan and plot your measurements on the floor plan as a baseline for future testing
  • Need access to wired NIC for using network analysis tools from data-center or data closets

 

 

Sounds like a Pi 3 (how to handle 5Ghz? usb wifi dongle? need external antenna? gig Ethernet NIC dongle? maybe someone knows of a better solution than the Pi?) and a 5 in touch screen, a touch interface GUI as launcher for multiple software packages, LiPo or Li-Ion and charging circuit, 3d printed ergo palm enclosure (see into my brain below). 

 

What you think? Suggestions, ways to expand?

Image result for palm strap ipad

Hi i resently got an idea after learning about freenas interface web based I learned that freenas lets you to turn off your computer form the web so i was thinking is it possible to turn the comouter on by the web interface so i tryed to solve this problum.

and i was woundering is it possible to have the raspberry turn on my computer by web interface system useing the pins that it had i am well ware of that i could not do this by raspberry ip and a computer i would need a modual to try this out.

 

I just wanted to share this idea with you guys and hope that you could make a video about it. ps sry for the bad english and grammer.

 

Thank you for reading this.

in the office building I work we have DIY addressable led strips surrounding every floor of the building to make it glow at night. It's a part of my job to maintain this setup and unfortunately the setup breaks down a lot.

 

We we got a defect then I have to open up the sealing and get the 3m long led bar out and take it to the warehouse to test the led strip. I have already bought a wireless soldering iron so I can do small repairs without taking the led strip out of the sealing, but I still need to get it out if I want to connect it to the test unit.

 

It would really be great if I would have sort of a portable addressable led strip tester, that can run the following tests

- put all led's to red

- put all led's to green

- put all led's to blue

- put all led's to white

- slow nightrider mode 1 led at a time

- put all led's to black (off)

 

this would save me a lot of time and I guess it would be a great tool for everyone that uses addressable led strips in there projects

I'm trying to figure out a way to make such tester, but the main problem I have is how to deliver enough power for the 3 meter long led strip?

How about building a Raspberry Pi universal multimeter and oscilloscope. You could use the bitscope mod and if you can create a application you can make a multimeter app to measure voltage, resistance and current (Or even a LCR function)

This is my submission to the Element14 Project14 DIY

 

The problem

I have recently been doing extensive experimentation with recycled batteries as well as voltage regulators and line control circuits. The customary approach requires a programmable DC load to the connected such that the output can be tested under various conditions. Unfortunately, these commercial solutions are quite expensive in addition to being big and bulky. Due to a constant fear of the spouse with regards to unexplained expenditures as well as a lack of bench space, I set out to find a DIY solution to the problem.

 

The result is a simple yet elegant project that can be assembled in a manner of hours and is useful for all electronic hobbyists and professionals alike. Due to a reduction in size and very low BOM cost, the device can be used for field testing of a number of equipment as well. In the writing below, I will try to explain the research process, accepted approach, assembly as well as a quick demo of the project.

 

The search

Doing a google search for ‘constant current source’ comes up with a number of interesting results including publications in instructables. Though these may not inspire much confidence, they are a source of test data that an approach was in fact used. My search lead me to a youtube video by Dave Jones of the EEVBlog where he uses a simple circuit to make a DIY Constant Current Load. Further investigation revealed that many more had tried the approach and indeed was a usable. Hence, I decided to recreate the circuit shown below due to it’s simplicity.

 

setup.PNG

 

 

The tweaks

The selected low-side sensing and control approach was solid however, I had to improvise a bit in my approach with the first change being the MOSFET itself. The MTP3055 was not something I had to hand so I decided to use the IRFZ44N. This had a cascading effect on the design with the Vcc being migrated to 9V and eventually two 9V cells. I used the LM358 which is half the op-amp the LM324 is however retains all the characteristics. Lastly I only had 1/4watt resistors which I had to make do with but did not make a big difference in the long run. I also did not want to spend on a dedicated meter hence resorted to other means. The final improvisation in the assembly is the use of a multi turn preset in place of the suggested multi turn pot which is cheaper and more compact.

 

The Circuit Diagram

Below is a shot of my notebook with the circuit diagram, specs and a layout. I used separate connectors for the Op-Amp supply and the load. In order to monitor the set current, tapped into the non-inverting input of the second op-amp. This connected to a multimeter would give us the set current without the need for a dedicated meter thus reducing the BOM cost of the project. An extension of this technique could tap into the inverting input to get the value of actual current being drawn. In my case, I employ a dedicated meter for the task to ensure accuracy.

 

img_20170902_183541.989.png

 

 

Adding a fuse or switch seemed trivial though can be a useful feature. I do not plan to make a PCB for this since it is a stepping stone to the next level which I will discuss at the end. I made a layout of the design before I switched on the soldering iron so that I knew exactly what I would be aiming for. I aimed to made the device as small as possible and in true DIY fashion.

 

The Assembly

Putting humpty-dumpty together was not a challenge thanks to a bit of planning and the end result is presented in the image below.

 

img_20170901_212216_773.jpg

 

With my 3D printer lacking the necessary filament, I decided to add some DIY stand offs to the resulting circuit board. Pencil erasers cut up in the right size and attached using hot glue were a successful endeavour allowing for a bit of ground clearance. This would be helpful in case of solder blobs or unsheathed wire trims were loose on the workbench. The heatsink was a non branded one though it did seemed big enough and did it’s job well. The end result is shown below without it’s connectors as well as in complete setup.

 

img_20170902_142848536.jpg

 

 

Testing

My tests were conducted with a Tenma Bench Power supply at 12 Volts though I did do the math before hand. Below is a capture of my workbook reflecting the same.

img_20170902_183853.636.png

 

Sincethe IRFZ44N is capable of working up to 175’C and 50Watts, my tests would be a piece of cake. Below is a video of the entire project along with a demo of the final product.

 

 

One point to be noted is that at 1 Amp of current, the drop on Rsense would be 1 Volt and with the Vgs required to be more than 10V for the IRFZ44N and 4.5V for the MTP3055, the gate voltage should be as high as possible. This would also go on to effect the switching times with the Vgs rise time not being able to meet it’s intended mark.

 

 

More Notes and future work

I designed this module to work as a standalone project however there are a number of things that can be done in the future. The first being the addition of an Totem-Pole Driver stage to the MOSFET to increase switching speed. This is easier said than done however it addresses the issue raised in the previous section.

 

The second modification is using a DAC to digitally control the set current. The buffer could be converted into a gain stage and it could be digitally controlled. Next would be the addition of an ADC to monitor the actual current flowing. An INA219 could be used directly if the circuit were to be made anew and on a dedicated PCB.

 

Lastly, a self resetting fuse and temperature sensor could be a handy feature for long term use. A DS1307 could be used for the RTC and store current and voltage data until it is retrieved. This could be furthered by the addition of a memory card hence the possibilities are endless.

 

 

peteroakes jancumps and jw0752 already have an extensive project in the making for the more serious user. This is a quick and dirty solution for the procrastinating maker and enthusiasts and I hope it finds use in your hobby shop.

 

 

Happy Hacking!

popupideas

Elevator test unit

Posted by popupideas Aug 27, 2017

one diy test unit I want to build is a g-force accelerometer tested for elevators. Prefer a Bluetooth enabled box you put inside an elevator that when it is sent up it will record the travel speed, acceleration, start and stoppong force. It bit I had issues figuring out was vertical speed.

Anyway. I am a loooong way off but maybe one day

hlipka

Multi-Ref Mk. II

Posted by hlipka Aug 22, 2017

The Multi-Ref is not a test device as such, but the tool I use to test my test equipment. I got the idea for this from the user [matseng] as the Dangerousprototypes.com forum, and found it very useful.

MrRef, as it was called, is just two coin cells powering a precision voltage reference. The intention is to allow checking your own multimeters for accuracy and drift. Not everybody has a 6.5 or better DMM at home, with a accuracy of 0.01% or even better. Back then my best DMM was a TekPower TP4000ZC, 4000 counts and 0.5% accuracy at the best, anything else was just cheap 3.5 digit DMMs, some of them more than 15 years old (but I got a UT61E shortly afterwards which claims 0.1% accuracy). So it was interesting to see how accurate the meters still are. This is something important - you want to know that you can still trust the stuff you measure.

So I built a small MrRef by myself, using REF5020 from TI. This is a low noise precision reference with 2.048V output. Its 0.05% accuracy result in at most 1mV error - one digit basically. But this value creates a problem: its too high to properly check a 2000 count DMM since these go only up to 2.0V.

REF5020 reference

So when I got my UT61E (two actually) I decided that I needed more than one reference voltage. The best would be to cover the range from 1 up to 10V so you can test at least two ranges and also see how good the linearity is. In the end I selected mostly references from Intersil since they came with the highest initial accuracy. I have no way to go to a calibration lab to get the actual reference values so I need to rely on the manufacturer. here is what I selected:

ReferenceVoltageInitial Accuracy
Drift (ppm/°C)
REF102CUREF102CU10V0.025% / 2.5mV2.5
ISL21009BFB8505V0.01% / 0.5mV3
ISL21009BFB8252.5V0.02% / 0.5mV2
ADR4520B2.048V0.02% / 0.4mV2
ISL21090BFB812Z1.25V0.03% / 0.375mV7

Together these did cost about $30, depending on where you get them. The best one is 10 times as accurate as the UT61E and the worst one still three times. I deemed this good enough to check how accurate my meters are and how much they drift over time.

I put all of the references on a small PCB, together with some 78xx regulators so the references don't need to dissipate so much power and heat up. Everything was powered from a 9V AC supply (whose voltage was doubled).

DSC03584.jpg

The PCB itself was designed to be generic so I can use other references. Most of them follow a common SO8 footprint, and just differ in whether they need input and output capacitors, and sometimes an optional capacitor.

DSC03585.jpg

(The resistors in the middle look a little bit funny - I forgot that the 78xx regulators need some minimal load so I needed to add them. You can see the free footprints for the capacitors, and how they are populated differently for the different references. Whats not to be seen here is that I also have a DPDT switch so I can easily switch polarities to the multimeter so I can test both positive and negative ranges.

Later on I also bought some precision resistors (with 0.01%, and I also some older ones with 0.1%) to test the resistance ranges. I also used them to manually check the current ranges. The most difficult range to test are capacitances - the best you can get are 1% foil capacitors. They easily cost 1 up to 4 dollars each, depending on the capacity. I ended up with a 1nF and a 4.7nF 2.5% capacitor.

Mk II

Since I have everything to test my meters, why a second version? Well, there are two reasons.

The first one is that I killed the REF102C by accidentally connecting the 9V AC power supply to its output. It didn't like that. I made the big mistake to have all connectors look the same, and AC in and 10V out are just on opposite corners of the board. Its actually surprising that it took me several year to make this mistake. So I replaced the chip, and looked for a way to prevent that in the future.

The second reason is that everything is fiddly. You have the flying DPDT switch, need to place the pin header on a separate output for each voltage (in the correct position). The resistors and capacitors are not mounted to anything but I just kept them in a bag. And the power supply was also in a bag together with the PCB and the caps and resistors.

So my second version was not about a redesign, but about making a real project out of it: place everything in a proper case, with a proper range selection switch and just a pair of binding posts. And since there was some room to spare, I added a precision current reference to.

For the latter one one I used the design from the Scullcom video blog - its easy to build and quite accurate. I wanted to build it since I saw it for the first time but never came around.

For the voltages, resistors and capacitors I found an old 2x24 rotary switch - unfortunately the current reference needs  a three-pole switch so I put it on an separate pair of binding posts. Time to start wiring everything:

DSC07835.JPG

The REF200 current source is just on that small SOIC8 breakout board, attached with magnet wire to the range switch. On the large switch I already added the wires for changing the polarity of the voltages.

Then I mounted the existing PCB and the 9V transformer 8without its case) to a small acrylic plate which is then mounted in the enclosure:

DSC07837.JPG

The current reference is powered from the existing 9V regulator so I don't need an additional battery. The resistors and capacitors go to a separate board, wrapped in heat shrink tube. One of the resistors (the 100k one) is on the bottom side since its a SMD one.

If you count very closely you can see that there are too many wires. This is due to a small trick: I added one pair of wires for the capacitors, which I left open. And another wire for the resistors which gets shorted to the common wire. These additional wires end up in a '0nF' and '0 ohm' selection, which can be used to zero out any capacitance and resistance in the measurement wires. Since they are of the same length and placement as the regular wiring this relative measurement is hopefully quite accurate.

DSC07840.JPG

Everything wired up:

DSC07842.JPG

The front plate was designed in Draftsight (a free CAD program for Linux, Mac and Windows). I printed it on paper, glued it to the plastic front plate and them covered it with self-adhesive foil:

DSC07844.JPG

I found a nice trick to get the lines for the scales all in the right place:

  • draw two circles, centered on the hole for the rotary switch, which mark the inner and outer end of where the lines should be
  • then create points to split the circles in segments (Draw / Points / Segment - select a circle and it gets marked)
  • configure Draftsight so points get a large cross (to see them on the drawing)
  • Use the "Element Snap" function to snap start and end points of each line to the correct segment points
  • afterwards, delete the circles and the points, and you have just the scale lines left

I think it ended up quite well. No need to fiddle with wire grabbers, re-positioning connectors and looking for parts in a small box:

DSC07845.JPG

Introduction

Current measurement can be really awkward when working with circuits. Voltage measurements are (usually) straightforward, but when it comes to current measurements the story is different. One typical approach is to insert a known resistance by breaking the circuit, and then measuring the voltage across it. This is difficult if one end of the resistor is not at ground potential, because oscilloscope probes are (usually) designed with the ground leads all connected together, and it will damage things if the grounds of different channels on the oscilloscope are connected to different parts of the circuit.

 

This project describes a very sensitive home-made current probe that doesn’t require a known resistance to be inserted. It has not been fully characterized but the initial results are reasonably promising. It was tested at currents of the order of single-digit microamps up to 10mA (it can be assembled for higher current ranges if desired), and it functions from DC to around 20kHz, and is fully isolated.

drv425evm.jpg

 

It is based around a very exotic magnetic field sensor known as a fluxgate magnetometer. Ordinarily this is quite difficult to build due to the requirement for hard-to-find mu-metal and a mix of analog and digital electronics. However, Texas Instruments offers an entire fluxgate magnetometer-on-a-chipfluxgate magnetometer-on-a-chip and an evaluation boardevaluation board. With some effort it is possible to build a current sensor or probe with it. It makes a handy test tool for measuring current in a circuit, in a less intrusive way than normal.

 

What is a Fluxgate Magnetometer?

There are several ways to make magnetic field sensors, and the fluxgate magnetometer offers very impressive sensitivity. There are slightly different topologies of fluxgate magnetometers, but in a nutshell they consist of windings around a core. If we use a Lego wheel tyre to act as a pretend core then ‘Excitation’ and ‘Sense’ windings can be placed around it as shown in the photo (the windings are the yellow and green wires in the photo).

fluxgate-lego-annotated.jpg

 

If we consider the core to look like two semi-circular half cores each with half of the excitation winding on it then an AC signal of sufficient power is applied such that each half-core reaches saturation (i.e. the magnetic field cannot increase any further) in both directions alternately as the AC signal changes direction.

 

The other coil, the green sense coil, is wound around the outside like a wrapper to the entire thing. When the core is in saturation the magnetic field does not change, and therefore there is no voltage across the sense winding. In other words, a changing magnetic field is needed to induce a voltage in the sense winding. The clever bit occurs when there is an additional magnetic field present (either created locally with another winding, or any existing nearby magnetic field as shown in blue in the photo above). Because the two half cores have their excitation windings in opposite directions, ordinarily the magnetic fields cancel out. But in the presence of a magnetic field, when the AC excitation signal direction changes, one half core will exit out of saturation slightly sooner than the other half core, or slightly later than the other half core, depending on the direction of the additional magnetic field. When this occurs, there is no balancing out of the magnetic fields! And since the magnetic field is no longer zero, during this time that the field is changing, a signal is generated in the sense winding. It is an easy-to-detect signal because the asymmetry caused harmonics of the excitation signal frequency, and it can be detected using analog electronics.

 

The basic design can be modified by having yet another winding known as the Compensation coil and an amplifier to drive it such that it nulls out the external magnetic field. The output of the compensation coil therefore becomes the output of the fluxgate magnetometer.

 

Fluxgate magnetometers have exceptional sensitivity and can detect the earth’s magnetic field. Texas Instrument has several ICs that contain all the signal generation and signal processing required to construct a fluxgate magnetometer. There is also one IC in the range which even integrates the core inside the package. I decided to use that IC for this project. All I needed to worry about was how to generate the external magnetic field, and that is possible with an external winding.

 

The diagram here from TI’s website shows the internals of the IC. All of this is integrated into a tiny square 4x4mm package.

drv425-block-diag-c.png

 

Why build a Current Sensor? What is a Current Sensor? What types are there?

The voltage across two points is easy to measure with a voltmeter/multimeter. If the voltage is changing over time then an oscilloscope can be used too.

 

The current through a wire is harder to measure; it often entails breaking the wire and attaching an ammeter/multimeter set to measure current. If the current is changing over time then one way to observe this is to insert a fixed value resistor in series with the wire, so that a potential difference (voltage) is created across the resistor. The voltage will be directly proportional to the current flowing through the resistor, and so then the problem has been reduced to one of observing a voltage which is easy to do with an oscilloscope. However, by adding a resistor the circuit has been modified slightly. To minimise this, the resistor is usually chosen to have a very low value. But if the value is too low then the measured voltage will be very low too.

 

Another issue is that sometimes it is desirable to have a way of measuring current with isolation; this is especially necessary if it is desired to measure current through different parts of the circuit simultaneously using an oscilloscope (the probe ground connections are all connected together and to ground usually).

 

So, resistors as current sensors can have limitations. Another type of current sensor looks very much like a transformer. It can work very well but usually just for AC signals; a DC component is not detected because there is no change of flux and therefore no voltage induced in the secondary coil.

 

Yet another type of current sensor is based around a hall effect sensor which detects magnetic fields. It functions from DC to tens or hundreds of kHz. It is primarily used for measuring currents in the tens or hundreds of milliamps and upwards.

 

Like the hall effect based sensor. a fluxgate magnetometer has the capability to allow the creation of sensors for both AC and DC signals because it measures the magnetic field, not an induced current like a transformer does. Unlike a hall effect sensor, it can be extremely sensitive.

 

It is possible to purchase current probes for oscilloscopes that are based on the fluxgate magnetometer principle but they cost thousands of pounds/dollars. This project uses a similar principle but only works to a low frequency range of about DC to 30kHz. This could be useful for examining dynamic current consumption of parts of circuitry. It is no useful for examining many modern DC-DC converter circuits however because they operate at very high frequencies nowadays.

 

This project doesn’t really compare to a commercial current probe for an oscilloscope, because they will function to tens or hundreds of megahertz.

However, this project is far cheaper and still offers some benefits. It has isolation just like a commercial probe. The other main advantage is the very high sensitivity (around 800 volts per amp sensitivity with a simple circuit).

 

Building the Sensor

As mentioned the fluxgate magnetometer resides on a single chip, so there is no work to do there. It is in a 4x4mm surface mount package (QFN) which is awkward to work with however an evaluation board is available with it pre-soldered. I used that.

 

To construct the magnetic field, I used a ferrite core; some experimentation here could be useful, I used Amidon FT-50-43 in my tests but others could be used too. Several will need to be purchased because it is almost inevitable that they will be damaged at the next step, the yield is very low. A slot was cut into the core, so that the 4mm fluxgate magnetometer could be a snug fit. With hindsight I didn’t need to cut all the way into the core, just the thickness of the IC would have been sufficient. Anyway, attempting to cut or file the core will almost certainly result in it breaking apart unless lots of care is taken. I couldn’t find a perfect strategy, but 3D printer owners could construct a jig to precisely hold the core during the cutting operation.

 

Enamelled wire was wound around the core; I picked 40 turns as a ballpark to experiment at, and 0.2mm diameter wire fitted well. A bit of glue can secure the ends from unravelling. The resistance of the coil is about 0.4 ohms, but with slightly thicker wire (which would fit) the resistance can be reduced. 0.3mm diameter wire would halve the resistance for example.

ferrite-and-winding.jpg

 

Next, it needs to be secured to the fluxgate magnetometer board. Since I wanted to experiment, I just used blu-tack (temporary putty) for now instead of a permanent glue. Although it looks like it might function poorly with such a trivial attachment, the result is very stable. The measured current does not fluctuate.

core-on-sensor.jpg

 

Initial Tests

In use, the circuit would be broken at the point where the current needs to be measured, and the ends of the wound coil would be attached into the circuit. For the tests below, it was decided to use a resistor and a signal generator as the circuit under test. The circuit was broken and the current sensor was inserted in. The output of the current sensor went to an oscilloscope. I borrowed an oscilloscope from work for this, it needed the big gun Tektronix MDO3000 so that I could use some advanced math features and waveform processing capabilities to make my life easier.

 

So, this was the topology:

test-topology-a.png

 

Although there was no need to connect the signal source to the oscilloscope, it was connected to measure the voltage across the input resistor, to determine how much current was flowing through the current sensor input. For all the traces below, the important trace is the yellow trace which is the output from the current sensor. The blue input trace is just a reference to see what the input signal looked like. For these initial tests, even though the current sensor responds to DC, the oscilloscope was set to AC input because the output has an approximate 2.5V offset. The oscilloscope bandwidth was set to 20MHz for these tests.

 

All measurements are approximate, since this was just an experimental circuit.

 

100Hz, 1mA RMS Input current

As an initial test, a low frequency (100Hz) was used. From the measurements at the bottom of the ‘scope display you can see that the input signal was 100mV RMS and the output was around 43mV RMS. Since the input blue trace was measured across a 100 ohm resistor (approximately), that means the current through the resistor was 1mA RMS. The yellow trace shows that the current sensor therefore has a sensitivity of just over 40 volts per amp (i.e. 43mV divided by 1mA).

100Hz1mARMS.png

 

There is some noise on the output, but that could partially be due to the measurement since it is a low-level signal (43mV RMS) that is being observed.

 

To examine if the trace could be cleaned up a bit, averaging was turned on in the MDO3000. At a default averaging setting (16 or 32 averages, I need to double-check), this is what the output looked like:

100Hz1mARMS-averaged.png

 

So, for repetitive current draw at around 1mA RMS and at low frequency, it is possible to get a very clean output from this solution.

 

10kHz, 100uA RMS Input current

As a more extreme test, the frequency was increased to 10kHz, and the current was reduced to 100uA. At this level I would expect the output to be noisier, and perhaps observe some phase difference due to delay between input and output, and see a change in gain perhaps if the frequency response is not flat. Here is the observed result:

10kHz100uARMS.png

 

With averaging turned on, this was the result:

10kHz100uARMS-averaged.png

 

The output is about 3.9mV RMS which corresponds to a sensitivity of 39 volts per amp. So, compared with the 100Hz 1mA RMS traces earlier, this result shows that the frequency response is fairly flat to at least 10kHz. These measurements were not precise, these are just quick measurements to characterize the behaviour slightly.

 

Building an Amplifier

By now it was clear that the output benefits from an amplifier to make best use of it. I used an Analog Devices AD8226AD8226, assembled into a 20x gain instrumentation amplifier on a breadboard. There isn’t a lot to the circuit (I’ll draw it up if there is interest), but basically it consists of a 2.7k resistor to set the gain, and a couple of 100nF capacitors for supply decoupling. It was powered from +10V/-10V supplies, and the 2.5V reference output from the DRV425 board was used as the offset input to the amplifier. Some trimming would be useful to completely null out the 2.5V offset, but it was mostly nulled out, enough for me to switch to DC on the oscilloscope, for some of the tests below. For a real design the frequency response of the amplifier should be confirmed to be flat; I didn’t characterise it since it was just a quick hack on a plastic breadboard, and I could always circle back if I saw any anomaly in the subsequent tests.

sensor-and-amp.jpg

Tests with the Amplifier

The diagram here shows the test topology:

test-topology-with-amp.png

 

10kHz, 100uA RMS Input Current

With the amplifier connected, the output was clearer and of course larger. I was no longer in the noise with the oscilloscope gain having to be set at max. I use a 1kohm resistor for this test.

new-10kHz100uARMS - with-amp-1kohm.png

 

The voltage across the 1kohm resistor is about 100mV RMS according to the blue measurement on the oscilloscope, so that corresponds to 100uA RMS input current. The yellow output is about 81mV RMS which means the sensitivity with the amplifier is 800 volts per amp.

 

With averaging turned on, the trace was again cleaner as expected:

new-10kHz100uARMS-averaged - with-amp-1kohm.png

 

I kept the averaging on, and with a square wave input (again at 100kHz, 100uA RMS), the bandwidth effects were apparent, but still a very clean and usable result:

new-10kHz100uARMS-square-averaged - with-amp-100ohm.png

 

10kHz, 10uA RMS Input Current

Since the results at 100uA RMS were fairly clean and usable provided some averaging was possible, I was curious to see if 10uA RMS was usable too. This is quite a small current draw! To put it in perspective, an AA sized battery (2000mAH) should (self-discharge excluded for this hypothetical experiment) last for 16 years if attached to a circuit drawing 10uA! Here is the result with averaging turned on:

10kHz10uARMS-averaged256 - with-amp-1kohm.png

 

10kHz, 10mA RMS Input Current

Since the low-level current measurements were not bad, I wanted to explore higher current values. I switched off the averaging and with the input current set to 10mA, I needed to increase the amplifier supply voltage from +10V/-10V to +15V/-15V to stop clipping, and the result is shown here:

10kHz10mARMS-15V - with-amp-100ohm.png

 

Summary

For the limited 1000:1 range of around 10uA to 10mA the circuit functioned well. It allows for fully isolated measurements from DC to 10kHz or beyond. While it would be quite useless for DC-DC converter measurements, it could have uses in developing low power circuits where current in sleep periods needs to be monitored as well as current during wake-up periods.

fluxgate-topology-color.png

 

By experimenting with the winding and amplifier, different current ranges could be implemented. I’d love to see what uses others could find for such a current measurement device with these characteristics.

 

I really enjoyed experimenting with the fluxgate magnetometer; it is awesome to have such high sensitivity in a low-cost, tiny device. I'm hoping to try non-current-sensing applications with it too.

 

The big problem with being a maker newbie, is that you have to have equipment.

When I started, I bought soldering kit and a multimerter - things that don't cost allot and are very needful to start your first steps.

But I believe the most important test equipment one need is oscilloscope, but it also very expensive.

So there is a conflict...

Many times you need to debug a circuits because things can go wrong (we all know that...) and you need a scope to figure out what's the problem.

Consider you still in the noob phase, you don't want to spend hundreds of $$$'s just for buying a simple scope

 

If you could just have a simple cheap one that is good enough for very simple circuits you wouldn't think twice

 

Now, let's define what is a simple circuit.

For me it has two major parameters

1. Low bandwidth

2. Low voltage, let's say 0-5Volt and if you insist 0-15Volt

 

I have searched the internet and found many of them, some are better then others, some are complicated to build than others.

I put my eyes on Girinoscope www.instructables.com/id/Girino-Fast-Arduino-Oscilloscope/

This scope is using aruino uno (I built my with arduino nano) and reaching 150Ksps with 5V voltage swing.

The problems with the tutorial are:

  1. Its explaining allot of the software and a general knowledge on how a scope trigger works, but:
    1. The info not that well explained to a noob that just want to build it.
    2. There isn't even a simple connections diagram.
    3. You need to deep dive the Atmel documentation to really understand what the tutorial explains.
  2. The provided code needs to have patches to work in max BW (Currently 150kbps).
  3. The GUI provided by 3rd party only visualizing the sample but can't save it for future use.
    1. GUI link: https://github.com/Chatanga/Girinoscope

The Software

The instructables describes how to configure arduino's CSR and you get a pretty good feeling what is happening, but only if you have some knowledge in VLSI and logic design (Muxes, Flipflops, PADs, etc...)

I have tweaked the SW a little bit to support higher sampling rates (code improvements to save MIPS)

I also put the GUI in the same github for ease of access, Also with script to run it from arm CPU (RPI, db410c)

https://github.com/idanre1/Girinoscope2_0

  • main path contains the arduino code
  • capture_exe - perl program to acquire samples that can be saved to a disk (not just watching on the screen)
    • excel can be used to manipulate data and show graphs
  • scope
    • contains the GUI
  • db_src
    • source code for test suites in db410c.
    • RPI can be also used with minor changes.

 

The Hardware

All you need is an arduino + some resisters and capacitors.

For simple testing purposes I used 555 timer with output swing from 0-5v, calculated the expected frequency and tried to match expectations with result samples.

 

{gallery} My Gallery Title

Full circuit: Arduino ADC connected to LM358N as input probe. ne555 as the test circuit. ne555 is supplied with 7v rail to rail so the output will be about 5v.

DB410c as tester: I use the 1.8v digital GPIOs on the dragonboard to the arduino ADC. I sometimes using level shifer txs0108e to provide arduino with 5v from DB410c

Girinoscope schematic: From girinoscope intructables it is very hard to tell what to connect where. You need to deep dive the arduino code to understand what to do. This simple schematic can help allot

555 Timer: I use this circuit to see if the calculated frequency of the 555 timer will match what I sample using arduino.

GUI: Acquiring sample from the girinoscope GUI

 

The probe - Try 1 (not that good, please review try 2)

If I want to cross more than 5 volts I actually need to create a probe.

Special thanks to jc2048 and DAB for helping me navigating the world of opamps (there are thousand of them, and you gotta choose )

I have tried a simple simulation with the MCP6024

Basically I made a 1/4 voltage divider for being able to insert arduino more than 5V.

This is the simulation results:

WAY BETTER THAN LM358N! (See photo gallery for old opamp result)

Vin is square wave 20V@15KHz

You can see output is 4.98V (fair enough for basic scope)

Only thing that worries me is rise and fall time on the max acquired BW (15KHz)

 

Questions:

  1. Maybe I need a higher BW op-amp?
    1. Does adding some passive component to the feedback loop will help?
  2. Do I need to add to Vout of the opamp some reverse protection diode to save arduino from human fault?
  3. Why V_rise is slower than V_fall?

 

The probe - Try 2

  • Red circuit is is Differential amplifier
  • Orange Circuit is voltage offset
    • Since the opamp is 5V we need to offset for half meaning 2.5v
    • By adding 2.5V to to red circuit V+ we get -2.5v:2.5v input only by supplying 5v and GND to the opamp supply.
      • That I understood but could find proper analysis why??? (TODO - find a link to article)
  • Power supply
    • C2,C3 are for noise cancellation of the power supply (power supply decoupling)
  • U2,U3 are only 1:10 multiplier to work on low voltages.
  • C1 - power supply filtering
    • Remove some of the noise coming from the 5V and give a cleaner pseudo ground to work with.
  • R11
    • Isolates any capacitance on the output a little from the op-amp
  • R14
    • Input pit of GND that is connected to GND of the circut
    • Resistor is there to prevent high current from flowing when grounds are uneaven.

 

Probe schematic

Simulation result

I put square wave of 20v out of 25v.

You can see the output is from 0.5v-4.5v.

T_fall is about 4u_sec which is pretty reasonable. less than 1/7 of the square wave low voltage time...

 

Pad schematic from atmel datasheet:

 

 

I think the next step is to order this opamp

This would probably not happen during this competition period (shipping takes a while where I live)

 

Summary

Hope every noob will find this article:

  1. with full details how to built it
  2. Step by step explainable
  3. Have enough analysis details for understanding without inner assumptions not said.

 

I want to have a special thanks to jc2048 for helping me allot trying to build the probe.

 

Proof of work

The following video shows db410c (similar to RPI) generating square wave using one of its GPIOs in 1.8v

Then a level shifter which is design to between-chips communication is used to amplify the signal to 5v www.ti.com/lit/ds/symlink/txs0108e.pdf

The signal is captured by girinoscope and BitScope Micro Oscilloscope & Analyzer for a reference.

I demonstrates trigger modes and sampling of the square wave by both scopes using girinoscope GUI.

 

The following video shows the probe detailed in this thread with 1:10 attenuation

Currently the opamp is the only one I have got LM358n which is manufactured around 30 years old, I have extracted it from an old circuit I have.

The opamp output is very noizy, I hope a newer opamp will do a better job (I put this video for proof of work of the probe)

Again caputes of both scopes are provided for a reference.

 

 

 

Regards

Idan

Too many button clicks

Buttons and tactile switches are frequently used in many projects involving micro controllers; one of the most frequent issue is related to unwanted multiple transitions when the button is pressed once.

Tactile switches as well as push buttons are mechanical components subject to the problem of bouncing. When a button is connected to a digital GPIO input pin (i.e. an Arduino pin configured as INPUT) we ideally expect that when the button is pressed we get only one high signal; unfortunately this rarely happens. During the mechanical movement the physical material vibrates affecting the voltage and the transitions between the On/Off status are not so clear as we usually need. Micro controllers and FPGA are fast enough reading the microseconds oscillations when the button is pressed, resulting multiple transitions while apparently we are pressing the button only once.

 

Button debouncing

To solve this problems we should apply a button debouncing to reach the goal: pressing a button only one signal should be detected by the micro controller digital input. We can identify two possible approaches: software and hardware.

There are plenty of source examples on how to debounce a button via software; the software approach seems the easiest way but in my opinion this is one of the cases where a hardware solution may be more efficient and resource saving. Micro controllers have memory and resource limits so adding a debouncing routine maybe critical in many cases.

 

The hardware choice

As I had to add a button debouncer to a test project based on Arduino 101 I decided to make something as much general as possible, easy to adapt to almost any micro controller and possibly platform independent. I figured two possible approaches: RC (resistor-capacitor) method and IC method. The RC option is easier to realise but I am not so confident it can be applied to very different operating conditions (e.g. very different micro controllers types and clock speed). It is not so difficult to calculate the values of resistor and capacitor for a RC debouncing circuit but I see a limitation restricting the application range. The calculation of the RC circuit is  dependent on the voltage of the board used; this means that for different voltage boards (1.8V, 3.3V, 5V etc.) we should provide a different RC calculation.

The RC simple circuit shown in the image below can be calculated with the nice RC Debounce online calculator

Screen Shot 2017-08-11 at 23.58.14.png

The parameters involved in the calculation are:

 

  • Voltage
  • High logic level
  • Bounce time (ms)
  • Capacitor value
  • Resistor value

 

The other hardware alternative is adopting a debouncing IC.

There are many specific IC for mechanical contacts debouncing, but they are almost expansive and oriented to manage power buttons while we generally use a push button is to generate a logic signal. The LTC2951CTS8LTC2951CTS8 for example sounds good (not sure if the DIL version is available) with a base price of about 5$.

This is why I decided to move to a general-purpose debounce circuit based on the Vintage NE555. TI provides a wide range of 555 ICs including DIL packaging covering a range supply levels from 1.5V up to 16V; the most common is the DIL package NE555-PNE555-P in the range between 4.5V and 16V. Just what I need, sold at 1/10 (one tenth) of the specialised debouncing ICs average price!

 

The NE555 circuit

Screen Shot 2017-08-12 at 12.30.10.png

I designed the circuit based on the popular NE555 monostable configuration shown above and detailed in the below schematics:

LevelingArduino101DebouncingSchematics.PNG

In this specific case using the two 10uF capacitors connected in parallel to the discharge pin and the 10K resistor for charging we get a timing of about 220 ms. It is a reasonable value to debounce a tactile switch connected to a digital input pin of an Arduino board; changing the values of the capacitors and the resistor we can increase or reduce the charge time resulting a different timing to the output pin (debounced signal.

 

Wiring the circuit

Using the NE555-P IC the circuit can be powered by the Arduino itself; the images below show the circuit placed as part of the Arduino 101 project where a push button is needed. The small board can also host the designated button making a compact object independent by the platform (an external power source can also be used) involving only the debounced signal connected to the desired GPIO micro controller pin.

IMG_20170801_094225.jpg IMG_20170806_201844.jpg

IMG_20170806_201900.jpg IMG_20170806_201907.jpg

IMG_20170806_202753_008.jpg IMG_20170806_202753_014.jpg

The resulting PCB is about 30x35 mm; I have provided a tactile switch button surface mounted on the opposite side of the components to make easier assembling the module in any project.

LevelingArduino101DebouncingSchematics3D01.PNG LevelingArduino101DebouncingSchematics3D02.PNG

The button in action

The video below shows the debouncer module at work powered by the Arduino 101 and a couple of screenshots showing the stability of the signal

 

 

Capture.PNG Capture3.PNG

 

Introduction

When I saw Jon's The ByEar 2000, I remembered a Cypress' video showing a construction of an analog alarm and posted that as an comment under his blog post.

PSoCs usually have many integrated analog and digital peripherals, so I thought I could make a compilation of both mentioned projects. I am an amateur, so don't expect scientific explanations or ground-breaking discoveries I only built this device using a CY8CKIT-050 PSoC® 5LP Development Kit, which is obviously an overkill, but the same can be performed using a much small USB stick kit, featuring PSoC 5LP: CY8CKIT-059 PSoC® 5LP Prototyping Kit With Onboard Programmer and Debugger. Please do not consider this as a finished product, but just as a set of ideas for PSoC beginners.

How does it work

 

Hardware / schematics

Below is the schematics of the whole circuit. I decided to power the circuit by a 3,3 V, meaning it can serve as a programmable logic probe for voltage levels of 3,3 V or lower.

I downloaded a 74LVT125 datasheet to get the LVT families logic levels:

High-level input voltage Vih is supposed to be minimally 2 V.

Low-level input voltage Vil is supposed to be maximally 0,8 V.

 

 

Jon has described his circuit very well, so I am just going to list the differences / PSoC 5LP specifics:

  • LogicInput pin is connected to the voltage tested and TonOuput to a buzzer or a speaker.
  • There are two VDAC components and their purpose is to generate a reference voltage for the comparator. These components are programmable in a PSoC 5LP and I have chosen a range of 0 - 4,080 V (16 mV / bit), however, as I am powering the circuit by Vdd = 3,3 V, the maximum reference voltage generated would be Vdd. (The good thing is that PSoC Creator makes you aware of this fact, so it's not a surprise for starting engineers / makers.) One VDAC is set for logic low level 0,8 V and the other for logic high level 2,0 V.

  • VDAC outputs are fed into the inverting inputs of the comparators. Input of the logic probe is fed into both of the comparators, but to the non-inverting inputs. The comparators have to decide then, whether the logic input is lower than Vil (and obviously Vih), between Vil and Vih, or above Vih (and Vil, of course). There is one hypothetical fault condition, that the high voltage level comparator will output a logic high, while the low voltage level comparator will ouput a logic low. I hope this won't happen, but the situation will be taken care of by the sound signaling part of the circuit. By the way, the comparators' synchronization is bypassed, so they don't expect to be clocked.

 

The rest of the circuit is used to produce a sound output so the user has an idea of the voltage level measured.

 

  • Two PWM modules are used to create two sounds with a different frequency, one for logic high and one for logic low.

 

  • As you probably noticed, there is an OR gate mixing both of the PWM outputs together. This was just found by an experiment to create a sound that would differentiate from logic low and logic high sound. This could definitely be done many other ways, using more internal PSoC resources.
  • All the outputs are fed into the multiplexer and the meaning is to provide separate channels with all the possible sound outputs, so only one sound buzzer is needed. (This probably isn't the smartest description of a multiplexer usage, right?) The multiplexer has four inputs, the last is not needed, so I connected it to a logic 0, but this input is never used.
  • The fun part is the control function of the multiplexer. We have two comparator outputs and their output combination tells us in which boundaries is the input voltage. This is where a lookup table (LUT) comes in. It is basically a definition of a discrete function. We have two inputs (4 possible states) and need two outputs for controlling which frequency output will be connected to a buzzer. Here is the definition:

As I mention before, state 0x02 should never happen, but it's output is the same as if the voltage is between the voltage levels of logic low an logic high. This means that the weird sound produced is "not defined voltage level" or "logic probe is broken"

 

Software

Now comes the easier part, the PSoC code (main.c):

 

#include "project.h"

int main(void)
{
    CyGlobalIntEnable; /* Enable global interrupts. */


    // Starts both VDACs
    VDAC8_LogicLow_Start();
    VDAC8_LogicHigh_Start();
  
    // Starts both comparators
    Comp_LogicLow_Start();
    Comp_LogicHigh_Start();
    
    // Starts both PWMs
    PWM_LogicLow_Start();
    PWM_LogicHigh_Start();
    
    for(;;)
    { 
      /* Place your application code here. */
    }
}

 

Pretty short, right? I think the device could be put into a sleep mode, but I will leave this as reader's homework.

 

Resources

Here is a screenshot of PSoC 5LP resources used. Please note that the majority of RAM is usually allocated for a stack and heap and can be reduced if not needed.

 

 

Conclusion

Using a different PSoC power voltage and different VDAC voltages can be used to adjust the circuit to other voltage levels or needs.

PSoC is very versatile and the circuit can be modified in a countless ways (adding a button to start measurement, one or more LEDs, display, provide some output for testing other circuits ...)

 

Here is a proof of the working prototype. I used the onboard potentiometer to simulate the input voltage level.

 

 

I also attached the project bundle for anyone interested in exploring the design.

 

For readers willing to experiment more with PSoCs 4 (lower series):

100 Projects in 100 Days

PSoC® 101 Video Tutorial Series: How To Use the ARM® Cortex®-M0 Based PSoC 4 | Cypress Semiconductor

 

David

Peter, Jon and I are designing a programmable electronic load, here on element14: Programmable Electronic Load

We'll never make it in time for the DIY Test Equipment initiative (we may have a first prototype In the Year 2525). But it can help you if you want to build a device that can be automated with LABView or similar*.

 

 

What's in the current version:

- working firmware with a SCPI integration. Complies to SCPI standard out of box.

- tested PCB with several ADC and DAC channels, programmable and readable via SCPI - isolated and with a voltage reference

- LCD interface

 

Our goal is to extend Peter Oakes' popular DC Load into a programmable one. The modular design of the control logic is a start point for other designs too.

You can adapt the ADC/DAC design and control your own instrument with it. In it's current state, it can be turned into a programmable meter, signal generator, sampler.

With firmware adaption you can link the SCPI commands with your microcontroller's timers and use it as a PWM generator or a frequency counter.

With additional hardware you can buffer in-and outputs, create a programmable power supply, ...

 

 

Both PCB and firmware - although based on TI-RTOS for MSP432 and BoosterPack pinout, can be adapted. We've taken care that no license stops you from doing whatever you want and sources are attached.

Hope to see it reused in an element14 DIY Test Instrument.

 

 

* or other programs that support serial comms - even a plain terminal program like PuTTY.

I was planning to make a super simple logic probe but Jon beat me to it with his comparator based logic probe. So I've prototyped a microcontroller based one.

 

Microcontroller based logic probe with display

My project has just two modules, an Arduino clone and an Adafruit I2C LED backpack. The probe is connected to an analogue pin although the current software uses it as a digital pin only. The pin is sampled once every half second and 8 samples are shown across the screen on the first 2 lines.

Circuit.png

I tested the LCD with the Adafruit demo followed by writing my own hardcoded bitmap.

InitialTest.jpg

Code

The setup sets the pins, then clears the display and sets the brightness. In the loop it takes a sample, mirrors it to the pin 13 LED and then updates the display.

 

#include <Adafruit_LEDBackpack.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
int sampleNo;
bool samples[8];

void setup() {
  Serial.begin(9600);
  Serial.println("Logic Probe");
  pinMode(A1, INPUT);
  pinMode(13, OUTPUT);
  
  matrix.begin(0x70);  // pass in the address
  matrix.clear();
  matrix.setBrightness(5);
  matrix.writeDisplay();
}

void loop() {
  samples[sampleNo] = digitalRead(A1);   // read the input pin
  digitalWrite(13, samples[sampleNo]);   // sets the LED to the input value
  writeDisplay();
  sampleNo = ++sampleNo % 7;
  delay(500);
}

void writeDisplay() {
  matrix.clear();  
  for (int i=0; i <= 7; i++){
      matrix.drawPixel(i, samples[i], LED_ON);
   } 
   matrix.writeDisplay();
}

 

Libraries

https://github.com/adafruit/Adafruit-GFX-Library

https://github.com/adafruit/Adafruit_LED_Backpack

 

Improvements?

There seems to be a power issue where the Arduino resets when the display refreshes. That was the case with the demo as well as my test code. Potentially a big capacitor across the power rails might fix that or perhaps an independent supply for the display.

 

It should be possible to update writeDisplay so that the signal scroll across the screen, it would also be good if it used more than just the first two rows on the display.

 

The other obvious thing to try would be to write the data from the input back to the serial port then have a graphing tool on a host PC to display or capture the waveform.

IMG_20170722_080932.jpg

Introduction

I am one of the road testers for the Infineon DC Motor Shield w/ TLE94112EL for Arduino and this project shows the testing platform I developed to test the features of the board shield, but it is also useful to test the DC motors performance, as well as other motor controller boards for Arduino.

According to me, carrying out a testing on the road of this platform based on the Infineon TLE94112TLE94112 IC requires a versatile and flexible platform to make possible all the tests without building a lot of unreliable breadboarded stuff with loose wires. Moreover, in order to widen the range of possible tests making the platform reusable in the future you need to add only few extra components.

 

A full test of the TLE94112LE shield for Arduino based on this platform will be published in the Road Test section.

IMG_20170529_162044.jpg

 

The Project

Planning the Design

The idea of making an interactive testing platform evolved as I progressed analyzing in depth the shield features on several Arduino compatible platforms: Arduino UNO R3Arduino UNO R3, Chipkit PIChipkit PI and the Infineon XMC1100 BootInfineon XMC1100 Boot. All these platforms were reliable with no t special issues by the TLE94112 shield; for the final development I opted for the Infineon board due the better ARM MCU, which is faster and with more available flash and RAM memory (ARM Cortex M0 32 bit, 16Kb high-speed RAM, 64Kb Flash memory) I should admit that the better performance of this board compared to the Arduino UNO kept as reference.

IMG_20170519_095746.jpg IMG_20170519_095806.jpg

Testing motors

To create a reference for the test platform I chosen 6 brushed geared micro-motors with electrical characteristics included in the acceptable ranges of the TLE94112LE IC assembled together on an Aluminium square bar.

IMG_20170628_232738.jpg IMG_20170628_233349.jpg IMG_20170629_000615.jpg

To that aim, I used cheap motors from Pimoroni with the following characteristics:

 

Free-run current @ 6V: 60mA (max 120mA) - in some conditions can generate an overcurrent that is useful to test the error registers of the TLE94112

Stall torque @6V: 2.5Kg/cm

Stall current @6V: 900mA (TLE94112LE max current per half-bridge is just 0.9A)

Gear ratio: 298:1

BrushedMotorTest.jpg

A small 3D printed object has been designed to make visible the rotation of the motors.

 

Control I/O

Using a terminal to control the shield seemed immediately the right choice as the available control options open a wide scenario of many motion possibilities. The problem arose when I saw that some status information and configuration updates need continuous and immediate feedback. To solve this problem, an LCD display has been added to the testing board.

IMG_20170529_215359.jpg

 

DC/DC Regulator

To provide the right power supply to the TL94112 a separate power line has been set through a DC/DC power regulator.

IMG_20170719_210202.jpg

Design in practice

The working version of the design evolved around the features of the board I have experienced during the first phase of the hardware testing growing its complexity. The images below show the most meaningful steps.

 

{gallery} Platform design evolution

IMG_20170529_212524.jpg

IMG_20170719_210151_BURST002.jpg

IMG_20170701_110839.jpg

IMG_20170719_210210.jpg

IMG_20170720_231205.jpg

The Testing Platform

The last element added to the testing platform is a 50K potentiometer connected to the analog port 0. That will be used by the software when you need to read dynamic values (e.g. the manual duty cycle). The diagram below shows the components connection.

Screen Shot 2017-07-26 at 17.02.13.png

The Software

The hard part was developing the software, that required a lot of revisions, 37 pushes on the GitHub repository, but nowat last it is available as Open Source under the LGPL 3.0 license: https://github.com/alicemirror/TLE94112LE

 

 

Software Design

The software is divided into functional blocks as listed below

  • Main Sketch: initialize and setup the system. The main loop controls the TLE94112 through the Arduino library (via SPI protocol on PINs 8 and 10), the analog input and the parser, the messaging via the serial terminal and the LCD display.
  • Commands: definition of all the serial commands response messages and all related to the parsing.
  • MotorControl: the class interfacing the (thanks to) Infineon TLE94112 Arduino library with the high-level methods used by the serial commands

We'll see them in detail in the next chapters.

 

1. Main Sketch

I tried to reduce as much as possible the definition of global variables and constants in the main sketch. The only pre-processor definitions in the TLE94112LE.ino are limited to the global flags driving thebehaviorr of the program in the mainLoop() and the symbolic constants definitions strictly related to the application logic to avoid confusion and better readability and making the MotorControl class fully reusable in other projects.

 

//! Max analog reading range with a 50K potentiometer
#define MAX_ANALOG_RANGE 1024
//! Min analog reading range with a 50K potentiometer
#define MIN_ANALOG_RANGE 0

//! Duty cycle analog read should be ignore (bypass the analog reading)
#define ANALOG_DCNONE 0
//! Duty cycle analog read should be assgined to DC min
#define ANALOG_DCMIN 1
//! Duty cycle analog read should be assgined to DC mAX
#define ANALOG_DCMAX 2
//! Duty cycle analog read should be assgined to DC manual reading
#define ANALOG_DCMAN 3

 

A special note about the preprocessor directive _SERIAL_ECHO:

 

#define _SERIAL_ECHO - all commands are echoed to the serial terminal as shown in the example below

Serial output

setting  all

Direction  ccw

setting  none

setting  m1+

PWM:  80

setting  dc80

set  accel

setting  dc100

#undef _SERIAL_ECHO - only wrong commands are notified on the serial terminal

Serial output

wrong command  'mindc'

Main loop() structure

The main loop control the logic of the application. It is organised in three functional blocks checked sequentially every cycle depending on the status of the top flags and the data availability on the serial port (Tx/Rx, Pin 0 and 1)

 

Motors running status block

This block is checked only if the system status is running (start command). Every loop cycle when the motors are running it is checked for the presence of some error on the TLE94112LE registers and eventually errors are notified on the serial terminal

  // Check if at least one motor is running to test the error status
  // Note: It is possible to isolate the error status, if any,
  // for any motor. Here we make a simplification and check over
  // the motor without filtering
  isRunStatus = false;
  for(j = 0; j < MAX_MOTORS; j++) {
    if(motor.internalStatus[j].isRunning) {
      isRunStatus = true;
      j = MAX_MOTORS; // Force exit from loop
    } // check for running motors
  } // motors loop
  // If at least one motor is running check for diagnostic
  if(isRunStatus) {
    if(motor.tleCheckDiagnostic()) {
      //! Show the error star
      lcdShowError();
      motor.tleDiagnostic();
      lcdClearError();
    }
  }

 

Serial parsing block

If there are data available on the serial, the parser function parseCommand(String) is launched to check the command (or return a command error).

Serial commands are received as String terminated by CR=LF characters to be supported by any terminal or common serial connection. The last two terminating characters are removed before the string parsing.

All the commands and parser related strings are defined in the header file commads.h

 

Analog reading block

There are three conditions that enable the reading of analog values:

  • ANALOG_DCMIN User is setting manually via the potentiometer the minimum duty cycle value for one of the three PWM channels
  • ANALOG_DCMAX User is setting manually via the potentiometer the maximum duty cycle value for one of the three PWM channels
  • ANALOG_DCMAN User can change manually via the potentiometer the current duty cycle value for the PWM channel(s) enabled for manual duty cycle

 

Other functions in the main sketch

The main sketch also includes the functions to control the optional LED (on pin 12) and the LCD layout control functions.

 

LCD layout

For obvious size reasons the LCD shows several layouts depending on the conditions using a layout with abbreviations; whenever possible, more readable strings have been used. The shortened symbols used by the LCD are listed below:

  • M1, M2, M3, ... M6 Set the corresponding motor
  • M* Set all the motors with the same parameter
  • PWM[1] 80Hz, PWM[2]100Hz, PWM[3] 200Hz Set one of the three PWM channels (assigned to a fixed frequency)
  • CW/CCW Clockwise/Counterclockwise direction of the selected motor(s)
  • FreeWh+/FreeWh- FreeWheeling active enabled/disabled for the selected motor(s)
  • DCMin Minimum duty cycle value for the selected PWM channel(s)
  • DCMax Maximum duty cycle value for the selected PWM channel(s)
  • ena/dis Selected motor(s) set as enabled or disabled
  • Ramp Set acceleration and deceleration for the selected PWM channel(s)
  • Inst. Set instant starting for the selected PWM channel(s)

 

The gallery below shows and example of several LCD layouts

 

{gallery} LCD Layout examples

IMG_20170725_083326_1.jpg

IMG_20170725_083810.jpg

IMG_20170725_084142.jpg

IMG_20170725_084152.jpg

IMG_20170725_084431_1.jpg

IMG_20170725_084218_1.jpg

IMG_20170725_084546.jpg

IMG_20170725_084557.jpg

IMG_20170725_084649_1.jpg

 

2. MotorControl Class

The MotorControl C++ class is pat of the software, uses the TLE94112 Arduino Library by Infineon and is built around the files motorcontrol.cpp, motorcontrol.h and motor.h (extra preprocessor definitions). The class itself is structured through two level methods.

For the complete methods of the class and full documentation refer to the software available on the GitHub repository

 

MotorControl - Hardware control methods

The hardware control method interfaces directly the features of the hardware shield exposed by the TLE94112 Arduino library.

 

MotorControl:: tleCheckDiagnostic(void)

MotorControl::tleDiagnostic(int motor)

MotorControl::tleDiagnostic()

Check the diagnostic status and send the corresponding error message to the serial terminal (if any)

 

MotorControl::motorConfigHBCCW(int motor)

MotorControl::motorConfigHBCW(int motor)

and others similar to configure half bridges direction and the other parameters, the PWM channel, duty cycle etc.

 

MotorControl - High level methods

The hight level methods interfaces the commands calling recursively after filtering potential errors, This avoid internal problems or unexpected behaviours or hardware damages.

Every parser command call one of the high level commands of this class.

 

3. Commands Description and Syntax

Excluding the potentiometer on the board all the controls are sent via terminal through a USB-to-serial connection. When the system is in running mode it can accept configuration commands that will be effective after a stop and start call.

If errors occur while the system is running these are shown in detail on the serial terminal and are notified on the LCD screen

The available commands are listed below:

Direction control

  • cw : clockwise rotation
  • ccw : counterclockwise rotation
  • accel : enable the acceleration when motor start
  • noaccel : disable the acceleration when motor start

Action commands

  • start : start all motors
  • stop : stop all motors
  • reset : reset the system to the default

Duty cycle settings to PWM channels

  • dcmanual : Set the duty cycle value depending on the pot
  • dcauto : Set the duty cycle current limits
  • dcmin : Set the min duty cycle value via pot
  • dcmax : Set the max duty cycle value via pot
  • dcinfo : Shows the duty cycle range for the selected PWM channel

PWM channel selection for duty cycle settings

  • dc80 : Set the duty cycle to the PWM channel 80Hz
  • dc100 : Set the duty cycle to the PWM channel 100Hz
  • dc200 : Set the duty cycle to the PWM channel 200Hz
  • dcPWM : Set the duty cycle to all the PWM channels

Motor select for settings

  • all : Select and enable all motors
  • none : Disble all motors
  • m1 : select motor 1
  • m2 : select motor 2
  • m3 : select motor 3
  • m4 : select motor 4
  • m5 : select motor 5
  • m6 : select motor 6

Motor enable

  • m1+ : enable motor 1
  • m2+ : enable motor 2
  • m3+ : enable motor 3
  • m4+ : enable motor 4
  • m5+ : enable motor 5
  • m6+ : enable motor 6

PWM Frequency selector

  • 80 : PWM 80 Hz
  • 100 : PWM 100 Hz
  • 200 : PWM 200 Hz

Freewheeling mode motor(s) setting

  • fwactive : Fereewheeling active
  • fwpassive : Freewheeling passive

Show all motors configuration

  • conf : Dump the current settings

 

For the last updates and revisions please follow the TLE94112LE on GitHub

(special thanks to antoricagno for text review)