Badcaps.net Forum
Go Back   Badcaps Forums > Troubleshooting Hardware & Devices and Electronics Theory > General Electronics Technical Discussion
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
Thread Tools Display Modes
Old 01-27-2021, 02:19 AM   #61
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 5,829
Default Re: How could I find a FET with specific specs?

To be honest 450Hz should be fast enough to not see much flickering unless your software is glitching and introducing a beat pattern... so are you actually seeing a beat pattern without the capacitor? What frequency is it beating?
eccerr0r is offline   Reply With Quote
Old 01-27-2021, 03:41 AM   #62
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
To be honest 450Hz should be fast enough to not see much flickering unless your software is glitching and introducing a beat pattern... so are you actually seeing a beat pattern without the capacitor? What frequency is it beating?
The only way I can describe it ... and it may sound weird and you'll probably make fun of me ... but it's something I actually FEEL in my eyeballs.... "seeing" it is more of a perception, but it definitely feels like a pulsating pressure in the back of my eye. and it is VERY fast no question about it.

I was able to capture it with my phone ... here's a standard 30fps

https://youtu.be/TWD-3F9ObF0

And this one was recorded at 120FPS slowed down to 30 ... I only recorded like 12 seconds but it's over a minute long.

https://youtu.be/OnpcsmbC4Mw

Notice in the first video at the fastest duty cycle the flicker goes away ... for obvious reasons.
__________________
EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 06:03 AM   #63
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by sam_sam_sam View Post
I have one question are there any PWM code that would adjust from 0 to 255 and you can see the difference as you increase/decrease the scaler value
Sam,

As I was looking into how to increase the PWM clock on the ATTINY85, this here is a CLASSIC discussion blog on topics that deal with the deeper roots of microcontrollers ... pretty much after he says, "When we read the datasheet..." I'm on a fast track to snooze-ville... I read it to see what I can absorb, then I just look for the code examples... lol

But this will give you an idea of how NON-TRIVIAL it is to do something you would think should be simple, like increasing the frequency of a MC's PWM output:

Quote:
Also, checking the ATTiny85 datasheet to look at the Timer 0 and 1 and setting fast PWM we find the bits we need to set. Its not very obvious, but here is a brief explaination of the bits to set. One problem with changing Tiner0 is that it will affect the normal delay function (as this depends upon the Timer 0 value for its timing).

In order to overcome this we have to use a different delay function, by including the library “#include <util/delay.h>”. This also requires us to set the define the CPU frequency, which is used to calculate the correct delays “#define F_CPU 8000000”, as I have set the clock to 8MHz. We must also use the new delay functions from the new delay library. These are written as “_delay_ms(500);”. The “delay(500); ” does not work as it uses the timer 0, which we need to change in order to get fast PWM.

We also include the library “#include <avr/io.h>” which has the definitions for the various register we need to set.

When we read the data sheet we see that we need to set:

WGM0[2:0] to 3 (binary 011): this is the Waveform Generation Mode which we set to Fast PWM.
COMOA0/COMOB0 to 2 (binary 10): Compare Match Output Mode needs to be ‘Clear on Match. Set at Bottom’
CS00/CS10 = 1: This tells Timer 0/1 NOT to use a prescaler.
PWM1B = 1: This enables the use of Output Compare Unit B from Timer 1 (OC1B).
PWM1A = 0: This disables the use of Output Compare Unit A from Timer 1 (OC1A) as that pin is shared with OC0B.
If we check the data sheet we see that OC1B is on pin 3 (Arduino pin 4), OC0A is on pin 7 (Arduino pin 2/A1) and OC1A/OC0B is on pin 6 (arduino pin 1) of the IC. In the end I only want OC1B to give me fast PWM, but its good to see how the other outputs can be used.

This is done by setting the following registers (notes have been copied from here):

TCCR0A = 2<<COM0A0 | 2<<COM0B0 | 3<<WGM00;
Control Register A for Timer/Counter-0 (Timer/Counter-0 is configured using two registers: A and B)
TCCR0A is 8 bits: [COM0A1:COM0A0:COM0B1:COM0B0:unused:unused:WGM01:WG M00]
2<<COM0A0: sets bits COM0A0 and COM0A1, which (in Fast PWM mode) clears OC0A on compare-match, and sets OC0A at BOTTOM
2<<COM0B0: sets bits COM0B0 and COM0B1, which (in Fast PWM mode) clears OC0B on compare-match, and sets OC0B at BOTTOM
3<<WGM00: sets bits WGM00 and WGM01, which (when combined with WGM02 from TCCR0B below) enables Fast PWM mode

TCCR0B = 0<<WGM02 | 1<<CS00;
Control Register B for Timer/Counter-0 (Timer/Counter-0 is configured using two registers: A and B)
TCCR0B is 8 bits: [FOC0A:FOC0B:unused:unused:WGM02:CS02:CS01:CS00]
0<<WGM02: bit WGM02 remains clear, which (when combined with WGM00 and WGM01 from TCCR0A above) enables Fast PWM mode
1<<CS00: sets bits CS01 (leaving CS01 and CS02 clear), which tells Timer/Counter-0 to not use a prescalar

TCCR1 = 0<<PWM1A | 0<<COM1A0 | 1<<CS10;
Control Register for Timer/Counter-1 (Timer/Counter-1 is configured with just one register: this one)
TCCR1 is 8 bits: [CTC1:PWM1A:COM1A1:COM1A0:CS13:CS12:CS11:CS10]
0<<PWM1A: bit PWM1A remains clear, which prevents Timer/Counter-1 from using pin OC1A (which is shared with OC0B)
0<<COM1A0: bits COM1A0 and COM1A1 remain clear, which also prevents Timer/Counter-1 from using pin OC1A (see PWM1A above)
1<<CS10: sets bit CS11 which tells Timer/Counter-1 to not use a pre-scalar

GTCCR = 1<<PWM1B | 2<<COM1B0;
General Control Register for Timer/Counter-1 (this is for Timer/Counter-1 and is a poorly named register)
GTCCR is 8 bits: [TSM:PWM1B:COM1B1:COM1B0:FOC1B:FOC1A:PSR1:PSR0]
1<<PWM1B: sets bit PWM1B which enables the use of OC1B (since we disabled using OC1A in TCCR1)
2<<COM1B0: sets bit COM1B1 and leaves COM1B0 clear, which (when in PWM mode) clears OC1B on compare-match, and sets at BOTTOM
I'll post the actual code in part two ... who knew there was a size limit on how much text you could post in here? LOL
EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 06:05 AM   #64
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by sam_sam_sam View Post
I have one question are there any PWM code that would adjust from 0 to 255 and you can see the difference as you increase/decrease the scaler value
Sam,

Here is part two: the actual code ...

Code:
/*
 ATtiny85 test code
 
 Overview:
 This code flashes the LEDs and outputs data on the serial port.
 This is to test the function of the IC at lower voltages.
 
 This code is designed to run on the ATTiny 25/45/85
 The serial output only works with the larger ATTiny85 IC
 
 The connections to the ATTiny are as follows:
 ATTiny    Arduino    Info
 Pin  1  - 5          RESET / Rx (Not receiving any data)
 Pin  2  - 3          Tx for serial conenction
 Pin  3  - 4          FET driver (PWM)
 Pin  4  -            GND
 Pin  5  - 0          RED LED (PWM)
 Pin  6  - 1          GREEN LED
 Pin  7  - 2 / A1     Vsensor (Analog)
 Pin  8  -   +Vcc
 
 See www.samaenergy.org/www.re-innovation.co.uk for more details including flow code
 
 13/11/13 by Matt Little ([email protected]/www.re-innovation.co.uk)
 
 Updated:  
 13/11/13  Added fast PWM frequency - Matt Little

 
 This example code is in the public domain.
 */

#define F_CPU 8000000  // This is used by delay.h library

#include <stdlib.h>
#include <EEPROM.h>

#include <avr/io.h>        // Adds useful constants
#include <util/delay.h>    // Adds delay_ms and delay_us functions

// Only use Serial if using ATTiny85
// Serial output connections:
#include <SoftwareSerial.h>
#define rxPin 5    // We use a non-existant pin as we are not interested in receiving data
#define txPin 3
SoftwareSerial serial(rxPin, txPin);

#define INTERNAL2V56NC (6)

//************ USER PARAMETERS***********************

//**********MODE*************************************
const int deviceType = 85;  // 45 = ATTiny45, NO serial output, 85 = AtTiny85, with serial output

// LED output pins:
const int redled = 0;         // Red LED attached to here (0, IC pin 5)
const int buzzLedSw = 1;       // Green LED/buzzer/Switch attached to here (1, IC pin 6)

// MOSFET Driver output
const int FETdriver = 4;

// Analog sensing pin
const int VsensePin = A1;    // Reads in the analogue number of voltage
long int VsenseValue = 0;   // Holds the voltage data
unsigned long int Vint = 0;  //Holds the voltage as an int

int voltageRange = 0;  // This stores the volatge range. This is 12V, 24V or 0v (error)
const int Taverage = 10;  // This is the number of samples to average over (each sample is around 5ms)

// PID CONTROL values
int FETPWM = 0;      // This is the control for the PWM 
int integral = 0;    // Holds the integral part
int proportional = 0;// Holds the proportional part
int error = 0;  // Holds the error term

//Timing for serial output
long int oldMillis = 0;  //This holds the previous millisecond count value

// Varibales for EEPROM
int hiByte;      // These are used to store longer variables into EEPROM
int loByte;

// Varibles for the calibration factor
int calibrationFactor = 0;    // This holds the Vref value in millivolts

// State machine control
int stateControl = 0;  // This controls the state of the device

// the setup routine runs once when you press reset:
void setup()  { 


    /*
    Control Register A for Timer/Counter-0 (Timer/Counter-0 is configured using two registers: A and B)
    TCCR0A is 8 bits: [COM0A1:COM0A0:COM0B1:COM0B0:unused:unused:WGM01:WGM00]
    2<<COM0A0: sets bits COM0A0 and COM0A1, which (in Fast PWM mode) clears OC0A on compare-match, and sets OC0A at BOTTOM
    2<<COM0B0: sets bits COM0B0 and COM0B1, which (in Fast PWM mode) clears OC0B on compare-match, and sets OC0B at BOTTOM
    3<<WGM00: sets bits WGM00 and WGM01, which (when combined with WGM02 from TCCR0B below) enables Fast PWM mode
    */
    TCCR0A = 2<<COM0A0 | 2<<COM0B0 | 3<<WGM00;
   
    /*
    Control Register B for Timer/Counter-0 (Timer/Counter-0 is configured using two registers: A and B)
    TCCR0B is 8 bits: [FOC0A:FOC0B:unused:unused:WGM02:CS02:CS01:CS00]
    0<<WGM02: bit WGM02 remains clear, which (when combined with WGM00 and WGM01 from TCCR0A above) enables Fast PWM mode
    1<<CS00: sets bits CS01 (leaving CS01 and CS02 clear), which tells Timer/Counter-0 to not use a prescalar
    */
    TCCR0B = 0<<WGM02 | 1<<CS00;
   
    /*
    Control Register for Timer/Counter-1 (Timer/Counter-1 is configured with just one register: this one)
    TCCR1 is 8 bits: [CTC1:PWM1A:COM1A1:COM1A0:CS13:CS12:CS11:CS10]
    0<<PWM1A: bit PWM1A remains clear, which prevents Timer/Counter-1 from using pin OC1A (which is shared with OC0B)
    0<<COM1A0: bits COM1A0 and COM1A1 remain clear, which also prevents Timer/Counter-1 from using pin OC1A (see PWM1A above)
    1<<CS10: sets bit CS11 which tells Timer/Counter-1  to not use a prescalar
    */
    TCCR1 = 0<<PWM1A | 0<<COM1A0 | 1<<CS10;
   
    /*
    General Control Register for Timer/Counter-1 (this is for Timer/Counter-1 and is a poorly named register)
    GTCCR is 8 bits: [TSM:PWM1B:COM1B1:COM1B0:FOC1B:FOC1A:PSR1:PSR0]
    1<<PWM1B: sets bit PWM1B which enables the use of OC1B (since we disabled using OC1A in TCCR1)
    2<<COM1B0: sets bit COM1B1 and leaves COM1B0 clear, which (when in PWM mode) clears OC1B on compare-match, and sets at BOTTOM
    */
    GTCCR = 1<<PWM1B | 2<<COM1B0;
  
  // Set up IO pins
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);  
  pinMode(redled, OUTPUT);
  pinMode(buzzLedSw, OUTPUT);        // First want to read the switch
  pinMode(FETdriver, OUTPUT);
  
  digitalWrite(FETdriver, LOW);   //  Switch the FET OFF
  
  if(deviceType==85)
  {
    // Start the serial output string - Only for ATTiny85 Version
    serial.begin(4800);
    serial.println("TEST ATTiny85");
    serial.println("13/11/13 Matt Little"); 
  }

  analogReference(INTERNAL2V56NC);  // This sets the internal ref to be 2.56V (or close to this)
  delay(100);  // Wait a while for this to stabilise.
  
  // Read in the Calibration Factor
  hiByte = EEPROM.read(124);
  loByte = EEPROM.read(125); 
  
  calibrationFactor = (hiByte << 8)+loByte;  // Get the sensor calibrate value 
  
  serial.print("Calibration Factor: ");   // TESTING
  serial.println(calibrationFactor);   // TESTING
  
} 

// the loop routine runs over and over again forever:
void loop()  { 
  
    // RED LED ON  
    // set the output RED
    analogWrite(redled, 127);    // Set it to 50%  running at 31.2kHz  
    analogWrite(buzzLedSw, 0); 
    _delay_ms(500);
    serial.println("This is a NEW TEST");
    // GREEN LED ON  
    // set the output GREEN
    //analogWrite(redled, 0);    
    analogWrite(buzzLedSw, 255);    
    _delay_ms(500);
}

Last edited by EasyGoing1; 01-27-2021 at 06:08 AM..
EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 07:17 AM   #65
sam_sam_sam
Badcaps Veteran
 
Join Date: Jul 2011
City & State: Sunny Jacksonville FL
My Country: USA
Line Voltage: 120 Volts 60 HZ
I'm a: Knowledge Seeker
Posts: 2,626
Default Re: How could I find a FET with specific specs?

I have one question where do you get the information for each of the interrupts and all types of code parameters and definitions and examples for you to learn how to program these type of devices

As I used the basic stamp example earlier there is all kinds of examples a lot of articles about how to program them

My problem is I do not know where to start looking for this information is it possible to point me in the right direction

Thanks
__________________
9 PC LCD Monitor
6 LCD Flat Screen TV
30 Desk Top Switching Power Supply
10 Battery Charger Switching Power Supply for Power Tool
6 18v Lithium Battery Power Boards for Tool Battery Packs
1 XBox 360 Switching Power Supply and M Board
25 Servo Drives 220/460 3 Phase
6 De-soldering Station Switching Power Supply 1 Power Supply
1 Dell Mother Board
15 Computer Power Supply
1 HP Printer Supply & Control Board * lighting finished it *


These two repairs where found with a ESR meter...> Temp at 50*F then at 90*F the ESR reading more than 10%

1 Over Head Crane Current Sensing Board ( VFD Failure Five Years Later )
2 Hem Saw Computer Stack Board

All of these had CAPs POOF
All of the mosfet that are taken out by bad caps

Last edited by sam_sam_sam; 01-27-2021 at 07:19 AM..
sam_sam_sam is offline   Reply With Quote
Old 01-27-2021, 12:01 PM   #66
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 5,829
Default Re: How could I find a FET with specific specs?

Unfortunately the answer is "They're all in the datasheet."

Then there's also the problem with "arduino" that may force certain resources to be dedicated to the arduino system else some functionality will be broken... I'd not be surprised if some of the arduino code dedicates some of the hardware resources for itself and you may not be able to change some things without serious side effects.

Again with the disclaimer that I do not use arduino, I've only used straight C and assembler and thus have to deal with the resources directly.
eccerr0r is offline   Reply With Quote
Old 01-27-2021, 12:40 PM   #67
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by sam_sam_sam View Post
My problem is I do not know where to start looking for this information is it possible to point me in the right direction

Thanks
You know I was actually thinking about that very thing yesterday as I was reading your posts and reading different blogs and so as I thought about it ... when a microcontroller is first released ... how do we get those juicy blog posts that explain how to do what it is we want to do with clear examples etc.? Where do those great libraries come from?

Those guys have the same resources available to them that we have ... THE DATASHEET!

The only difference between them and me is that they apparently can read and understand hieroglyphics where-as the stuff gives me hives ... I'm exaggerating but ... the last course I took on microprocessors was in 1991 and the "microprocessor" was a Motorola 6800 ... we did simple boolean logic with the darn thing cause obviously, it wasn't a fraction of what MCs are today.

If I understood better what all the stuff was "under the hood" on a more comprehensive level, I could probably just grab a datasheet and go to town. But if there's anything I know ... it's what I don't know... and that becomes painfully obvious whenever I read a datasheet.

I understand OOP programming just fine, and C++ wasn't too difficult to learn on a somewhat functional level ... but man ... when they get deep into registers stuff ... for example, I understand that if you want to manipulate settings directly on an MC without burning clock cycles on c++ execution, you write bits to PORTS ... but beyond that, I have no idea what a "PORT" is ... stack pointers, overflow registers ... direct memory access ... Atomic byte programming, split byte programming ... I understand CONCEPTUALLY what these things are but understanding things enough to be able to do something useful straight from the datasheet? I'm not there ... and don't know if I ever will be. I feel like I need a basic course in general microprocessor theory before ill even have a chance at getting totally self-sufficient.

THANKFULLY, people who know what they're doing write nifty libraries for us commoners so that we don't have to re-invent the wheel.

But to answer your question more directly, the way I learned was by reading other people's code and making sense of what they were doing. I started with a project that does something I've always wanted to do which is build a battery charger (Still haven't done it yet but I've attempted it many times - need more education on different aspects of it before I'll be able to conquer it) ... but when I started, I bought an Arduino 2560 I believe it was ... but then after frying it, I discovered the Nanos and those things are nice, although the Chinese versions are inexpensive for a reason ... I almost always end up destroying the USB port on them for some reason ... and then I have to program them with a USBASP device which can be a real drag. I've gone through at least a dozen Nanos and my last purchase was a box of 10 of them because they just don't hold up well... and I would be the first to admit if I were being careless with the darn things, but Ive literally hooked up a brand new Nano and flashed one program to it with NOTHING connected to it, and the next flash wouldn't go because the USB port died. Theres something about the USB chips that they use on those knockoffs that really suck. Ive threatened to get a brand name Nano to see how it does but I haven't done that yet.

I do really like the Teensy 4.0 ... $20 and its a very robust board ... check out the benchmark comparisons to other Arduinos ... the Nano would fit somewhere at the bottom of this chart:



And you can kind of multi-thread with them which has been real convenient for some things that Ive done. It's nice to have basically multiple loops in the same program. You have to do some things a little different like declare your variables as volatile if you share them between threads and in each thread loop you have to yield at least once so that the other threads can get clock time (they will take it at an interval but calling a yield makes things flow smoother)... so it's not true multi-threading but it is nice because your code can be broken down into isolated functions, and that board running with 7 threads all sharing clock time will still be way faster than a nano running its little heart out.

But for me, I have to be wanting to DO SOMETHING before I'll really dig in and learn ... and that has lead me into different directions of learning where I just want to know something specific or sometimes certain things are just interesting and ill read up on them just for the curiosity of it.

... Then there are the forums ... I always try to exhaust everything I can find online and make sense of before posting in forums ... and the regulars in this forum can be brutal sometimes... I picture them sitting on their porch yelling at the neighbor kids to get off their lawn! (the visual helps - lol) ... but either I'm not asking questions in the right way or they think I know more than I do ... I'm not sure... but I tend to get scolded more often than not ... and I haven't really figured out why - but it is what it is ... I keep coming back so ... :-)

I'd be happy to work with you if you really want to start learning how to program Arduino's. I've got a lot of code that does various things ... or I can help you figure out how to code whatever it is you're wanting to do ... if there is anything I do feel like I have a good bite on in terms of knowledge, its coding Arduinos. I've written some libraries of my own and I've learned some tricks and styles of coding that keep program flow SIMPLE and EASILY READ - which is very important especially when you put something down and don't come back to it for a few months ... my main hobby that I cant get enough of is writing java apps. There's just something about Java that I really like ... it's a fun language to code with. I wish MCs could be coded with Java but as it is now, it would be far too heavy for a typical microcontroller since the language needs to be interpreted at runtime whereas C++ is much more root level and is much more efficient as an MC language.

If you wanna email me off list, my addy is: [email protected]
EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 12:59 PM   #68
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
I'd not be surprised if some of the arduino code dedicates some of the hardware resources for itself and you may not be able to change some things without serious side effects.
Well ... yeah ...

These blocks are pretty much the whole Arduino theme on a chip, no?

EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 01:04 PM   #69
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
To be honest 450Hz should be fast enough to not see much flickering unless your software is glitching and introducing a beat pattern... so are you actually seeing a beat pattern without the capacitor? What frequency is it beating?
So I successfully increased the PWM frequency of the ATTINY85 ... at least I think I did ... my phone wont detect the flickering anymore but my scope seems to have given up the ghost ... thinking of starting a new topic on scopes cause I want to get a better one this time ... not this cheap $80 Hanetek USB pile of crap.
EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 07:10 PM   #70
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by sam_sam_sam View Post
My problem is I do not know where to start looking for this information is it possible to point me in the right direction

Thanks
Sam, check this out ... I think this might be the first DUAL CORE microcontroller for less than $5 - ever ... that I know of anyway. I haven't looked into it in depth yet cause I just saw this but multi-threading apps should be completely possible with this little gem.

https://www.raspberrypi.org/products/raspberry-pi-pico/
EasyGoing1 is offline   Reply With Quote
Old 01-27-2021, 07:55 PM   #71
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 5,829
Default Re: How could I find a FET with specific specs?

"arduino" is software. Nothing on hardware block diagrams have anything to do with it, hardware can't tell if it's running arduino infrastructure or not. Nothing special about it except that

- it must use memory. Without arduino you can make bigger programs.
- it must use some resources. Without arduino you can control all resources.

I've been hearing that arduino has a special software loading mechanism that doesn't require SPI access to burn new code onto it. This clearly uses some resources to complete this task. The in-circuit debugger must use some resources as well, at the minimum a pin or so, and not entirely sure how it handles stuff like single step.
eccerr0r is offline   Reply With Quote
Old 01-27-2021, 08:16 PM   #72
sam_sam_sam
Badcaps Veteran
 
Join Date: Jul 2011
City & State: Sunny Jacksonville FL
My Country: USA
Line Voltage: 120 Volts 60 HZ
I'm a: Knowledge Seeker
Posts: 2,626
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by EasyGoing1 View Post
Sam, check this out ... I think this might be the first DUAL CORE microcontroller for less than $5 - ever ... that I know of anyway. I haven't looked into it in depth yet cause I just saw this but multi-threading apps should be completely possible with this little gem.

https://www.raspberrypi.org/products/raspberry-pi-pico/
Thanks but is there one for getting started with the nano because this what I would to learn because of engraving machine controller board that I would like to modify the program that in especially for PWM to work correctly with the laser and spindle motor controllers that what I am after at this point
sam_sam_sam is offline   Reply With Quote
Old 01-29-2021, 03:37 AM   #73
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by sam_sam_sam View Post
Thanks but is there one for getting started with the nano because this what I would to learn because of engraving machine controller board that I would like to modify the program that in especially for PWM to work correctly with the laser and spindle motor controllers that what I am after at this point
Well, here is the first question I have: do you have the code that the Nano is loaded with currently?
EasyGoing1 is offline   Reply With Quote
Old 01-29-2021, 03:53 AM   #74
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
I've been hearing that arduino has a special software loading mechanism that doesn't require SPI access to burn new code onto it. This clearly uses some resources to complete this task. The in-circuit debugger must use some resources as well, at the minimum a pin or so, and not entirely sure how it handles stuff like single step.
You can turn on full verbose mode in the Arduino IDE settings so that when the code gets uploaded, you can literally see EVERYTHING that happens in a command-line format ... it's like watching it open a shell, then seeing what it does when it compiles and uploads the code.



I do know that it uses avrdude to handle most if not all of that entire process.

Here is an example of the output when those settings are set (I had to snip some of it or this post would have been too long to post):

Code:
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware <snipped>
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/michael/Library/Arduino15/packages -hardware <snipped>
Using board 'nano' from platform in folder: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
Using core 'arduino' from platform in folder: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
Detecting libraries used...
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/eightanaloginputs /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/sketch/delete.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/eightanaloginputs /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/sketch/delete.ino.cpp -o /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/preproc/ctags_target_for_gcc_minus_e.cpp -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/eightanaloginputs /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/sketch/delete.ino.cpp -o /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/sketch/delete.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_cache_191331/core/core_arduino_avr_nano_cpu_atmega328_51f02b7210b938436b779d1c032618e1.a
Linking everything together...
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.elf /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/sketch/delete.ino.cpp.o /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/../arduino_cache_191331/core/core_arduino_avr_nano_cpu_atmega328_51f02b7210b938436b779d1c032618e1.a -L/var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547 -lm
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.elf /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.eep
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.elf /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.hex
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size -A /var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.elf
Sketch uses 3910 bytes (12%) of program storage space. Maximum is 30720 bytes.
Global variables use 204 bytes (9%) of dynamic memory, leaving 1844 bytes for local variables. Maximum is 2048 bytes.
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -V -patmega328p -carduino -P/dev/cu.usbserial-1441230 -b115200 -D -Uflash:w:/var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/michael/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbserial-1441230
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/var/folders/54/5r84qmzx1ys3694t14j0zh940000gn/T/arduino_build_673547/delete.ino.hex"
avrdude: writing flash (3910 bytes):

Writing | ################################################## | 100% 0.69s

avrdude: 3910 bytes of flash written

avrdude done.  Thank you.
EasyGoing1 is offline   Reply With Quote
Old 01-29-2021, 10:55 AM   #75
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 5,829
Default Re: How could I find a FET with specific specs?

avrdude is also used for burning via SPI, or at least I also used it for raw AVRs. The thing that got me was when I was looking at the difference between programming straight AVR and using arduino is that there was a piece of code segment that needed to reside on the AVR. As I've been using AVRs like the AT90S2313 and AT90S4433 (which don't support arduino), that little code segment hurts so I didn't investigate further.

I'm sure you've run up to the memory limit before when programming microcontrollers ...
eccerr0r is offline   Reply With Quote
Old 01-31-2021, 08:24 AM   #76
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
I'm sure you've run up to the memory limit before when programming microcontrollers ...
Once I built a CO2 sensor for a friend of mine who built his own kiln inside his garage. I used an Arduino Nano, a 16x2 LCD display, a CO2 sensor, a temperature sensor, a battery-backed real-time clock, a CF card reader/writer, and a Bluetooth module for wireless programming/reprogramming. I even sprung for the custom made PCB from China.

I was constantly having to find ways to squeeze my code so that I didn't use up all the memory. This is where a deeper knowledge of C++ can really help someone, especially with variables when you can figure out how to keep your byte usage rigidly defined, it makes a HUGE difference. There is also an area of memory that you can use with some datatypes - but I forgot now how that all worked.

What was and still is frustrating with that Nano, is when your code exceeds 80% of available memory ... your code can do unpredictable things ... just odd things like not running loops or like in the CO2 sensor project, once I exceeded 80% or program memory, I would get garbage characters on the screen, so I would have to use direct memory access using chars instead of Strings and it became a real pain in the ass.

It also had horrible time drift in the RTC, but I was able to figure out how many seconds it drifted per hour and so I set it to the current time, then wrote to the flashcard the current Unix time (milliseconds since 1/1/1970), then if it ever had to be disconnected from power, the next time it booted up it would read the RTC and compare the current Unix time with the last one that was written to the CF card, and depending on how many hours it was different, it would add in the known drift and get right back to being within seconds of accurate. If the number of drift seconds per hour that accumulated from the last power-off was excessive (like if it were powered off for weeks or months) and the total of offset seconds exceeded an hour, then for each of those it would add an additional drift offset...

Been almost two years and he tells me that the time is correct every time it boots up so I obviously got that part right, but what a shitty RTC. Never used those again. It did rely on an external crystal, so it could have been the cheap Chinese crystals that I bought but I've since gone to an RTC that has everything internal to the chip and they work perfectly.

If the Teensy 4.0 would have been available back then, it would have been a far better choice. Compared to the nano, program memory space would be like going from a backyard shed to a Costco warehouse.

Last edited by EasyGoing1; 01-31-2021 at 08:30 AM..
EasyGoing1 is offline   Reply With Quote
Old 01-31-2021, 10:11 AM   #77
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 5,829
Default Re: How could I find a FET with specific specs?

I ended up carefully checking the compile results when converting object files to hex each time it completes, if it had to program a location that's beyond the end of the device, don't bother programming it, back to the drawing board, cut a few bytes out.

I had 2KB (1024 16-bit instructions) in the AT90S2313, and will be da**ed if I had to waste more of that 1024 bytes for the arduino infrastructure.

Oddly enough I had an issue with my AT90S4433 where I had a software clock, it was drifting real bad - several seconds per hour. I sort of knew why - I was using the hardware resources kind of messily because, well, I ran out of hardware resources. However I hacked my clock software to match the hardware cheat I did...and wow, only a few seconds off per month. Not bad for a breadboard that I can't properly tune the crystal.

Alas it used up more precious bytes in the 4KB (2K 16-bit instructions) to compensate for the hardware problem...
eccerr0r is offline   Reply With Quote
Old 01-31-2021, 11:25 AM   #78
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 24,596
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
As I've been using AVRs like the AT90S2313 and AT90S4433 (which don't support arduino
https://github.com/SpenceKonde/ATTinyCore


btw, i prefer STM32 chips - lots more memory for the same price as AVR.
BluePill, and Nucleo boards.

Last edited by stj; 01-31-2021 at 11:26 AM..
stj is online now   Reply With Quote
Old 01-31-2021, 12:16 PM   #79
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 5,829
Default Re: How could I find a FET with specific specs?

Why would I use it, I didn't need it then, so why now? Just more overhead...
eccerr0r is offline   Reply With Quote
Old 02-05-2021, 03:26 AM   #80
EasyGoing1
Shock Therapist
 
EasyGoing1's Avatar
 
Join Date: Sep 2016
City & State: Victorville, CA
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hardcore Geek
Posts: 646
Default Re: How could I find a FET with specific specs?

Quote:
Originally Posted by eccerr0r View Post
I ended up carefully checking the compile results when converting object files to hex each time it completes, if it had to program a location that's beyond the end of the device, don't bother programming it, back to the drawing board, cut a few bytes out.

I had 2KB (1024 16-bit instructions) in the AT90S2313, and will be da**ed if I had to waste more of that 1024 bytes for the arduino infrastructure.

Oddly enough I had an issue with my AT90S4433 where I had a software clock, it was drifting real bad - several seconds per hour. I sort of knew why - I was using the hardware resources kind of messily because, well, I ran out of hardware resources. However I hacked my clock software to match the hardware cheat I did...and wow, only a few seconds off per month. Not bad for a breadboard that I can't properly tune the crystal.

Alas it used up more precious bytes in the 4KB (2K 16-bit instructions) to compensate for the hardware problem...
Sounds to me like you're a lot more comfortable with low level programming than I am. My experience with machine language was like 1992 with a Motorola 6800 chip at the college lab... I do remember programming it with hex... the keyboard had 0-9 A-F and if you messed up, there was no delete ... you started over.

Beyond that, I think maybe twice I had to get down to the hex level when trying to hack something but that is the extent of my experience with low-level coding. I just was never very comfortable in that space for some reason. I admire people who can do it ... and who UNDERSTAND it ... I mean ... that is the highest level one can achieve in terms of mastery control over a microprocessor.

Yeah, the Arduino Nano, at least ... did not impress me with a larger project. It's just fine for simple to moderately complex tasks.

I ordered two of those new $4 Raspberry Pi Pico's with a dual core ARM Cortex M0 ... it seems like a lot of microcontroller for $4 when you add in all the GPIOs and ADCs and all the other goodies... I just wanna multi-thread on an MC before I die ... lol ... this thing has two actual cores ... I darn well better be able to multi-thread with it ... or I'm gonna troll their forums! LOL

I read the first page of the datasheet for the AT90S4433 - seems like a decent little MC - not sure how long its been since it was first introduced, but you could do some damage with that controller for sure.

A few things about MC manufacturers that both bother me and have me confused ... why aren't 12 bit ADCs standard on all modern microcontrollers? Seems to be more of a novelty than it should be! I mean who wouldn't want to read a voltage with 4096 steps of resolution compared to 1024? Best I can figure is that the cost of including it must be such that it ends up on the cutting room floor.

The other thing is why not include RTCs ... but I'm starting to see that happen more often in newer controllers. The Teensy 4.0 has a nice one with pins for battery backing it. That Teensy 4.0 can actually do some sick tricks with audio in real-time ... I think, depending on what you're doing, it can process like 16 channels of 192-bit uncompressed digital audio simultaneously and the engineer who designed it included a ton of various audio functions right in the chip. He even wrote this really weird app that lets you drag and drop objects for audio processing, cross-connecting channels and a whole slew of things ... it's like a DJs wet dream.

I have no interest in any of that except that I do want to make my own EQ someday... Mainly just to do it but also to better understand what digital EQs do at a lower level.

Mike

Last edited by EasyGoing1; 02-05-2021 at 03:29 AM.. Reason: fix typos
EasyGoing1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Badcaps.net Technical Forums © 2003 - 2021
Powered by vBulletin ®
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
All times are GMT -6. The time now is 03:12 PM.
Did you find this forum helpful?