Thursday, February 15, 2018

Interactive Arduino Uno Ethernet Shield Program

I have developed a Interactive Arduino UNO Ethernet Shield demo program.  It requires lots of memory.  It was a offshoot while I was developing a Ethernet based method of updating my LED signs. However the UNO suffers from a memory shortage just running this demo program!  This is what the screen looks like.  You cannot change D10-D13 because they are used by the Ethernet card.

Here is the video:

I have finally found an easy way to post code on blogger!  Thanks to "" the code can be easily formatted.

 // Arduino Ethernet Interactive with table  
 // By bob Davis  
 // Based on code from Rui Santos  
 #include <Ethernet.h>  
 int led1 = 2;  
 int led2 = 3;  
 int led3 = 4;  
 int led4 = 5;  
 int led5 = 6;  
 int led6 = 7;  
 int din1 = 8;  
 int din2 = 9;  
 int din3 = 10;  
 int din4 = 11;  
 int din5 = 12;  
 int din6 = 13;  
 int data1 = 0;  
 byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  //physical mac address  
 byte ip[] = { 192, 168, 1, 21 };           // ip in network  
 EthernetServer server(80);               //server port     
 String readString;  
 void setup() {  
  // Open serial communications and wait for port to open:  
  pinMode(led1, OUTPUT);  
  pinMode(led2, OUTPUT);  
  pinMode(led3, OUTPUT);  
  pinMode(led4, OUTPUT);   
  pinMode(led5, OUTPUT);  
  pinMode(led6, OUTPUT);  
  pinMode(din1, INPUT);  
  pinMode(din2, INPUT);  
  // start the Ethernet connection and the server:  
  Ethernet.begin(mac, ip);  
 void loop() {  
  // Create a client connection  
  EthernetClient client = server.available();  
  if (client) {  
   while (client.connected()) {    
    if (client.available()) {  
     char c =;  
     //read char by char HTTP request  
     if (readString.length() < 100) {  
      //store characters to string  
      readString += c;  
      } //if HTTP request has ended  
      if (c == '\n') {       
       client.println("HTTP/1.1 200 OK"); //send new page  
       client.println("Content-Type: text/html");  
       client.println("Refresh: 2"); // refresh every second   
       client.println("<style>table, th, td {padding: 3px; border: 1px solid black;</style>");  
       client.println("<table width=350><tr>");  
       client.println("<th colspan=6>Digital Outputs</th>");  
       client.println("<td><a href=\"/?button1on\"\">Turn On</a></td>");  
       client.println("<td><a href=\"/?button2on\"\">Turn On</a></td>");  
       client.println("<td><a href=\"/?button3on\"\">Turn On</a></td>");  
       client.println("<td><a href=\"/?button4on\"\">Turn On</a></td>");  
       client.println("<td><a href=\"/?button5on\"\">Turn On</a></td>");  
       client.println("<td><a href=\"/?button6on\"\">Turn On</a></td>");  
       client.println("<td><a href=\"/?button1off\"\">Turn Off</a></td>");    
       client.println("<td><a href=\"/?button2off\"\">Turn Off</a></td>");   
       client.println("<td><a href=\"/?button3off\"\">Turn Off</a></td>");    
       client.println("<td><a href=\"/?button4off\"\">Turn Off</a></td>");   
       client.println("<td><a href=\"/?button5off\"\">Turn Off</a></td>");   
       client.println("<td><a href=\"/?button6off\"\">Turn Off</a></td>");   
       client.println("<th colspan=6>Digital Inputs</th>");  
       client.println("<td align='center'>");  
       client.println("<td align='center'>");  
       client.println("<th colspan=6>Analog Inputs</th>");  
       for (int aChannel = 0; aChannel < 6; aChannel++) {  
        int sensorReading = analogRead(aChannel);  
        client.println(" <td align='center'> ");  
       //stopping client  
       //controls the Arduino if you press the buttons  
       if (readString.indexOf("?button1on") >0){ digitalWrite(led1, HIGH); }  
       if (readString.indexOf("?button1off") >0){ digitalWrite(led1, LOW); }  
       if (readString.indexOf("?button2on") >0){ digitalWrite(led2, HIGH); }  
       if (readString.indexOf("?button2off") >0){ digitalWrite(led2, LOW); }  
       if (readString.indexOf("?button3on") >0){ digitalWrite(led3, HIGH); }  
       if (readString.indexOf("?button3off") >0){ digitalWrite(led3, LOW); }  
       if (readString.indexOf("?button4on") >0){ digitalWrite(led4, HIGH); }  
       if (readString.indexOf("?button4off") >0){ digitalWrite(led4, LOW); }  
       if (readString.indexOf("?button5on") >0){ digitalWrite(led5, HIGH); }  
       if (readString.indexOf("?button5off") >0){ digitalWrite(led5, LOW); }  
       if (readString.indexOf("?button6on") >0){ digitalWrite(led6, HIGH); }  
       if (readString.indexOf("?button6off") >0){ digitalWrite(led6, LOW); }  
       //clearing string for next read  

Sunday, February 11, 2018

Chevy HHR Failure to Start or Start then Stall Problem

This fall my HHR started having issues with starting.  By Christmas time it no longer started.  At one point I spent over 30 minutes trying to start it.  When it started there was a multicolored puddle of gas under the tailpipe.  It always smelled of too much gas.  I changed the spark plugs and the old plugs were covered in black from too much gas.

The HHR would sometimes start, and if I pumped the gas it would eventually sustain.  Eventually I discovered that if I floored the gas pedal before starting it it would usually start.  Through research I discovered that flooring the gas pedal should shut off all gas to the motor!  Eventually the check engine light came on.  Here are the codes and what they meant.

The codes are:
P0300 Engine Misfire Detected
P0107 Manifold Absolute Pressure (MAP) Sensor
P0122/P0123/P0223 Throttle Position (TP) Sensor.
P0171 System too Lean

The auto store wanted over $250 in parts.  I bought the MAP sensor on eBay for $10 and the Throttle body form the 1490 motors (an auto salvage place) for $40.  The exact same codes came back on again.  I was getting really frustrated.  Then I got thinking, how could so many sensors be so wrong?  So I decided to replace the motor ground wire.  When I looked at the old wire one end seemed loose.  I puled on it and the wire came right out!  After close examination I determined that the wire was never crimped into the connector.

Here is the new crimped and soldered triple ground wire.  It runs from the right side of the motor to the right strut tower.

This is a close up of the bolt on the cam cover that the ground wire is connected to.

Now I just touch the key for a fraction of a second and the car starts right up!