Categories
Arduino

Arduino programming and hardware questions answered

A surprising amount of my Arduino project building tasks comes from people who have an urgent project and got in way over their head. They’ve selected components, maybe even purchased them. They’ve started learning about the Arduino ecosystem and begun learning to code.

Then Life Happens. The project has to be pushed back since they don’t have time to learn what they need to, or other issues come up, so they turn to me to redo the job from scratch, or clean it up.

And sometimes you’re just stuck on a particular problem and you could continue on your own if you became “unstuck.” You can turn to online forums in this case, but they can be hit or miss. Sometimes you get the perfect answer,  but often people online are rude to newcomers, snarky, make you feel unwelcome, or just give bad info. Also, even when you’ve been told “just Google it,” it’s pretty hard to “just Google it” for something technical like an Arduino sensor if you don’t even know what the search terms would be. Does this sound familiar?

I can help.

I’ll answer your Arduino questions for a set fee. You will receive polite, respectful, and timely help at reasonable rates. Unlike anonymous forums, we have a vested interested in proving useful help and keeping you happy.

An example question would be: “why does this function fail after it’s been running for a while? Or, what’s the difference between all these sensors and which one should I select, and why?”

Generally, if your question is something that’s been asked a thousand times on the online forums, we’ll just point you at an existing answer. Sure, I can tell you “how to control a solenoid with my Arduino” but so, so many people have answered the same question before that it’s better to take advantage of existing resources than to create yet another duplicate.

Now, clearly with the cost of software development being what it is, we can’t write custom sketches at these prices, but we can point out where a sketch is wrong or should be rewritten. If you need help selecting a peripheral like a solenoid valve or a Photomultiplier tube for your Arduino, we’ll do the research for you. If we feel we can’t do your question justice, you will receive a refund if you’ve prepaid!

As far as rates go, the price is $25 for a single question, $100/week for one question per day or $350/month for unlimited questions. Consider that last rate a retainer, if you will.

For some of the more unusual or newer products, we may have to do substantial research, and there are likely going to be a few questions we will have to decline and refund your money because proprietary information that we don’t have access to can be involved. But by and large, I’m sure that the service will help a lot of people be successful with their Arduino projects.

But I feel it’s worth a try. I know there are people that need questions answered who aren’t getting the assistance they deserve.
Click on the button below and it will take you to a payment page for the single, $25 answer. I will respond to your question within 24 hours. I also use this $25 level as my “tip jar.” Sometimes when I help someone online (with no expectation of payment), they are so grateful they’d like to reciprocate, so this works to leave a small payment.

This doesn’t mean we won’t build complete projects any more. That is still an option, but if you just need a quick nudge in the right direction, this is here for you.

Single Arduino Question


If you prefer, I am also available for more extended help on codementor




If you'd like to subscribe to this blog, please click here.

Categories
Uncategorized

Arduino One-shot timer

A recurring task that comes up in machine control or experimenting with Arduino is turning an output on for a fixed time, then shutting the output off. In electronics, the circuit that does this is called a One-Shot Multivibrator. A multivibrator is a circuit that switches between two states – On (or High) and Off (or Low). A one-shot multivibrator does this once. Its  normal state may be off, but when triggered, it switches on for a period of time and then back off.

We use the same name to describe code or an Arduino sketch that performs this one-shot function. Typically there is an input like a pushbutton that is monitored and a digital output that will execute the one-shot function when the pushbutton is active.

A retriggerable one-shot is a version where triggering it again before the time is up causes the time to be extended. So, say the one shot output would be on for 10 seconds, pushing the button in our example three times would result in a total output On time of 30 seconds. A non-retriggerable one-shot ignores the triggering input while the output is active.

Here is code for a basic non-retriggerable one-shot Arduino timer.

// Project sponsor: N/A
// Email: sales@cedarlakeinstruments.com
// Creator: Cedar Lake Instruments LLC
// Date: April 2018
//
// Description:
// Demonstrate one-shot logic with Arduino
//
// Arduino pins
// 2 - Digital trigger input. Pull LOW to trigger one shot
// 3 - Cancel one shot timer (output goes LOW)
// 13 - One shot output (goes HIGH for one shot time)
//
#define TRIGGER 2
#define CANCEL 3
#define OUT 13

// *********************************** U S E R  A D J U S T M E N T S **************************
// One shot time in milliseconds
#define DELAY 6000

int _timeout = 0;

void setup() 
{
    pinMode(TRIGGER, INPUT_PULLUP);
    pinMode(CANCEL, INPUT_PULLUP);
    pinMode(OUT, OUTPUT);
    digitalWrite(OUT, LOW);
}

void loop() 
{
    // One shot triggers on high->low transition of TRIGGER pin
    if ((digitalRead(TRIGGER) == LOW) && (digitalRead(CANCEL) == HIGH))
    {
        _timeout = DELAY;
        digitalWrite(OUT, HIGH);
    }

    // Hold output High until timeout or cancel pressed
    while (_timeout-- > 0 && (digitalRead(CANCEL) == HIGH))
    {
        delay(1);
    }
    digitalWrite(OUT, LOW);

    // Hold here until inputs inactive
    while ((digitalRead(TRIGGER) == HIGH) && (digitalRead(CANCEL) == HIGH));
}



If you'd like to subscribe to this blog, please click here.

Categories
Uncategorized

Production Counting

Any business producing an item needs to count the numbers put into inventory. However, counting items in production can provide far more benefits than just stock quantity. One of the main points of tracking the production of any item you make is knowing how efficient your process is.

  • How many widgets did you make last week vs. this week?
  • How many yesterday vs. a week ago?
  • How many bad ones did we make?
  • How close did we get to our target?
  • Do you get more done at a particular time of day?
  • What time of day do most of your production defects crop up?

To answer these questions, you first need to track how many widgets you make and when you make them.

You don’t need a complicated, expensive MRP (Manufacturing Resource Planning) system to this. More than anything, you need data! Whether that data is collected manually with pencil and paper or electronically, by automated counters is up to you.

One of the simplest methods of automated counters is sensing the product on a belt. Your item passes by a sensor that is an input to the counter and each unit is counted.

Alternately,  tally counters can be used to do manual counts. Tally counters can be simple handheld mechanical or electrical counters that have a push button to advance the count. PC versions are also available. An advantage of a PC counter is the ability to easily track the time of day when each item was counted.


If you'd like to subscribe to this blog, please click here.

Categories
Arduino connector

To solder or not to solder…

… that is the question.

Should you solder connections between your Arduino and external boards?

Soldering is a method of making electrical and (usually) minor structural connections. It can be a permanent and reliable connection that lasts for decades. Sometimes, however, that can be a drawback since soldered connections make it harder to replace or upgrade external boards when they fail. It’s also not a panacea: while a properly constructed soldered joint can be very strong, the point where the solder ends tends to be brittle and can lead to failures if that section of the wire moves. The typical remedy for this is a strain relief — secure the wire so it can’t move or vibrated.

Pin and socket connections are a popular alternative to soldering, especially in the Arduino world where many newcomers don’t have soldering experience. They too can be very reliable: a snug fit between pin and socket can be gas-tight and resist corrosion for a very long time. It has a similar drawback to soldered connections when the item is in an area subject to vibration: the wires can come loose. Typical solutions for this are to use cable connectors with ramps, clips, or other locking mechanisms. For the popular Arduino wire jumpers, they can be bundled in groups and secured with wire ties.  By tying them together, they behave more like a single connector with a group of wires and it takes more force to dislodge them. Also, the wire bundle can be secured to a fixed point, so it won’t move.

Some single-wire terminations such as Faston terminals actually dislodge a small amount of metal when the connection is made. They fit so tightly that no additional wire restraint is needed.

So solder, or pins for wire to board connection? In the end they’re both quite useful and reliable, but my preference is generally for pin and socket. Their versatility far outstrips the few drawbacks.


If you'd like to subscribe to this blog, please click here.

Categories
Arduino

Packaging Arduino projects

I made a post over at the popular Arduino forum on a topic where someone was inquiring about available enclosures. The community tends to respond “just 3D print one” but that’s a mistake in my opinion.

3D printing, while useful, seems pointless to me unless you’re looking for something not available off the shelf. Even then, the 3D  print falls short if you need a transparent cover, or a NEMA4X /IP66 (washdown-proof) rating, or any number of other structural properties. That off the shelf $20 polycarbonate case has a lot of engineering time put into it and provides a huge amount of convenience.
As far as laser cut enclosures are concerned, I’ve yet to find one that doesn’t look completely ugly like something a 6 year-old put together for a craft class.

Seriously, burnt wood edges is not a professional look! I have seen professional enclosures for large machines made out of wood and particle board and you’d never know what the material was.  When designed by an engineer who knows what he’s doing, wood can be a fantastic material.

The amateurish laser-cut “snap together jigsaw cases” all look like crap in my opinion. And that’s a pity, because you can do some great stuff with a laser cutter. It’s just that the community has apparently decided to embrace the lowest common denominator design quality.

My gotos for great cases are Polycase & Bud for plastic wall and desk mount enclosures. Polycase is great for getting your enclosures custom modified (cutouts, slots, custom printing, etc.) at reasonable prices. I also like Hammond for metal enclosures (although Bud has some nice aluminum cast boxes). Serpac or OPC for handheld/belt mount types. Altech for industrial enclosures with electrical knockouts (although Polycase is now carrying those also).

A few links:

Polycase https://www.polycase.com/

Bud https://www.budind.com/plastic_boxes.php

Small Hammond enclosures. I like these for Arduino Nano since they fit nicely and the 1551 enclosure comes in many versions http://www.hammondmfg.com/dwg9.htm

You can find these and many, many more enclosures for sale at my favorite electronics distributor, Digi-Key.


If you'd like to subscribe to this blog, please click here.

Categories
Uncategorized

Counters with custom serial output

We recently made a modification for a customer that was such a great idea, I thought I’d post it here. They wanted to use our PRT-232 counter with RS232 serial interface but it was needed to interface to a legacy control software package. The software was originally designed to read data from a different serial measuring device. We modified the output of the PRT-232 to provide the text string the control software wanted to see on its serial port and the integration went smoothly.

It was such a useful concept we decided to offer it to anyone who requests. We will now customize any of the output strings the device generates for a nominal charge. That means that on an input switch transition, or specific level, we can output a string. e.g, input 1 goes active, it can send “Pump On” or if it goes inactive “Pump Off”
Or after counting to a certain value, we can output “Limit Reached” etc. It’s only limited by your imagination!

Of course, the normal behavior of the counter is unchanged: it will still count and report data as normal.


If you'd like to subscribe to this blog, please click here.

Categories
Uncategorized

Measure temperature with AD592 and Arduino

The menu example in a previous post can easily be modified to conver the raw A0 analog reading into voltage. Since the Analog Devices AD592 converts temperature into a current proportional to absolute temperature, we can convert this to a voltage using a single resistor. By taking advantage of the Arduino’s 10-bit analog input, we read this voltage and convert to a temperature.

Here’s the updated code:

// Description:
// Simple menuing system for Arduino
// Demonstrates a menu with controls and
// data readback
//
// Communicates with PC at 115,200 bps 8N1
//
#define LED1 2
#define LED2 3

void setup() 
{
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  Serial.begin(115200);
  menu();
}

void loop()
{
 int m = readMenu();
 switch (m)
 {
  case 1:
   digitalWrite(LED1, HIGH);
   break;
  case 2:
   digitalWrite(LED1, LOW);
   break;
  case 3:
   digitalWrite(LED2, HIGH);
   break;
  case 4:
   digitalWrite(LED2, LOW);
   break;
  case 5:
  {
    // VT100 reset cursor to end of menu (row 15, column 1)
    char resetCursor[] = {27,'[','1','6',';','1','H',0};
    Serial.print(resetCursor);
    double temp = analogRead(A0) * 4.9 / 10.0 - 273.1;
    Serial.print("Temp: ");
    Serial.print(temp);
    Serial.println("C");
    break;
  }
  default:
   break;
  }
}

// Waits in a loop until key is pressed
// then returns digit selected
int readMenu() 
{
 while (!Serial.available())
 {
   delay(100);
 }
 return Serial.read() - 48;
}


// Displays menu
void menu()
{
  // Clear
  char buf[] = {27,'[','2','J',0};
  Serial.print(buf);
  
  // Print menu
  Serial.println("\n\n\n\n\n");
  Serial.println("1....LED1 on");
  Serial.println("2....LED1 off");
  Serial.println("3....LED2 on");
  Serial.println("4....LED2 off");
  Serial.println("5....Read A0");
  Serial.println("\n\n Select 1..5");
}

If you'd like to subscribe to this blog, please click here.

Categories
Uncategorized

Communicate to Arduino from PC

Although the Arduinos are great little controllers, sometimes you need to connect them to a PC to transfer data or control. One of the simplest ways of using a PC to control your Arduino is with a menu.

Menus have been used on computers pretty much forever. Back in the 80’s the green screen (green text on a black background) text menu was very popular. They persist to this day in some specialized applications.

In a nutshell, your PC will run a simple terminal program. Putty.exe is a great choice. It’s free, works great and supports the popular VT100 terminal control characters we will need.

The Arduino serial parameters are set to 115,200 bits/second, 8N1. Make sure your terminal program is set up similarly.
The example program turns on and off two LEDs and displays the raw data read back from the Analog0 port

Here’s the program:

// Description:
// Simple menuing system for Arduino
// Demonstrates a menu with controls and
// data readback
//
// Communicates with PC at 115,200 bps 8N1
//
#define LED1 2
#define LED2 3

void setup()
{
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  Serial.begin(115200);
  menu();
}

void loop()
{
  int m = readMenu();
  switch (m)
  {
    case 1:
      // Turn on LED 1
      digitalWrite(LED1, HIGH);
      break;
    case 2:
      // Turn off LED 1
      digitalWrite(LED1, LOW);
      break;
    case 3:
      // Turn on LED 2
      digitalWrite(LED2, HIGH);
      break;
    case 4:
      // Turn off LED 2
      digitalWrite(LED2, LOW);
      break;
    case 5:
    {
      // VT100 reset cursor to end of menu (row 15, column 1)
      char resetCursor[] = {27,'[','1','6',';','1','H',0};
      Serial.print(resetCursor);
      Serial.print("A0: ");
      // Read Analog 0 input and display data
      Serial.print(analogRead(A0));
      break;
    }
    default:
      break;
   }
}

// Waits in a loop until key is pressed
// then returns digit selected
int readMenu()
{
  while (!Serial.available())
  {
    delay(100);
  }
  return Serial.read() - 48;
}

// Displays menu
void menu()
{
  // Clear screen
  char buf[] = {27,'[','2','J',0};
  Serial.print(buf);

  // Print menu
  Serial.println("\n\n\n\n\n");
  Serial.println("1....LED1 on");
  Serial.println("2....LED1 off");
  Serial.println("3....LED2 on");
  Serial.println("4....LED2 off");
  Serial.println("5....Read A0");
  Serial.println("\n\n Select 1..5");
}

 

When you run this, you will get a menu with 5 options. We demonstrate how to position the cursor on the screen using escape commands. Look at the code that prints the value of A0 on the screen for an example.

Menuing is a simple but effective way to get your PC and Arduino talking to each other.


If you'd like to subscribe to this blog, please click here.

Categories
Uncategorized

Duplicating an existing item

Copying an item that is already on the market is a topic that continues to come up no matter what kind of manufacturing business you have.

The guys running machine shops, for example, are very familiar with people walking in off the street wanting a special washer, or bracket made. Often they are very upset at being told that the doohickey they could purchase at WalMart for $20 will cost hundreds or thousands to make. Why does this happen?

Let’s say you broke a part for a lawnmower. It’s a very simple piece of metal with three holes that is bent into a Z shape. It looks like a 5 minute job.

So you walk into a sheet-metal shop and ask how much it would cost to have one made, since you can’t wait a week for a replacement to be shipped. They shop foreman looks at it and says $500.

Why does it cost $500? Well, someone has to take that part, measure each dimension, measure the distance of each bent section, the offsets to all the holes, measure hole dimensions, material thickness, etc. Then the raw metal stock has to be retrieved from inventory, marked out, cut to size, drilled. The bender has to be set up, metal bent, edges deburred, etc. And that’s assuming that the shop even has the free time to get to it within a  reasonable time and that no jobs in progress have to be stopped. Under the best case, it could easily take half a day to make the first bracket. Of course, the next 500 could be made in the next half day now that all the design and setup work is done, but you only need one, so that doesn’t matter.

Much easier to just order it online for $15 + shipping!

It’s no easier in our world of electronics. In fact, it’s complicated by the fact that most of what we do involves the invisible aspect of software. A seemingly simple item that has a parts cost of $10 and sells for $100 could have $20,000 of engineering time behind it to create the first unit. Sure,  as a hobbyist you could copy it and do an awesome job and in the end it only cost you $10, but that ignores the cost of your time. If you’re doing it for fun, who cares about accounting for the time? The problem comes when you need someone else to do all or some of the work for you. Even without the overhead of a large engineering firm, that $100 item could still end up costing you $10,000 to make the first unit.

What does all that extra money pay for?

  • Documentation: how to build the next 5,000 units after that first one is done
  • Packaging: designing the enclosure it goes into and where the pushbuttons and LEDs go
  • User interface: does it have a display? Should multiple languages be supported? Is the flow from one screen to the other smooth and intuitive? It’s really easy to build something for your own use, but much harder when it has to be usable by a wider variety of people
  • Parts selection: which components should be used? Who to buy them from? Is anything critical about to be discontinued?

This is only scratching the surface. The point is that very often, asking to duplicate the functionality of a professionally designed item will require an equally professional designer and there won’t be any cost savings. Unless you need something customized for your needs, it is almost always far less expensive to buy an existing item off the shelf.

So, if you do need something specially built, how do you go about it?

Well, in an ideal world you’d have a complete set of requirements, or a detailed specification. In the real world, you typically only have an idea of what you want and need the details filled in.

So, the engineer you’re working with may need to know the answer to questions like:

  • Do you need just one, or thousands?
  • Will it use battery power or plug into a wall outlet?
  • Does it need to fit into another assembly?
  • If it measures something, how accurate does it have to be? More accuracy than needed can be expensive!
  • Will it be outside and need to be protected from the elements, or in a nice, clean office environment?

Developing a brand new product, or even a variation of an existing one, is a collaborative process. As you discuss your needs, you may find out that there are many small details that are actually important, but you haven’t had the opportunity to think about before.

In our prototype-building work, we come across this quite often. In the process of discussing a need, often the client realizes that there’s something off the shelf that could be modified instead. And it will cost a lot less than a custom design!


If you'd like to subscribe to this blog, please click here.

Categories
Arduino

Connect bill acceptor or coin acceptor to PC

One interesting application for our PRT232 pulse counter is reading bill acceptors and coin acceptors from a desktop computer.

A coin acceptor is used to pay for a product or service. You’re probably quite familiar with them from using commercial laundry machines or video game arcades. In these situations, they are built into the equipment. However we are seeing an increase in cases where someone is adding a payment facility via a bill acceptor or a coin acceptor to equipment that was not designed for it. An example would be a kiosk that dispenses water. There are many of these in grocery stores where you can fill up your bottle with pure water and then pay for it at the counter. But many entrepreneurs are taking water dispensers and making it possible for the customer to pay directly at the point of sale.

These acceptors work by sending a number of pulses corresponding to the coin or bill that is entered. e.g., a quarter may provide a single pulse while a dollar bill gives four pulses. Our pulse counting devices are obviously a natural fit for the application. They will accept the pulse output from the coin acceptor, count the pulses and provide a  serial RS232  interface to the PC making it simple to tally the dollar amount entered.

By using a counter to RS232 device like our PRT232 or PRT232F (6 count inputs), now the PC computer can be used to track usage, make automated daily reports, provide the customer enhanced user interface and so improve your sales performance.

We provide a sample of software that uses the PRT232 as a dispense controller. It can be easily modified for your own use. We also offer custom software and hardware development in this area.

One example of what we have done is the situation when the bill acceptor must be connected to a machine that doesn’t correspond exactly with its operation. For example, perhaps you are building a vacuum cleaner that the operator pays to use (as often found at a car wash). The vacuum may have been designed to start with a contact closure, but in order to use your coin acceptor, you must translate the four pulses from four quarters being deposited into a single output. We have designed electronics to solve exactly this situation. If you need something similar, contact us.


If you'd like to subscribe to this blog, please click here.