Showing posts with label Electronics. Show all posts
Showing posts with label Electronics. Show all posts

Thursday, August 20, 2020

Building a Bench Power Supply with the RD6006

I decided to finally upgrade the old home-made switching power supply I've been using for the last 20 years (at some point it becomes more of a fire hazard then a power supply).  Luckily components are a little more readily available these days, and I chose the Riden RD6006 controller.  You can find the components more reasonably priced here (if you can wait a month for shipping):

RD Riden Factory Store

or pickup the components on Amazon (a fairly steep markup, but it will be at your house tomorrow):

RD6006 Controller

60V Power Supply

Case

CR1220 Battery

PC Power Cord

After unboxing and testing the power supply with a test cable, the power supply was ready to assemble:

First install the switch, power terminal, and case fan:


Mount the power supply:


Add the case feet (so the supply screws don't scratch up your desktop):

Wiring took a little bit to figure out; the marking is camouflaged fairly well, but if you look closely you can see an E (for earth ground) and N for neutral (leaving the last terminal being hot):

The jumper cables from the kit were sized correctly:


Next install the case fan temperature controller:


And wire directly to the supply:


The power terminal was pulled from the controller and wires added from the case kit:


Power cable connected to the controller (making sure to honor polarity on the PCB):


Add a CR1220 battery as the mount is beneath the WIFI module:



Install the WIFI module:


Add the controller temperature probe:


Before closing up the case, power it up and make sure all is well:


A project is never done until the wire wraps go on...



Fully assemble the case:


Note that I had a bit of trouble getting all the parts together - the controller JUST fits within the case, and the case is not 100% square, so there was one case screw I just could not get aligned.  All that being said, I'm fairly pleased with the result.

The manual can be found here from the vendor:

And this video was also useful:

Sunday, January 22, 2017

Disassembly of a LED sword toy

One of the kids toys stopped working, and rather than just throw it out, we spent some time taking it apart to see how it worked.  Not sure where this particular sword came from, but if memory serves, this came from an amusement park (one of those carts of gadgets they push around at night, this thing probably set us back 20 bucks).

There were only a few screws holding everything together, and after things were apart, it was easy to see the problem.  Seems one of the cheap batteries failed/leaked, and melted some of the wiring. Pulling everything out of the plastic casing, stripping a few wires and connecting it to the lab power supply (+5v), the LEDs still worked - perhaps we'll keep them and make something else out of this small kit.   The toy contained 5 LEDs, 100uF capacitor, push button, and a small PCB (powered by 3 AA batteries).

See below for pictures...










Wednesday, January 18, 2017

Building a solder fume extractor

In efforts to breathe a little easier in 2017,  a solder fume extractor was built for the workshop, using the following parts:


The plastic components were printed on a Lulzbot Mini using ABS.  The final assembly is shown below.



Sunday, February 28, 2016

Arduino WiFi Weather Web Server Prototype

Building on previous work, the Arduino WiFi 101 Shield will now be configured to broadcast weather information, using a slow but effective temperature/humidity sensor, the DHT-22.

Connecting the device was accomplished with a slightly modified set of procedures from the original example found on AdaFruit. Most notably the use of 3.3V vs 5V to support the different levels on the Arduino Zero.  Note that a 10K pull-up resistor is also used on pin 2.




After compiling and downloading the sketch below, the temperature/humidity was successfully obtained and published/visible on the network via Chrome.



The source code used to implement the WiFi Weather Web Server is seen below.

 #include <SPI.h>  
 #include <WiFi101.h>  
 #include "DHT.h"  
   
 char ssid[] = "mynetwork";     // your network SSID (name)   
 char pass[] = "mypassword"; // your network password  
 int status = WL_IDLE_STATUS;  // the Wifi radio's status  
 WiFiServer server(80);  
   
 #define DHTPIN 2      // what digital pin we're connected to  
 #define DHTTYPE DHT22   // DHT 22 (AM2302), AM2321, RHT03  
 DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor.  
   
 void setup()   
 {  
  // initialize serial:  
  Serial.begin(9600);  
  while (!Serial)  
  {  
   ; // wait for serial port to connect. Needed for native USB port only  
  }  
   
  dht.begin();  
    
  if (WiFi.status() == WL_NO_SHIELD)  
  {  
   Serial.println("WiFi shield not present");  
   // don't continue:  
   while (true);  
  }   
   
  // attempt to connect to Wifi network:  
  while ( status != WL_CONNECTED)  
  {  
   // attempt to connect using WPA2 encryption:  
   Serial.println("");  
   Serial.println("Attempting to connect to WPA2 network...");  
   status = WiFi.begin(ssid, pass);  
   
   if (status != WL_CONNECTED)  
   {   
    // if you're not connected, stop here:  
    Serial.println("Network unavailable, trying again in 10 seconds...");  
    // wait 10 seconds for connection:  
    delay(10000);  
   }  
  }  
    
  server.begin();  
   
  Serial.println("Connected to network");  
  printWifiStatus();  
 }  
   
 void loop()  
 {  
  // listen for incoming clients  
  WiFiClient client = server.available();  
  if (client)  
  {  
   Serial.println("new client...");  
   
   // Wait a few seconds between measurements.  
   delay(2000);  
     
   // Reading temperature or humidity takes about 250 milliseconds!  
   // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)  
   float h = dht.readHumidity();  
   // Read temperature as Celsius (the default)  
   float t = dht.readTemperature();  
   // Read temperature as Fahrenheit (isFahrenheit = true)  
   float f = dht.readTemperature(true);  
   
   // Check if any reads failed and exit early (to try again).  
   if (isnan(h) || isnan(t) || isnan(f)) {  
    Serial.println("Failed to read from DHT sensor!");  
    f = 0;  
    h = 0;  
    t = 0;  
   }    
   
   // Compute heat index in Fahrenheit (the default)  
   float hif = dht.computeHeatIndex(f, h);  
   // Compute heat index in Celsius (isFahreheit = false)  
   float hic = dht.computeHeatIndex(t, h, false);  
    
   // an http request ends with a blank line  
   boolean currentLineIsBlank = true;  
   while (client.connected())  
   {  
    if (client.available())  
    {  
     char c = client.read();  
     Serial.write(c);  
     // if you've gotten to the end of the line (received a newline  
     // character) and the line is blank, the http request has ended,  
     // so you can send a reply  
     if (c == '\n' && currentLineIsBlank)  
     {  
      // send a standard http response header  
      client.println("HTTP/1.1 200 OK");  
      client.println("Content-Type: text/html");  
      client.println("Connection: close"); // the connection will be closed after completion of the response  
      //client.println("Refresh: 5"); // refresh the page automatically every 5 sec  
      client.println();  
      client.println("<!DOCTYPE HTML>");  
      client.println("<html>");  
      client.println("<head><title>Arduino Web Server</title></head>");  
      client.println("<body>");  
        
      client.print("Humidity is ");  
      client.print(h);  
      client.println("<br />");  
   
      client.print("Temperature is ");  
      client.print(t);  
      client.println(" (C) <br />");       
        
      client.print("Temperature is ");  
      client.print(f);  
      client.println(" (F) <br />");       
   
      client.print("Heat Index is ");  
      client.print(hic);  
      client.println(" (C) <br />");       
   
      client.print("Heat Index is ");  
      client.print(hif);  
      client.println(" (F) <br />");       
   
      client.println("</body>");  
      client.println("</html>");  
      break;  
     }  
       
     if (c == '\n')  
     {  
      // you're starting a new line  
      currentLineIsBlank = true;  
     }  
     else if (c != '\r')  
     {  
      // you've gotten a character on the current line  
      currentLineIsBlank = false;  
     }  
    }  
   }  
   // give the web browser time to receive the data  
   delay(1);  
   
   // close the connection:  
   client.stop();  
   Serial.println("client disonnected...");  
  }  
 }  
   
 void printWifiStatus()   
 {  
  // print the SSID of the network you're attached to:  
  Serial.print("SSID: ");  
  Serial.println(WiFi.SSID());  
   
  // print your WiFi shield's IP address:  
  IPAddress ip = WiFi.localIP();  
  Serial.print("IP Address: ");  
  Serial.println(ip);  
   
  // print your gateway address:  
  IPAddress gateway = WiFi.gatewayIP();  
  Serial.print("Gateway: ");  
  Serial.println(gateway);  
    
  // print the received signal strength:  
  long rssi = WiFi.RSSI();  
  Serial.print("signal strength (RSSI):");  
  Serial.print(rssi);  
  Serial.println(" dBm");  
 }  
   

Saturday, February 27, 2016

Arduino WiFi Shield 101 Web Server Basics

Without much fuss, the earlier code example was modified per Arduino instructions for a WiFi Web Server.   No additional code libraries were needed, and the application worked without issue.  Here is a snapshot of the page being served by the Arduino after opening the IP address in Chrome.


The code is documented below:

 #include <SPI.h>  
 #include <WiFi101.h>  
   
 char ssid[] = "mynetwork";   // your network SSID (name)   
 char pass[] = "mypassword!";  // your network password  
 int status = WL_IDLE_STATUS;   // the Wifi radio's status  
 WiFiServer server(80);  

 void setup()   
 {  
  // initialize serial:  
  Serial.begin(9600);  
  while (!Serial)  
  {  
   ; // wait for serial port to connect. Needed for native USB port only  
  }  
   
  if (WiFi.status() == WL_NO_SHIELD)  
  {  
   Serial.println("WiFi shield not present");  
   // don't continue:  
   while (true);  
  }   
   
  // attempt to connect to Wifi network:  
  while ( status != WL_CONNECTED)  
  {  
   // attempt to connect using WPA2 encryption:  
   Serial.println("");  
   Serial.println("Attempting to connect to WPA2 network...");  
   status = WiFi.begin(ssid, pass);  
   
   if (status != WL_CONNECTED)  
   {   
    // if you're not connected, stop here:  
    Serial.println("Network unavailable, trying again in 10 seconds...");  
    // wait 10 seconds for connection:  
    delay(10000);  
   }  
  }  
    
  server.begin();  
   
  Serial.println("Connected to network");  
  printWifiStatus();  
 }  
   
 void loop()  
 {  
  // listen for incoming clients  
  WiFiClient client = server.available();  
  if (client)  
  {  
   Serial.println("new client...");  
   // an http request ends with a blank line  
   boolean currentLineIsBlank = true;  
   while (client.connected())  
   {  
    if (client.available())  
    {  
     char c = client.read();  
     Serial.write(c);  
     // if you've gotten to the end of the line (received a newline  
     // character) and the line is blank, the http request has ended,  
     // so you can send a reply  
     if (c == '\n' && currentLineIsBlank)  
     {  
      // send a standard http response header  
      client.println("HTTP/1.1 200 OK");  
      client.println("Content-Type: text/html");  
      client.println("Connection: close"); // the connection will be closed after completion of the response  
      client.println("Refresh: 5"); // refresh the page automatically every 5 sec  
      client.println();  
      client.println("<!DOCTYPE HTML>");  
      client.println("<html>");  
      client.println("<head><title>Arduino Web Server</title></head>");  
      client.println("<body>");  
      // output the value of each analog input pin  
      for (int analogChannel = 0; analogChannel < 6; analogChannel++)  
      {  
       int sensorReading = analogRead(analogChannel);  
       client.print("analog input channel ");  
       client.print(analogChannel);  
       client.print(" is ");  
       client.print(sensorReading);  
       client.println("<br />");  
      }  
      client.println("</body>");  
      client.println("</html>");  
      break;  
     }  
       
     if (c == '\n')  
     {  
      // you're starting a new line  
      currentLineIsBlank = true;  
     }  
     else if (c != '\r')  
     {  
      // you've gotten a character on the current line  
      currentLineIsBlank = false;  
     }  
    }  
   }  
   // give the web browser time to receive the data  
   delay(1);  
   
   // close the connection:  
   client.stop();  
   Serial.println("client disonnected...");  
  }  
 }  
   
 void printWifiStatus()   
 {  
  // print the SSID of the network you're attached to:  
  Serial.print("SSID: ");  
  Serial.println(WiFi.SSID());  
   
  // print your WiFi shield's IP address:  
  IPAddress ip = WiFi.localIP();  
  Serial.print("IP Address: ");  
  Serial.println(ip);  
   
  // print your gateway address:  
  IPAddress gateway = WiFi.gatewayIP();  
  Serial.print("Gateway: ");  
  Serial.println(gateway);  
    
  // print the received signal strength:  
  long rssi = WiFi.RSSI();  
  Serial.print("signal strength (RSSI):");  
  Serial.print(rssi);  
  Serial.println(" dBm");  
 }  
   

The data itself is not very interesting (as it is just pulling values from floating pins), however that will be remedied in the next post.

Saturday, February 20, 2016

Getting Started with the Arduino WiFi Shield 101

After verifying the Arduino Zero was functional (previous blog entry), the WiFi Shield 101 was connected (via stacking headers) and tested out.  Again, there is not too much to be added to the basic documentation on the Arduino site, this just documents the links for later:

Arduino WiFi Shield 101
Arduino WiFi Shield 101 Getting Started
Arduino WiFi 101 Software Library


The shield requires a software library, which is first downloaded via the Library Manager (Sketch | Include Library | Manage Libraries...):


After installing the library, the sample code for Scan for available networks was compiled/uploaded and successfully listed my local network.  I then combined a few sample code snippets into the following, and was able to connect to the local network with WPA2:

 #include <SPI.h>  
 #include <WiFi101.h>  
   
 char ssid[] = "mynetwork";   // your network SSID (name)   
 char pass[] = "mypassword";  // your network password  
 int status = WL_IDLE_STATUS;   // the Wifi radio's status  
   
 void setup()   
 {  
  // initialize serial:  
  Serial.begin(9600);  
   
  if (WiFi.status() == WL_NO_SHIELD)  
  {  
   Serial.println("WiFi shield not present");  
   // don't continue:  
   while (true);  
  }  
    
  // attempt to connect using WPA2 encryption:  
  Serial.println("");  
  Serial.println("Attempting to connect to WPA network...");  
  status = WiFi.begin(ssid, pass);  
   
  if (status != WL_CONNECTED)  
  {   
   // if you're not connected, stop here:  
   Serial.println("Couldn't get a wifi connection");  
   while(true);  
  }   
  else  
  {  
   // if you are connected, print out info about the connection:  
   Serial.println("Connected to network");  
   printWifiStatus();  
  }  
 }  
   
 void loop()  
 {  
  // do nothing  
 }  
   
 void printWifiStatus()   
 {  
  // print the SSID of the network you're attached to:  
  Serial.print("SSID: ");  
  Serial.println(WiFi.SSID());  
   
  // print your WiFi shield's IP address:  
  IPAddress ip = WiFi.localIP();  
  Serial.print("IP Address: ");  
  Serial.println(ip);  
   
  // print your gateway address:  
  IPAddress gateway = WiFi.gatewayIP();  
  Serial.print("Gateway: ");  
  Serial.println(gateway);  
    
  // print the received signal strength:  
  long rssi = WiFi.RSSI();  
  Serial.print("signal strength (RSSI):");  
  Serial.print(rssi);  
  Serial.println(" dBm");  
 }  
   

The sketch worked as designed, and the Arduino was visible on my routers list of connected devices.  Unfortunately I can find no way to set the device name for the WiFi shield, but that is a minor complaint when so much functionality worked "out of the box".


Next up will be to work with the onboard real-time clock (RTC), set the RTC automatically via an NTP call, and perform some basics to serve a webpage on the local network.



Thursday, February 18, 2016

Getting Started with the Arduino Zero

There is not too much to be added to the documentation on the Arduino site, this just documents the links for later:

Getting Started with the Arduino Zero

First install the latest software, which as of February 2016 is the following:


Make sure to perform the step of installing the SAMD core like this, then select the appropriate Board and Serial Port from the Tools menu.  As an initial test, the Blink application was installed and observed to be functioning normally.



Next step will be to connect up the WiFi 101 board...

Thursday, January 9, 2014

Breadboard Mk. II

Although the Mark I had served me well, it turned out to be a bit large for most of my needs.  With a few more projects gearing up in 2014, I decided to exchange size for quantity, and built 3 smaller boards instead of the one larger unit.



The new foundation is a 6x9 polyethylene cutting board with two 840 point breadboards and a 60 point bus strip running across the top.  Enough room is remaining on top to add binding posts at a later date, but over time I've found that I don't frequently use them, so I'll hold off on them for now.  The Arduino Rev3 was also installed on a 6x9 board.  This works well but could be improved...

Overall, I probably could have used a prefab board, but I find the heavier 1/2 cutting board material easier to hold and less prone to scratching my desktop, so worth an evening of easy assembly.

Tuesday, October 1, 2013

Netgear WN3000RP Disassembly

After a few years in use, it was time to retire the wireless extender for my network and upgrade to the latest model.  Before decommissioning the device, I disassembled it looking for spare/useful parts.  The case was held together with four torx screws on the exterior, and four more philips head screws holding the PCB onto the case standoffs.





The major chips on the unit are as follows:
The most useful piece turned out to be the power supply and case.  With the size of the unit and convenient location of the standoffs, this remnant will live on in my spare parts bin and may someday be reborn as a new custom device housing for a home-made PCB.

Sunday, June 30, 2013

Driving a Trapezoidal Lead Screw

With the motor shield assembled and stepper motors in hand, I ordered a number of mechanical parts and waited almost 2-3 weeks for everything to arrive. Some of the key parts in use are as follows:
It took an afternoon to cut/measure/assemble all of the parts.  Unfortunately I was thinking a bit too much in 2 dimensions when I ordered the parts, and did not account for the height differences that would come into play during final assembly.  In order to place the stepper motor and mated bearing at the correct locations, I cut down some scrap pieces of 2x4 lumber I had remaining from a different project -- a bit of a sloppy hack, but it worked fine.  The final assembly is shown below:




To drive the motor, the following code was uploaded to the Arduino board:


To my great surprise, everything worked as expected the first time the system was powered up.  The unit was a little noisier than expected, but I think that may be due to a slight misalignment of the flange nut and its associated vibrations.  In the future I'll try to track down a washer to install between the flange nut and plastic angle to reduce vibration and help compensate for the noise (building something a little more exact that a hunk of 2x4 wouldn't hurt either).

Next up will be to determine what to use for limit switches so that the unit can travel from end-to-end (and not just travel back-and-forth in a coded fixed length) - either a physical switch or a Hall-effect sensor are the likely final candidate.  I'll also need to determine some better wire quick connects to easily connect/disconnect the electronics.

Friday, June 7, 2013

Driving 12V Stepper Motors

With a motor shield fully assembled (see earlier post), it was time to connect up 2 x 12V stepper motors (purchased here) and see if the soldering job was all goodness.


The motor wires were connected in the order [RED, YELLOW, GREEN, GREY]. I guessed a bit on  the location of pin one for each of the terminal blocks.  Here is the final layout:


I drove the Arduino via USB (+5V), and the motors off of a separate lab power supply (+12V):


For the code, I kept the first scenario fairly simple;  Sample code from the vendor was borrowed and modified to alternate the motors, driving them both forward and reverse.  The code is below:


For this build, the impossible happened: everything worked the first time.  The next steps will involve figuring out some kind of drive mechanism to make the steppers do something productive (well, more productive then rotating two blue painters tape flags).  Since I have degrees in EE not ME, I'll need to spend a bit more time deciphering the right lingo for google queries (actuators, drive screws, linear bearings, etc., etc.)

Thursday, June 6, 2013

Assembling an Adafruit Motor Shield for Arduino

I guess my first clue should have been in the name "Adafruit Motor Shield Kit", but somehow my eyes rolled right over the last word.


The motor shield arrived as a PCB, 3 ICs, and a handful of passive components, meaning it was time to break out the soldering iron.  The kit assembled without too much trouble, with full assembly instructions online.  The online instructions appear to be for an earlier edition of the board, but it wasn't too hard to decipher the differences.

The only part of the directions that were unclear was a statement that "the four 'middle' pins of the L293D motor driver chips are tied to a large heat sink and thus may end up getting 'bridged' with solder as shown in the second image."  I wasn't sure if that meant you were supposed to bridge the pins, or it was just something that just may happen.  A little digging on the forums revealed that the pins in question are all GND, so it doesn't really matter whether they get bridged or not.

BEFORE


AFTER



I thought about showing you the outstanding soldering job on the back of the board, but decided instead to blame the camera for taking a poor picture, which has no relation to the high-quality soldering which actually occurred on this assembly.  I also installed a set of stacking headers in the extra provided through-holes, and cut them short on the back as they will not be used for stacking; since I've never worked with motors before, I'm guessing I'll have need of the convenient headers for debugging.

Next up will be the connection of the stepper motors and a sample sketch to get them moving, after of course reading the manual.