Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Digital Oscilloscope for Testing & Debugging Astro Remote Controls


Gina

Recommended Posts

No instructions came with it but I thought it was simple enough anyway :D  Well, it was but once I'd assembled from bottom up I found it would have been better assembled top down - or rather upside down!  So I took the sides off, turned it upside down, separated the display board from the main board and I was then able to fasten the top 4 acrylic plates together with the 4 screws and 4 of the nuts supplied.

Case 04.jpgCase 05.jpgCase 06.jpgCase 07.jpgCase 08.jpg

Link to comment
Share on other sites

  • Replies 180
  • Created
  • Last Reply

It was certainly worth buying the case kit as it contains all the bits needed ready cut out including extension bits for the switches and push buttons to bring them up to the top and much more accessible.  I hadn't thought of that when I was thinking of designing and 3D printing printing a case.

Link to comment
Share on other sites

With the parts assembled it became apparent that the switches and their sliders wouldn't mate up properly because the BNC signal input socket was pressing on an acrylic case part and needed a slot cut out to clear it.  So I marked up where it needed cutting with a marker pen, got my micro mill out and set it up to mill out the slot.  Initially cut the slot with a side mill and finished off with a shaped diamond burr.  The cuts were taken a bit at a time to avoid melting the acrylic.

Case 09.jpgCase 10.jpgCase 11.jpgCase 12.jpgCase 13.jpg

Link to comment
Share on other sites

In the little bag of small parts were 4 tiny screws and nuts and I wondered what they were for but examination of the acrylic plates gave me the answer - to attach the TFT display to the plate.  With a certain amount of waggling and pushing of the corner screws, I have managed to assemble it all :)  I still have to arrange to add the battery board, LEDs and switch.  That may be just a box that fastens on the bottom and I could drill 3mm holes for the LEDs.  I'll see where the power switch will go when I get it.

Case 14.jpgCase 15.jpgCase 16.jpgCase 17.jpgCase 18.jpgCase 19.jpgCase 20.jpg

Link to comment
Share on other sites

I think for the LEDs I'll just drill holes in the upper two inner acrylic plates and mill out the third for the wires.  I think I shall solder the wires directly onto the LEDs rather than having the LEDs mounted on stripboard.  I can make the holes exactly equidistant using my micro mill.  I think that will look neater than stripboard.  I'm pretty sure the power switch will have to go on the battery box as there's very little space on the top of the oscilloscope box.

Link to comment
Share on other sites

The switches arrived today - well switches arrived but the wrong ones :(  Instead of two 3 position centre off DPDT switches they sent four 2 position ordinary 2 position DPDT switches :(  I dunno...  I just can't seem to get anything finished and finding lacking interest in some things.  Weather isn't helping...

Link to comment
Share on other sites

Ordered some slide switches from Amazon.  10 Pcs x DC 50V 0.5A 3 Position 2P3T DP3T Panel Slide Switch 8 Pin PCB  Scheduled for Prime delivery tomorrow.  Seem small enough but could be fragile - just have to see.  Can't tell where to put the LEDs until I get a switch - same applies to the case for the battery board so no more progress possible ATM.

Link to comment
Share on other sites

Switches arrived in the post this morning while I was out and they look fine for the job - nice and small.  Sliding action seems alright :)  I'll be looking into fitting one, and the LEDs this afternoon.  Chance of getting this project finished now :)

Link to comment
Share on other sites

There is already a hole pretty much the exact size for the power switch slider near the bottom of the top plate.  Designed to take a 3 pin header which I don't want.  Don't know what to do with the 4 pin header hole I don't want and which the instructions say isn't used.  The LEDs can go near the top of the front plate but don't need holes all the way through - though could have.

The intermediate plates will need milling out to take the body of the switch.  The wires can be soldered directly onto the connection tabs.

Power Switch 01.jpgPower Switch 02.jpg

Link to comment
Share on other sites

On closer inspection the 3 pin header hole was not quite long enough so I'll use the 4 pin header hole instead.  I could put a 3 pin header in as that could possibly be used to upload new firmware.  I haven't got the switch quite exactly placed but this photo shows the general idea.

Power Switch 03.jpg

Link to comment
Share on other sites

Milled out the two acrylic plates to clear the switch body.  Tried to take a sideways photo but failed - transparent acrylic is difficult.  I'll try again later.

Power Switch 04.jpgPower Switch 05.jpg

Link to comment
Share on other sites

I am loving this thread.   In fact I like many of your project threads Gina - you are an inspiration.   Can't wait to see how your grandfather clock turns out.

I don't really need an oscilloscope, but as a teenager back in the analogue days I used to have a couple of them and they are definitely nostalgic for me.   If I do ever need one [or tell myself I need one :)] then I will be using this for a template, maybe plus a resistor ladder at the front end so I could cover a wider voltage range.

Good luck with finishing this one off!

Link to comment
Share on other sites

I've drilled 3mm holes for the LEDs using my micro mill.  Having checked the look of the LEDs sitting below the top acrylic plate, I decided to drill this too so that the tops of LEDs just poke out (just the hemispherical part).  This looks much better.  Next job is to mill out a recess in the next plate down to take the flanges on the LEDs.  I have placed the LEDs centrally in the top of the box.  I'll take and post a photo or two shortly.

Link to comment
Share on other sites

Recesses for the LED flanges milled and a couple of plates assembled to show the effect.  The power switch can also be seen.  Second photo shows an angled view of the switch.

Power Switch 06.jpgPower Switch 07.jpg

Link to comment
Share on other sites

Clearance slots in the next layer of acrylic now milled out and both power switch and LEDs wired up.  Also, power to the oscilloscope board.  Tested with Lithium Ion cell and oscilloscope working.  No battery board case designed yet and clear acrylic plate not yet fitted.  I could mill out clearance slots for the cables in the acrylic or not use it and arrange the battery box to replace it.  Haven't decided yet. 

Still have the AVR sketch to write - simple enough really then need to upload it to the ATMega328P-PU chip.  I could either plug it into a Uno or wait until I have my prototyping kit made up.

Link to comment
Share on other sites

Looking at discharge curves for Lithium Ion cells and thinking about the voltage levels for each LED.  I'm thinking of the following voltage levels :-

  1. Blue - Above 4.0v - Fully charged
  2. Green - 3.8-4.0v - Good
  3. Yellow - 3.6-3.8v - Half full
  4. Orange - 3.5-3.6v - Nearly empty
  5. Red - Below 3.5v - STOP, recharge now.
Link to comment
Share on other sites

Here is my first go at the Arduino sketch.

// Sketch for ATMega328P-PU for Digital Oscilloscope
//
//
// Looking at discharge curves for Lithium Ion cells and the voltage levels for each LED  
// I'm thinking of the following voltage levels :-
//
//    D11 - Blue - Above 4.0v - Fully charged
//    D10 - Green - 3.8-4.0v - Good
//     D9 - Yellow - 3.6-3.8v - Half full
//     D6 - Orange - 3.5-3.6v - Nearly empty
//     D5 - Red - Below 3.5v - STOP, recharge now.
//  0-1023 represents 0-5v on analogue inputs so value read = voltage x 1024 / 5
//  3.5v - 1024/5 x 3.5 = 716.8  (717)
//  3.6v - 737.28 (737)
//  3.8v - 778.24 (778)
//  4.0v - 819.2  (819)
//  
//
//  Cell positive connected to A0 --   int cellPin = A0;
//  LEDs on D5 D6 D9 D10 D11 - Red Orange Yellow Green Blue
//  LEDs have variable brightness using PWM therefore output with analogWrite(redPin,redBrightness); Brightness variables to be set on test
//
//  ***** Working part starts here *****
//
// Cell discharge voltage presets
int fullVal = 819;
int goodVal = 778;
int midVal = 737;
int lowVal = 717;
//
// LED brightness presets
int redBrightness = 255;
int orangeBrightness = 255;
int yellowBrightness = 255;
int greenBrightness = 255;
int blueBrightness = 255;
//
int cellPin = A0;
int redPin = 5;
int orangePin = 6;
int yellowPin = 9;
int greenPin = 10;
int bluePin = 11;
//
//
//
void setup() {
  pinMode(cellPin,INPUT);   //  cell voltage sensor
  pinMode(redPin, OUTPUT);
  pinMode(orangePin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  analogWrite(redPin,redBrightness);
  analogWrite(orangePin,orangeBrightness);
  analogWrite(yellowPin,yellowBrightness);
  analogWrite(greenPin,greenBrightness);
  analogWrite(bluePin,blueBrightness);
}

void loop() {
int val = analogRead(cellPin);
// turn all LEDs off
analogWrite(redPin,0);
analogWrite(bluePin,0);
analogWrite(greenPin,0);
analogWrite(yellowPin,0);
analogWrite(orangePin,0);
//
// Turn appropriate LED on
if (val < lowVal)  analogWrite(redPin,redBrightness);
else if (val > fullVal)  analogWrite(bluePin,blueBrightness);
else if (val > goodVal)  analogWrite(greenPin,greenBrightness);
else if (val > midVal)  analogWrite(yellowPin,yellowBrightness);
else if (val > lowVal)  analogWrite(orangePin,orangeBrightness);
//
}

 

Link to comment
Share on other sites

Since the LED brightness values need setting from a test rig I shall need to make up my test and prototyping rig first.  I'll need to do this anyway to check that the sketch works properly.  It's highly likely to have mistakes!  Initial test can be carried out on a Uno with LEDs plugged into the headers and a variable voltage bench PSU used for the cell positive input.  My little one set for 0-5v will be ideal.  When I run the external AVR chip I can use the PSU to represent the Li-Ion cell.  I am assuming the ATMega328P includes an up converter to boost Vcc to the ADC reference voltage and/or 5v.

Link to comment
Share on other sites

As you are measuring down to 0.1V  you should measure the actual 5V output of that chip and use that as the 5V ref ie  This is the sketch for my voltage dividers.  I measure the resistor values to fine tune it

int main_voltPin = A0;   // Mount Power Supply volt output pin
float refvolts = 4.94;    //Nano actual +5V value
float vin = 0.0;
float vout = 0.0;
float R1 = 97700.0;  
float R2 = 25550.0;
int volts = 0.0;

void setup() {

}

void loop() {

updateVolts();

}

void updateVolts()
{
  volts = analogRead(main_voltPin);
  vout = (volts * refvolts) / 1024.0;
  vin = (vout / (R2/(R1+R2))) * 10; // multiplier of 10 for tft lcd output formatting
}

 

Link to comment
Share on other sites

I've set up an Arduino UNO with a set of LEDs plugged into the PWM outputs and connected through a common 270 ohm resistor to Gnd.  The green LED turned out to be a lot dimmer than the others and they varied quite a lot.  Here is a sketch for setting up which I've adjusted to give roughly apparently equal brightness from all the LEDs.

// Sketch for ATMega328P-PU for Digital Oscilloscope LED brightness test
//
//  LEDs on D5 D6 D9 D10 D11 - Red Orange Yellow Green Blue
//  LEDs have variable brightness using PWM therefore output with analogWrite(redPin,redBrightness); Brightness variables to be set on test
//
//  ***** Working part starts here *****
//
// LED brightness presets
int redBrightness = 64;
int orangeBrightness = 32;
int yellowBrightness = 50;
int greenBrightness = 255;
int blueBrightness = 32;
//
int redPin = 5;
int orangePin = 6;
int yellowPin = 9;
int greenPin = 10;
int bluePin = 11;
//
void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(orangePin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}
void loop() {
analogWrite(bluePin,blueBrightness);
delay(1000);
analogWrite(bluePin,0);
analogWrite(greenPin,greenBrightness);
delay(1000);
analogWrite(greenPin,0);
analogWrite(yellowPin,yellowBrightness);
delay(1000);
analogWrite(yellowPin,0);
analogWrite(orangePin,orangeBrightness);
delay(1000);
analogWrite(orangePin,0);
analogWrite(redPin,redBrightness);
delay(1000);
analogWrite(redPin,0);
}

 

Link to comment
Share on other sites

Connected bench PSU to A0 input and ran the oscilloscope sketch.  LEDs turn on and off at the right voltages :)  Amazingly no mistakes in the sketch.

Link to comment
Share on other sites

I took the ATMega328P-PU out of the UNO and put it in my battery board.  With the battery/cell the blue LED lit and flashed rapidly.  Tried the PSU instead of the battery and got the same result.  I checked the LED connections and made sure there were no shorts.  Then I replaced the chip in the UNO and uploaded the LED test sketch.  With the chip back in the battery board socket, the LEDs worked perfectly with both battery and PSU.  This proves the LED circuitry is correct and the problem must be running the chip from a low voltage.

I shall have to do some further research.  These chips are rated to run from 1.8v to 5v and this one does - mostly.  The problem appears to be with the ADC.  I'm not really surprised.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.