Monday, November 27, 2017

Arduino Project One: More about that Hall effect sensor

Well, I've spent my spare time today doing more research into using Hall effect sensors as proximity sensors. Sometimes you just have to know which questions to ask and how to ask them.

It turns out that the SparkFun ACS712 product may be overkill, or else the wrong part for the job. What I really need are a one-dollar sensor and a ten-cent resistor. This article tells how to do it: https://diyhacking.com/arduino-hall-effect-sensor-tutorial/ .

The AH3364Q-P-A, from Diodes Inc.


Better yet, here's a sensor that's all ready to go:





It's available from Digi-key, Newark/Element14 or Amazon for about $14.



I'm going to see if I can bend one of the SparkFun boards to my will, since I already have them. If I can't, then  I'll place an order for the parts I need.

You live and you learn.

To read the other postings about this project, click here and scroll to the end.

Sunday, November 26, 2017

Arduino Project One: A detour into 3D printing

This is a sidebar to the main project thread. This is all about 3D printing.

By the way, as this entry shows, I'm a babe in the woods when it comes to 3D printing, both the software used to create the models, and the procedure to transfer the model to a printer and to print them. Advice from my readers — knowledgeable and useful advice — would be appreciated. Feel free to add a comment.

In my last update, "Lots of Progress", I repeatedly mentioned SolidWorks because I thought it was the only game in town.

SolidWorks, really good 3D design SW by Dassault Systemes

Hah.

Our local library has two 3D printers. They suggest Tinkercad for casual 3D design work, Sketchup for more serious 3D design work, and Cura LulzBot Edition for printing your design on one of their LulzBot printers.

Tinkercad, by AutoDesk (that's a Raspberry Pi case)
Sketchup, by Trimble, Inc. (this screenshot is from when it was a Google product)
Cura LE (Lulzbot Edition)


Know what? All of those software packages are free. Actually, Sketchup is available in a free and a Pro ($695 - cough) version.

Sketchup has grown up since Google bought it from that little company in Boulder and encouraged people to use it to plant structures all over Google Earth.

So now I have my 3D printing toolpath defined. As with Corona SDK, I'm sort of familiar with the technology from my computer-game-programming days. I'm sure it's come a long way in 12 years, but it's nothing I can't pick up quickly.

UPDATE, THE NEXT DAY:

Hey! I already have Wings 3D on my computer. It's part of my game-programming toolpath! It can export StereoLithography (.STL) files, the preferred file format for Cura LE. Wings 3D is open source and supported by a huge community.

Wings 3D, a powerful 3D modeler used by the gaming and CGI industries.

I may not need to install any new software to do my 3D designs. We'll see ...

UPDATE, THREE DAYS LATER:

I totally ignored 3D Builder, an app first included in Windows 8.1 and currently part of Windows 10. It looks like 3D Builder is for the casual user, similar to Tinkercad. Most screenshots I've found are for toys and trinkets, but here's a not-so-casual design that looks pretty impressive.

3D Builder by Microsoft, now an integral part of Windows 10

If you don't use 3D Builder, then it and its companion apps, such as Paint 3D, are simply a waste of space on your hard disk. But if they're there and they're free, they may be worth a look.

Searching online for information on 3D Builder, I haven't found anything written about it (I mean, like reviews or tutorials) that is all four of these:
  1. current
  2. serious and useful
  3. written by a serious user, not just a fan or a professional reviewer
  4. offered by a third party (not written by Microsoft or published on a Microsoft page)
I welcome any serious and useful input from my readers, about 3D Builder.

UPDATE, 15 AUGUST 2019: Two years later, the 3D design landscape has changed. As I finally sit down to design the enclosure for my Arduino project, I re-review my toolset and make a few changes of my own. Read about it here.


To read the other postings about this project, click here and scroll to the end.

Arduino Project One: Lots of progress

Introduction

I got to put a lot of time into the project this weekend, and I got some cool stuff done. I ... well, here are two pictures for you, and then the details.

Things glowing in the dark

Lit by a desk lamp - I have to learn to take better pictures.

Hardware fully assembled

I put all the hardware pieces together. In the picture above, you will see the Arduino stack at the top. You've seen this before.

The breadboard has two new peripherals. First, at bottom center is a 16-by-2 liquid crystal display that I found while looking for jumper wires in the Sunfounder Project Super Starter Kit. This LCD can run with either a 4-bit or an 8-bit interface, plus 2 more digital pins for the RS and Enable signals. 

Second, the little red guy on the right is the Hall Effect sensor. When installed, this will be on the other end of a ten-foot long cable, mounted to the lintel.

You will notice a potentiometer on the left side of the breadboard. That's to control the contrast of the display. This is absolutely necessary with an LCD display. In the final enclosure, I'll use a trim pot that can be adjusted with a jeweler's screwdriver, through a hole in the enclosure.

Arduino software (almost) complete

The Arduino program is almost fully fleshed out. It searches for a Wifi router / access point, connects to it, and displays the SSID (the router's name) and its own IP address. Internally it has a list of access points, and cycles through them until it makes a connection.

In case of power failure, the Arduino program restarts, and with any luck the ESP8266 will have saved the connection information from before the power failure. If not, it will take several minutes for the router(s) to reboot, so the ESP8266 will count down 10 minutes on the display and then try again.

Once it has a connection, it starts a TCP server and opens a socket on an out-of-the-way port, to listen for clients. Every ten minutes it pings the router to make sure the Wifi connection is still good. 

That's where things stand right now.

When a client opens a connection to the server, well, that code is still in skeleton form. Before I can finish it, I have to write a client program in Python or C (or Corona!) to exercise the connection. That's one of the next steps.

The display

This was a bit of serendipity. I'd forgotten that Sunfounder kit came with an LCD. This is the standard 16x2 display based on the common ST7066/HD44780 parallel interface. This is a white-on-blue one with not very good contrast, so I'll buy a white-on-black or red-on-black one for the final product. I'd really like an old-fashioned, dot-matrix alphanumeric, 16x2 red LED display, but I haven't seen any of those for a while.

The display uses 4 digital pins for data, and one each for RS and Enable, so it fits within my pin budget.

Incorporating it into the code was a cinch, thanks to the Arduino LiquidCrystal library.

Detour: Who (or what) is "Eorlingas"?


For those of you who already looked it up on the Web, congratulations. For those of you who didn't even have to look it up ('cause you already knew!), I offer you my deepest regards.

For years, every new computer, callphone and game system in our family has borne the name of a fictional horse. When high-speed Internet finally made it to our neighborhood (yes, children, some of us first got our Internet through the phone line - at 2400 bits per second!), we needed a good name for our router, and we chose Rohirrim, the formal name for the Riders of Rohan, from The Lord of the Rings. Since that time, we have worn out or obsoleted four routers, and we're on our fifth one. It's the Fifth Detachment of the Rohirrim, or FifthRohirrim

The architecture of our house is such that the back rooms don't always receive a good signal from the router. I want the router to be hard-wired into our Xbox and our TV, so I can't move it. So, I installed a Wifi repeater in the back of the house. (By sheer coincidence, although I'd love to claim clever planning, this repeater is located about six feet above the garage door opener.) The repeater can't be named after a horse, since it's part of the infrastructure, not a computing device.

"Rohirrim" is an ancient Gondor word. The Rohirrim didn't use that word to identify themselves. In the ancient language of Rohan, they were descended from a king named Eorl, hence they were the Sons of Eorl — the Eorlingas.

I will claim clever planning for that one.

Back on the main road: the Hall effect sensor

I decided to try the ACS712 dev board first, because it has built-in trim pots for Vref and gain. I only had to connect it to 5V, ground, and an analog input on the Arduino. I wasn't happy with its performance at first. The voltage level drifted all around. I finally got it to settle down, but I can't have it drifting like that in real life.

When I finally got it settled down, I used a refrigerator magnet to manipulate it. I got the Vref and gain pots adjusted so that it pegged at 0.0 V without the magnet, and at 5.0 V with the magnet touching the chip.

Some voltage level in the circuit is floating. I don't understand the circuit well enough to fix it yet. Maybe I need to put a load (you know, a resistor) between the two current input pins.

Other than that, the sensor just works without complaint or fuss. Clearly, I have more homework to do before I can use it in real life, but this weekend's results were promising.

It needs a case, an enclosure

I've been thinking about this for a while. I'm going to have to put the Arduino in a case.

All of the Arduino Uno R3 enclosures I've found so far are for just the Arduino Uno R3 board. Once you add a shield to your Arduino, it outgrows the enclosure.

A generic project box might be okay, but it can't be metal, because of the Wifi.

I thought of 3D printing one. I don't know SolidWorks, which I think is what everyone uses, so I'd have to learn SolidWorks. I looked for ready-made 3D printable designs, and the first one I found was, I'm really sorry to say this, ugly

Okay, I just looked again, and there are some better-looking ones out there. None of them solve my height issue, but if I can get their source and manipulate it in SolidWorks or something, then I can take care of that myself.

I also need to include openings for: the LCD, the contrast adjustment for the LCD, and any LEDs I want to make visible.

I think that making the enclosure, and fitting everything in it, is going to be more work than the hardware and software parts of the project. Maybe I'll just use a cardboard box, an X-Acto knife, and clear packing tape. I'm only half-kidding.

The sensor needs an enclosure too

I can't just nail the Hall effect sensor to the beam in the garage. It will be exposed to a rather harsh environment. I may need to 3D print a case for it as well.

Alternatively, I could encapsulate it in potting compound. That would be just as good - but I'd have to find a way to include mounting holes. And whatever I do has to be nonmetallic, or at least nonmagnetic or nonferrous. Hmm. That will take more thinking.

What's next

I've made good progress so far. Here's what I still need to do

  1. Write a TCP client in Python or C, to exercise the server.
  2. Port that TCP client to an Android app, using Corona SDK.
  3. Finish the Arduino code:
    1. Hall effect sensor
    2. Debug the TCP client-handling code
  4. Finish the Android app as well.
  5. Get a real LCD display.
  6. Design and fabricate enclosures for the Arduino stack and the sensor.
  7. Assemble the whole thing.
Other items that come to mind:
  1. Try the breadboard design in the garage before I commit to a final design.
  2. Run Wireshark while the server is running, to see who tries to call my Arduino.
  3. Configure my router to allow passthrough only on the designated port, or from designated clients.
  4. Exercise the challenge-and-response algorithm.
  5. Document the whole thing.


To read the other postings about this project, click here and scroll to the end.

Wednesday, November 22, 2017

Arduino Project One: The Arduino program takes shape

Introduction

This week, I created the skeleton of the program for the Arduino stack. I'm not ready to share my source code yet. Let me get the rest of the meat on the skeleton first.

Security

I listed some ideas for my cybersecurity scheme last week. I have incorporated all of the measure I listed into my program. I'm sure there's a hacker out there somewhere who will figure it out. My description here isn't meant as a challenge to them. It's just to inform you of some simple things that worked for me.
  1. I've chosen a port number, out of the 65,535 available, that's easy to remember.
  2. The server will only accept client requests from specified devices, and not from the world at large. Although MAC address spoofing is a thing, this will stop all but the most determined hackers.
  3. The server will use TCP instead of HTTP, trading long and legible transactions for short and incomprehensible ones.
  4. The router autoforward will be tweaked so that only TCP requests via the specified port can get through to the Arduino.
  5. The server uses a challenge-and-response mechanism, like two spies swapping passwords. When a socket is opened and the client's authorization is verified, the server sends the client a randomly-generated numeric sequence. The client must reply with the proper numeric sequence. I intend to keep the details of this algorithm proprietary. Sorry, folks.
  6. It may be necessary to have the server go through the challenge-and-response several times in the life of a connection.

Robustness and Reliability

The terms "robust" and "reliable" are not synonymous. "Reliable" means that the system will not fail during regular operation as a result of stupidity — my stupidity, to be specific. "Robust" means that the system can recover from power failures and loss of Wifi signal all by itself, without any human intervention.

When the Arduino is first powered up, or when it recovers from a power failure, it looks through its list of available Wifi routers and tries each one in turn, until it gets a connection. If it doesn't get a connection at all, then it sets a timer for 10 minutes and tries again. This is because it can take DSL modems and Wifi routers a while to recover from a power failure too, so if it doesn't catch one the first time, it gives it time to reboot.

After it gets a Wifi connection, it sets up a permanent TCP socket to listen for client requests. Although client requests are the whole reason for its existence, they're not very frequent, so it will spend most of its time being idle.

Every 10 minutes or so, it will ping the Wifi router, to verify that it still has the connection. If the ping fails, then the Arduino has lost the connection, so it goes through the power-up sequence again.

When a client requests a connection, the Arduino opens a temporary TCP socket for that client. It will be up to the client to send a TCP query every second or so, unless it's sending a button-push command. It's up to the client, whether it's a webpage or an Android app, to politely say goodbye and close the socket when it exits. (I'm sure that Corona SDK and JavaScript include onExit() event servers, or something similar.)

But it's possible for the remote client to just drop the connection - battery dies, phone gets run over, computer blue-screens, that sort of thing. So the Arduino will set a watchdog timer when it opens the temporary socket. Any query from the client resets the watchdog timer (that's called "kicking the watchdog" in Embedded Programming Land). If the client doesn't send a query for a long time, the watchdog timer expires, the Arduino says goodbye to the client in case the client is listening, and then the Arduino closes the socket.

TCP/IP

I haven't decided whether to allow multiple clients yet. Normally, only my wife and I will be using the app, and very seldom at the same time. It would be crazily rare to have three people trying to control the garage door at once. Still, it would be annoying for one person to open the app on their phone, and the other person try to open it on theirs, and get the equivalent of a busy signal. So I'll probably have to allow multiple clients.

I haven't put in the actual TCP/IP commands yet. That's for later. 

Sensor and Actuator

I haven't wired up the Hall effect sensor, and I haven't written any code for it. And although I haven't actually connected the relay to the garage door opener yet, I have written the relay code, and I've verified that the relay shield plays nicely with the ESP8266 shield.

What's Next

I'll stick with this program until it's finished. Then I'll need to write a server in plain vanilla C, or maybe Python, to test it. Once the program is finished and it works, I'll post the source code.


To read the other postings about this project, click here and scroll to the end.

Thursday, November 16, 2017

Arduino Project One: Moving right along

I have a lot to report this time. Good things have been happening.

No Corona app yet: More Arduino programming

I didn't write the app on yet. I thought I'd better characterize the Arduino hardware stack a little more.

First, I wrote a little relay demo that turns the relay on and off every second. I needed to find out how easy it was. It's ridiculously easy.

Then I wrote a webserver for the Arduino/ESP8266. I let the thing run open-loop. I tried to access the Arduino's webpage from both my phone and my PC. I was only successful part of the time. I read some online reviews of the ESP8266 shield, and some people complained that it worked once, and never again. Others complained that it didn't have the advertised range. I took two different approaches to this problem.

  1. I modified the SparkFun ESP8266 libraries to print out more information about the clients it was connecting with. I need to know the client's IP address, because other than my own phone and maybe a JavaScript TCP client on my website, nobody should be monkeying with this IoT gadget. I know that full-PC webservers always snoop clients' IP addresses. So I had the Arduino send a command AT+CIPSTATUS to the ESP8266 every time it got a client request, and  log the text of the client request on its serial output.

    After I was finished testing the webserver using the browsers on my phone and my PC, I left the logger running while I did other stuff. HOLY COW! I think that the passthrough is enabled by default on my router. My little Arduino was fielding requests from all over the world. I never did see any IP addresses, but good grief, there's a bunch of nosy machines out there. I couldn't tell if they were humans, spiders, or bad guys. I'll definitely need to use a proprietary port number on my webserver, and I'll definitely need to put restrictions on the passthrough.
  2. I dug up a Coredy E300 repeater/AP/router I've had sitting around for a year or longer, and configured it as a repeater. I plugged it into a wall outlet in the bedroom, almost exactly six feet above the garage door opener. Bonus! This also gives me better Wifi reception in the bedroom and the loft.

Don't give up on the Electric Imp yet

I should mention that this week I got an automated email from SparkFun asking me how I liked my Electric Imp purchase, and reminding me that they were available for tech support and troubleshooting. If I didn't know it was automated, I would have thought they were reading my mind. Or my blog. I will follow up with them on the Electric Imp. It would be cool to get it working.

HTTP vs. TCP

I noticed a lot of dropped bytes in the Arduino's webserver log. I don't know whether they were dropped between the client and the ESP8266, the ESP8266 and the Arduino, or the Arduino's serial port and my PC's Arduino terminal window. I should try using puTTY for my serial I/O and see if it has the same problem.

In the meantime, that got me to thinking: maybe I don't need a full-blown webserver on this project. I mean, Rick S. wrote an awesome webserver for RLE's products, and I learned a lot from working on those projects, but if the user interface is going to reside on an app or on a protected page at my own website, then all I'll need between the Arduino and the client are as follows:

From the client:
  • connection request
  • response to the Arduino's security challenge
  • garage door status query
  • button push
  • response to the watchdog signal ("Yes, I'm still here")
From the Arduino:
  • security challenge in response to connection request
  • garage door status, either in response to a query or initiated by the Arduino
  • acknowledgement of button push
  • a watchdog signal ("Are you still there?")
I don't need HTTP for that. TCP will work just fine.

Security

I am paranoid about a hacker getting into the Arduino, figuring out what it's doing, and using it to burgle my house. I thought of somehow incorporating a public/private key into the interface, but I don't know if the Arduino supports that. So I'll be taking these other security measures:
  • Using a proprietary port number. There's only 65,535 to choose from.
  • Using TCP instead of HTTP, making for shorter messages which will be unintelligible to anyone else.
  • Only accepting client requests from specified devices, and not from the world at large.
  • Tuning the router settings so that it only passes through requests using that port, and from those devices.
  • Incorporating a challenge-and-response feature. When a socket is opened and the client's authorization is verified, the server sends the client a randomly-generated numeric sequence. The client uses the numeric sequence to compute and send the server a numeric sequence in response. If the client's response isn't what the server expected, then the server closes the socket.
The challenge-and-response feature isn't very sophisticated, and it may not even be necessary, given all the other precautions. We'll see.

The system will still be vulnerable to DDoS attacks. There's not much I can do about that. Everything connected to the Internet is vulnerable to DDoS attacks.

A short hardware update

This week I stopped at Home Depot and bought 20 feet of shielded, round, 28 gauge 4-conductor cable, suitable for this project and others. The final installation of the Hall effect sensor will only need 10 feet.

I'm considering what kind of enclosure to get (or make) for the Arduino stack. It will need to be plastic, or at least transparent to Wifi signals. I'd like to have some status LEDs visible through it. 

Red-on-black LCD display from Sparkfun
Red-on-black LCD display from Sparkfun

I got a wild-hair idea this evening, that it would be good to have a small LCD or LED display on the enclosure, always displaying short status messages. I can start without it, and it's not really necessary, but it would be a nice touch.


To read the other postings about this project, click here and scroll to the end.

Saturday, November 11, 2017

Arduino Project One: Corona hits a roadblock

This project has many different facets, and a lot of new things to learn. Development is definitely not linear. It can go in many different directions simultaneously — and that's a good thing, because some of those different directions run into roadblocks.

The Corona Roadblock

For example, there's nothing that says I have to have the webserver running on the Arduino stack before I start working on the Android app. With that in mind, I concentrated on learning Corona this week. Since I once ran a game programming company, I'm familiar with this genre of software. So it seemed like a safe and comfortable place to go.

I downloaded the Corona SDK and worked through the Getting Started tutorial. The last step was to do a live build, installing a development version of your app on your Android device.

Sadly, it was not to be. When I selected File > Build > Android from the Corona Simulator, I got this error message:
Stupid error message.


I selected Yes, and I ended up downloading and installing Java SE Development Kit 9.0.1 for Windows, 64-bit. (It doesn't give you much choice.) After it was installed, I ran Corona and selected File > Build > Android again. Same error message.

I went to the Corona community forums and found this recent thread, which says that Corona SDK 2017.3135 doesn't support the 64-bit JDK. But a fix is coming, and in the meantime, the awesome Corona staff posted a link to the older, 32-bit, Java SE Development Kit 8u151. The word on the Web is that multiple JDKs can exist on my computer at once, so I'll leave 9.0.1 installed.

Corona's not the only game in town. But I'm comfortable with it, with my gaming background. My son has used it successfully and speaks highly of it. And I really don't feel like downloading, installing, and learning yet another development kit. I already have enough new tools to learn. But I went ahead, and downloaded and installed 8u151.

It works! Back in Corona, File > Build > Android built a .apk file for me.

Then I needed to practice installing it on my phone. The Corona Signing and Building page says that if I don't have the Android SDK installed, I can upload the .apk file to a webserver, then download it to my phone, go to the Downloads directory, and simply tap on the .apk file to install it. However, the Signing and Building page also says that I can use the adp install command to install the .apk file directly.

Two problems arose. First, the debug version of the app was so big that it exceeded (what was left of) my daily limit on my webserver, so detouring through the webserver was out of the question for the day. Second, adb is the Android Debug Bridge, which is part of the official Android SDK, and I inferred from the Corona documentation that adb is rather important.

So even though I didn't want to "download, install and learn yet another development kit," that's exactly what I did. First, I mistakenly downloaded and installed the Android Studio IDE. If adb was part of Android Studio IDE, it was hidden very well. I couldn't find it. Then I looked on the Corona debugging page, and it gave some clues on how to download the command-line-only Android SDK tools. That was a relief — if I had to download the entire Android Studio IDE, why was I even bothering with Corona? So I happily uninstalled Android Studio IDE.

According to the debugging page, I needed to install at least the Android SDK Tools (I had to scroll down to the bottom of the page to find them) and Android SDK Platform Tools. It took some sleuthing to find those links. The adb tool is in the Platform Tools, so I had to make sure I had that one.

I unzipped the downloaded files and stored them in C:\Program Files\Android\sdk-tools, in the subdirectories tools and platform-tools.

For a test, I tried installing the StarExplorer app from the Corona SDK "Getting Started" tutorial. It took a couple of tries to execute the adb install command:
C:\Program Files\Android\sdk-tools\platform-tools>adb install -r "\Users\Ray\Documents\Corona Built Apps\StarExplorer.apk"\Users\Ray\Documents\Corona Built Apps...d. 2.8 MB/s (27069109 bytes in 9.069s)        pkg: /data/local/tmp/StarExplorer.apkSuccess
C:\Program Files\Android\sdk-tools\platform-tools>
Finally it was successful - but then I couldn't find the app on the phone. I looked in the Apps pages, but StarExplorer wasn't there. Then I looked for the /data/local/tmp directory using the My Files app and I couldn't find it.

It turned out that I was being impatient. It just took a while for the phone to update its files. After about 20 minutes, I went back to the Apps pages and I found it. The app ran perfectly on my phone.

To make it a little easier the next time I install an app, I added the paths C:\Program Files\Android\sdk-tools\tools\bin and C:\Program Files\Android\sdk-tools\platform-tools to my PATH environmental variable. Now I don't have to type in adb's entire pathname to run it.

So even though it was a real trip down the rabbit hole, collecting and installing all the tools to build and install the app on the phone, it finally worked.

Corona Does Networking!

On the bright side, I did find out this week that Corona has a network library. Reading the API documentation and looking at some examples, I'd say that this will do the trick nicely. 

So What's Next?

Now I can write the app. Once it's completed, I'll go back to the Arduino. I have to do the following:
  1. get the relay clicking
  2. try out those Hall effect sensors
  3. write the webserver and exercise it from my home network
  4. get my DSL modem / Wifi router to passthrough HTTP requests to the Arduino webserver.
  5. exercise the Arduino webserver from outside my home network

What about Internet privacy?

One thing that I haven't thought about until now: I need to research privacy / security measures for the Arduino webserver. I don't want the whole world to know when my garage door is up or down, and I definitely don't want strangers activating it. Moreover, I don't want someone in Uzbekistan hijacking my Android, turning it into a bot, and using it to mount a DDoS attack on an embassy somewhere.


To read the other postings about this project, click here and scroll to the end.

Veterans Day, Remembrance Day, Armistice Day - always remember and never forget

The poppies at Flanders Fields, a large military cemetery in Belgium. (Image copied, without permission, from dailyhive.com)

November 11 is a holiday to remember the cessation of hostilities in World War I, which happened 99 years ago. The guns went silent at the eleventh hour, on the eleventh day, of the eleventh month of 1918.

For 20 years, WWI was known as The Great War, and was nicknamed The War to End All Wars. That didn't work, did it?

In 1919, U.S. President Woodrow Wilson declared November 11 Armistice Day, to commemorate the end of WWI. In 1954, it was renamed Veterans Day.

Also in 1919, Great Britain's King George V declared November 11 Armistice Day. In 1931, in Canada, the holiday was renamed Remembrance Day, and is celebrated as such in all countries of the Commonwealth of Nations (what's left of the former British Empire).

Most people, including me, confuse the meanings behind Veterans Day and Memorial Day. Veterans Day is to recognize and honor all of those who have served in the military. Memorial Day is to remember and honor those who died while in military service. (Thanks to Wikipedia for making that distinction.)

Personally, I think we should honor all of them, all of the time.
Today, I recognize and honor the following:

  • COL Edwin French, USAAF, killed 1946 in occupied Japan.
  • SGT Donald McIlveen, Royal Canadian Army, who fought in Italy in 1944-1945 and came home to live a long and happy life.


... all of my friends who fought in Vietnam, too many to name ...

... and these members of the next generation, who either recently served or are still serving:

  • Jason Depew
  • Jennifer Depew
  • Robyn Chalupa
  • Todd Williamson
  • Alisha McKee
  • Van James Walther Jr
  • Chris Barela
  • Casey Barnum
  • Nathan Murphy
  • Heather Hansen's husband, Joshua Hansen 
  • Dustin A Giesick
  • Don Bugg
  • Peter Boone
  • Nikki Yaste and her husband, Alex Yaste
  • Tom LeNeave
  • Ruth Ann LeNeave


... and any friends that I forgot to list.

Sunday, November 5, 2017

Arduino Project One: (Not really a ) Progress Report

For a project with no timetable or deadline, this one is progressing nicely.

Hardware

I've collected all of the electronics I will need. Here's a picture of them:
The stack in the center includes: the Arduino (this one's an Elegoo Uno R3) on the bottom; the Sparkfun ESP9266 Wifi shield in the middle; and the Evil Mad Scientist relay shield on top. In front of the stack are two ACS712-based Hall effect sensor boards. The one on the lower left is just the sensor. The one on the lower right includes an amplifier and a couple of adjustment potentiometers.

I will need to enclose the sensor in either a block of potting compound, or a 3D-printed plastic case. It will be in a place rather exposed to the elements, and I don't need it to break down at critical moments.

I'll need to either make a 3D-printed case for the Arduino stack, or find a project box that fits it. Since it will be mounted next to the garage door opener motor, it won't need environmental protection, but it will need to be protected from vibration, and it will have to be able to connect wirelessly to my router.

I'll also need to get a power supply (a wall wart) for the Arduino stack, and about 20 feet of 4-conductor 28AWG or 24AWG wire for the Hall effect sensor.

Finally, I'll need to verify that none of the signals used on the Wifi or Relay shields overlap. I fear I may already have a collision with the software serial interface on the ESP8266 and a relay control pin.

Software

The code for the Hall effect sensor, while not exactly trivial, is stuff I already know how to do. I've been doing this sort of thing for years.

I ran through the ESP8266 tutorial, and I can set up the ESP8266/Arduino combo as a very rudimentary webserver. I've successfully communicated with it via a browser. That's all I need on that end.

I found a webpage that tells how to connect the ESP8266/Arduino combo to the Internet, including the critical step (new knowledge!) of setting up forwarding through my DSL router/Wifi access point.

I found another webpage that expands on that, using JQUERY and HTML to control a servo - or in my case,  a relay.

I've installed Corona on my computer, but I haven't played with it yet. I hope there's a tutorial in there that gives me hints on how to create an app that can communicate with the ESP9266/Arduino's webserver.

I need to find something about installing public/private keys on the Arduino to keep this tiny part of the Internet of Things from getting hacked.

That's it for now

By next time, I should have the web server running on the hardware stack, and I should have some preliminary testing completed on the sensors.


To read the other postings about this project, click here and scroll to the end.