Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Digital Oscilloscope for Testing & Debugging Astro Remote Controls


Gina

Recommended Posts

New sketch in place and the voltage readings are :- 4.00, 3.80, 3.60, 3.51.  That'll do me :)  SUCCESS!

 // Sketch for ATMega328P-PU for Digital Oscilloscope
//
//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 :-
//
//    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.
//
//  Cell positive connected to A0 via 3K3 and 1K voltage divider - ratio 4.3:1  ADC using internal 1.1v reference
//  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 = 885;
int goodVal = 840;
int midVal = 794;
int lowVal = 772; 
 //
// LED brightness presets
int redBrightness = 64;
int orangeBrightness = 32;
int yellowBrightness = 50;
int greenBrightness = 255;
int blueBrightness = 16;
//
int cellPin = A0;
int redPin = 5;
int orangePin = 6;
int yellowPin = 9;
int greenPin = 10;
int bluePin = 11;
//
int chargeLevel = 0;
int oldLevel = -1; //  oldLevel starts differently from any possible chargeLevel so that initial condition is seen
//                     and a LED is turned on
//
void setup() {
  analogReference(INTERNAL);  // Use internal 1.1v reference for ADC
  pinMode(cellPin,INPUT);   //  cell voltage sensor
  pinMode(redPin, OUTPUT);
  pinMode(orangePin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
// 
// Turn all LEDs off
  analogWrite(redPin,0);
  analogWrite(orangePin,0);
  analogWrite(yellowPin,0);
  analogWrite(greenPin,0);
  analogWrite(bluePin,0);  
}
//
void loop() {
int val = analogRead(cellPin);
//
// set chargeLevel as appropriate depending on val
if (val > fullVal) chargeLevel = 4;
else if (val > goodVal) chargeLevel = 3;
else if (val > midVal) chargeLevel = 2;
else if (val > lowVal) chargeLevel = 1;
else chargeLevel = 0;
//
// Any change??
if (chargeLevel != oldLevel) {
  // chargeLevel has changed so change LED
  // turn old LED off
  switch (oldLevel) {
      case 0: { analogWrite(redPin,0); } break;
      case 1: { analogWrite(orangePin,0); } break;
      case 2: { analogWrite(yellowPin,0); } break;
      case 3: { analogWrite(greenPin,0); } break;
      case 4: { analogWrite(bluePin,0); } break;
  }
  oldLevel = chargeLevel; // update oldLevel 
  //
  // and turn new LED on
  switch (chargeLevel) {
      case 0: {analogWrite(redPin,redBrightness);} break;
      case 1: {analogWrite(orangePin,orangeBrightness);} break;
      case 2: {analogWrite(yellowPin,yellowBrightness);} break;
      case 3: {analogWrite(greenPin,greenBrightness);} break;
      case 4: {analogWrite(bluePin,blueBrightness);} break;
    }
  }
}

 

Link to comment
Share on other sites

  • Replies 180
  • Created
  • Last Reply

Having sorted out the electronics and firmware I am now working on the case for the battery board.  I'm keeping the bottom acrylic plate and have milled notches in two sides to take the ribbon cables to power switch and LEDs and an oval hole for the power wires to the oscilloscope.  The box will be attached to the acrylic plate.  I don't think the Lithium-Ion cell needs to be accessible - sufficient to undo screws to change the battery cell when it finally dies.

Bottom Acrylic Plate Cutiouts 01.jpg

Link to comment
Share on other sites

Acrylic plate attached to bottom of unit and battery board sat on top.  Have measured up the case dimensions as 80mm x 80mm x 25mm deep.  Hole for mini USB plug at 40mm x 8mm and 10mm wide x 8mm high.

Battery Board 04.jpg

Link to comment
Share on other sites

Battery board box came out a little bit small and clashed with the oscilloscope bolts.  The latter aren't long enough to use to attach the box.  So a new design.

Battery Box 02.JPG

Link to comment
Share on other sites

Well... mine arrived yesterday, built it last night, voltages all check out and guess what... the damn white screen problem. Processor seems ok though as i'm getting 2 flashes after pressing the reset. /annoyed.

Link to comment
Share on other sites

Yes indeed!  And to see them you need a good magnifier or microscope unless you have exceptional close up eyesight.  The other main problem is dry joints.  Sometimes component wires can be a bit dirty.  You can often tell by the appearance of the solder - it should flow onto the board and the component wire and be mirror-like.  Dull appearance or a blob enclosing the wire can be a sign of a dry joint.  Not casting aspersions on your soldering ability but I think we all can occasionally produce a dry joint.

Link to comment
Share on other sites

Latest 3D printed battery board box fits fine.  Just needs screwing to oscilloscope box and job's done :)  I'll take and post a photo or two when it's done.

Link to comment
Share on other sites

JOY!!! was nothing more than a dodgy power supply... was using an old 9v jobbie i found in the bottom of a draw. just tried a 12v off one of my spare netgear routers and it fired up straight away :D

turned out there were a couple of components missing too... no 2M resistor so i had to use 2 1M in series (as you can see top left) and the LED. didn't like the green one anyway so i got a red one just bobbed on the back at the moment.

IMG_20160802_182622_zpsautb93ae.jpg

Link to comment
Share on other sites

I've taken the plunge :icon_biggrin: and sent for a kit, case and cheap probe. The daft thing it's way cheaper to get one of these than to buy the logic probe I was thinking of getting a few months ago.

It's not a good idea to be off sick from work, I usually spend too much trying to cheer myself up.

I've been trying to mod my little Pi2Go Lite robot and needed a decent de-soldering pump and one thing led to another as they say.

 

Link to comment
Share on other sites

just got a pair of 1x/10x probes off fleabay... the oscilloscope has very little weight to it and the probe that comes with the kit has cable that's as flexible as a planewave 17" strut in comparison and causes it to fall all over the place. well worth the small extra cost

Link to comment
Share on other sites

My scope kit and case have arrived so I hope to start construction over the weekend. I also sent for 1 scope probe, I hope it's a bit more flexible than yours :)

I also sent for a logic analyser http://www.ebay.co.uk/itm/331912830928?_trksid=p2057872.m2749.l2648&ssPageName=STRK%3AMEBIDX%3AIT

I think it's a clone so I hope it works okay. I'll only be using it for serial, I2C and SPI signals so as long as it works with those I'll be happy.

and a very cheap function generator http://www.ebay.co.uk/itm/152139329617?_trksid=p2057872.m2749.l2648&ssPageName=STRK%3AMEBIDX%3AIT

so I should be okay getting my stuff to work now.

 

 

Link to comment
Share on other sites

41 minutes ago, ringz said:

I also sent for a logic analyser http://www.ebay.co.uk/itm/331912830928?_trksid=p2057872.m2749.l2648&ssPageName=STRK%3AMEBIDX%3AIT

I think it's a clone so I hope it works okay. I'll only be using it for serial, I2C and SPI signals so as long as it works with those I'll be happy.

 

Definitely a clone.  The 16 channel is approx £250 and is a small 2" square box.  Well mine is anyway :)  The originals are also only 100Mhz when using max 2 channels.  Drops down to 12.5MHz when all 16 are used.  If it works as it should it's a nice cheap bit of kit :)

Link to comment
Share on other sites

It isn't provided as is but I would have thought this should be possible but I don't know if the firmware source code is available.  Another possibility might be to replace the small TFT screen with a larger one.  I think one of the main benefits of this is the small size and portability though.

Link to comment
Share on other sites

2 hours ago, Gina said:

It isn't provided as is but

Thanks.  Yes agreed about portability, any alternative screen would need to be swapable. I know nothing about TFT interface. (shame it doesnt have hdmi ! )

An alternative if it were poss to drive a larger screen that needed permanent attachment would be to have two of them :):) cheap enough !

OK folks here's a laugh : when growing old it is easy to forget where one put the power lead for one's scope, which meant that when I wanted to use it the other day I could not, and will now have to solder something on, it being a strange (American? or ye oldie Brit) type of plug :( Why is it not still attached to said scope ? Yep i wonder that myself :( Heyho.

 

 

Link to comment
Share on other sites

My Saleae 16 clone logic analyser arrived today. I haven't had time to play with it yet but I installed the software which says that the analyser is connected when I plug it in.

I'll have a fiddle with an arduino tomorrow to see if it actually works properly.

 

Link to comment
Share on other sites

I just had a play with the logic analyser and it seems to work okay. I just used it to look at serial data when programming an arduino and the blink port. Not very taxing but at least it proves that it responds.

Link to comment
Share on other sites

I just spent the time completing my DSO138 oscilloscope kit. It works okay  but I've only used it with the inbuilt test signal so far. Fitting the box together is beyond me though so I've just attached the feet for the moment :icon_biggrin:

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.