Sunday, May 27, 2018

Teensy 3.6 + 2.8" TFT LCD Display SPI Serial 240*320 ILI9341 connection and code

Just doing some experiments with a Teensy 3.6 microcontroller board, a graphical display and some other bits and pieces.
Since it was not easy to find a single source of information with a code example and pin connections, here's a compilation of it:

Schematic:


For testing porpoises the supply is not needed as long as USB power cable is connected to the board.

Bellow the code to run:

/////////////////////////////////
/*
  Just place some text on the ILI9341 display using a Teensy 3.6
  CT2GQV 2018
*/

#include <Wire.h>
#include <SPI.h>
#include "font_Arial.h"
#include <ILI9341_t3.h>


#define BACKLIGHT_PIN   3
#define TFT_DC          20
#define TFT_CS          21
#define TFT_RST         255  // 255 = unused. connect to 3.3V
#define TFT_MOSI        7
#define TFT_SCLK        14
#define TFT_MISO        12

ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);


// Pin 13 has an LED connected on most Arduino boards.
// Pin 11 has the LED on Teensy 2.0
// Pin 6  has the LED on Teensy++ 2.0
// Pin 13 has the LED on Teensy 3.0 and 3.6 by the way
int led = 13;

void setup() {               
  // for the built in LED.
  pinMode(led, OUTPUT);    
  // for the backlight
  pinMode(BACKLIGHT_PIN, OUTPUT );
  analogWrite(BACKLIGHT_PIN, 128); // 0 to 255

  tft.begin();
  tft.setRotation( 3 );
  tft.fillScreen(ILI9341_BLACK);
  tft.setCursor(10, 1);
  tft.setTextSize(2);
  tft.setTextColor(ILI9341_ORANGE);
  tft.setFont(Arial_14);
  tft.print("This side UP");
   tft.setCursor(50, 20);
  tft.setTextSize(2);
  tft.setFont(Arial_10);
  tft.print("Arial 10 font");
 
}

// the loop routine runs over and over again forever:
void loop() {
  // it just blinks the led
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

/////////////////////////////////

Code result:



The display back side (top of the display as on previous picture is the sd card side)



The testing board with backside connections:


 Teensy 3.6 pin assignment diagram.



 Have a nice week!

Saturday, May 26, 2018

MIC5205 (LB30, KB30) Low noise regulator, increasing voltage output

Yes, made a mistake, ordered a mic5205 low noise regulator 3.0V output model, when I should had ordered the 3.3V version for a project in the "pipeline".

The typical application for the IC is like this:


This particular IC is not absolutely needed on the project but why not testing new devices....I should had read better the IC reference chart when ordered... should had been MIC5205-3.3BM5 instead of MIC5205-3.0BM5, as you can see, after the dash there's the output voltage, as on the data-sheet:



Looking at the internal diagram (fixed output version on top):

..it looks pretty much a "standard" series regulation schematic so there's room for change the output voltage and that can be done the following way:


By inserting a drop voltage from ground, at the IC GND pin, to a new ground it will "force" a "floating" ground at the anode of the 1N4007 diode, being the drop voltage value at the diode the increase in the schematic output. Any diode will work and depending of the forward voltage there will be the matching increase on the output. In my case the output is now 3.5  V from the original 3V, and that is inside the 2.6 to 3.6 V specs for the devices being powered by this IC downstream.

I'm really not a big fan of the SMD format since I don't have all the proper tools to solder them, anyhow since it's getting harder to get IC's in standard DIP format, in the future, will try to get more up-to-date on surface mount.
Here's a size, comparative to a resistor and the soldering iron tip.




I had to solder it with extra solder and then removed the excess with solder wick.  


Have a nice weekend!


Sunday, May 13, 2018

ADS-B In-line amplifier experiments and bias T for 1 Ghz

By Easter was in Portugal and got an in-line satellite amplifier since it covers the ADS-B frequency of 1090Mhz
The idea was to put it in service for the ADS-B receiver, improving reception

Without any proper quality equipment to verify the effectiveness, decide do use the QSpectrum analiser software and record the data for comparative analyses.
In the process also trimmed the antenna to different lengths...
ending up in around 7cm (6.8 should be the calculated exact size).

Testing was done inside so subject to nearby interferences and yes, the support is a broom stick...

Here's the experiment and results:
 Testing with just the cable, no power and the amplifier inline:

 Powering the amplifier and no antenna:

Amplifier on without antenna and smoothing 100nF cap on the power line to the amplifier:
 
 Here with 1pF as DC blocking capacitor on the bias T:

 Now, opening the balcony door on the living room (where I was experimenting) changed results:

 Now still with the open door and a 10pF cap blocking DC:

I closed the door and experimented with a 120pF capacitor:


Testing the antenna ground plane:
7cm with GP:
 

7cm no grGP:


Ground plane helps :)

Different antenna sizes:
14cm


13cm

12cm

8cm (different scale since approaching the expected length)

7cm


In the final configuration it improved reception from my previous experiences, still the antenna being in house only get's a max of 60miles/100Km coverage.



The bias T for the amp ended up as a simple 180pF dc blocking capacitor (C1) one RF choke and a smoothing capacitor. The value was selected as a low capacitive reactance at 1Ghz and a little higher at lower frequencies:

@ 1000 Mhz

    1 pF - 159    Ohm
100 pF -     1.59 Ohm
180 pf -      0.88 Ohm
100 nF -         1.59 E-3 Ohm

@ 100 Mhz

100 nF - 1.59 E-2 Ohm
180 pF - 8.8 Ohm

The implementation and schematic:



Only missing now is to enclose everything and place it on the roof.

Have fun!


Sunday, April 15, 2018

Mains power meter and rig energy consumption.

Got this meter some time ago, idea was to place in a box with a current switch to act as mains shack power outlet, letting me measure actual power consumption of the equipments when in use.

Meter was bough out of the "bay", rated to 20A, it has 2 input and 2 output power terminals. Here Some initial testing with it:


It also has cumulative power consumption besides the other values.

I placed, this Easter when in vacation in Portugal, on a standard electrical box along with the circuit breaker rated for 6A, sure I will not need more at the moment.

The advantage is I can shutdown all the shack power from one single point while also monitoring mains values.

And bellow the measure rating for some of the equipments currently connected.

Winer is the FT-102 without tube heater on, add around more 30w for that. "Only" in RX mode:



Then the FT-307/FT-107:


..same power as the light bulb in the first picture.

Lowest power consumption goes for the "Speaky" transceiver:




The "Speaky" power supply, a Yaesu one, takes 1.8W so the actual power is lower than the 8.4W:

Both the FT-307 and FT-102 have internal power supply.

The big surprise is the Kenwood power supply, I suspect there could be some leakage at the caps .as a reason for the almost 14w.




I didn't check transmitting power consumption since the FT-307 has a fault in the PA and the FT-102 is now developing a receive fault, I suspect a cap in the AGC path. Will have to fix one of this days.

This is a good reminder to run more time on the "Speaky" transceiver so save energy.

Have a nice day!

Bench power supply ( part II )

After part I, here's part II for the conclusion of the bench power supply.

It's a dual adjustable power supply based on LM317 and LM337, 3 terminal using adjustable positive (LM317) and negative (LM337) regulators.

Basic circuit is this one after some changes on the original one and it's similar to the ones on the datasheet of the regulators:

And the finished product in the box, the right half of the box with voltage meters displaying output voltage.



The lower voltage meter although showing a positive value is measuring the negative part of the circuit. From white post (0 V / GND) to black one (- V).
I can enable the main power output on the left only also (part I blog post):

or both at the same time:
 For the USB output, in the middle, there's no need to measure since it's allways 5v and it's allways on.

Inside the mess looks like this:
 The smaller transformer is for the dual supply and the big one to the single output.

 The meter modules on the panel (small green pcb), are feed from the output at the binding posts, so, with voltages lower than 4.5V approx will go blank.


Have a great week!






Tuesday, March 13, 2018

JBC T245 / C245 Iron tip controller

Here it is the major post for February...with some delay. Remember I'm trying to do at least 1 major project/post a month this year.



I've been building this for a while, here reading the thermocouple on the JBC tip and here painting the front panel. It took longer also since the LCD display ordered arrive dead (took the one from my long wave receiver) and had some or mistakes causing short-circuits and a blown MAX6675 module.

Before you go an replicate have a look on the advantage and disadvantage of this system :

* Good:
- Super fast from power on to melt solder compared to a "traditional" iron, this one takes about 5s excluding the boot process.
- Temperature control... if you really need, I build a lot of electronics without needing it.
- Very light tip
- Short distance from hand to tip.
- Multiple types of tips to chose from.
- JBC tip's from previous experience (standard iron) have a reasonable duration, this one... time will tell.
- Controller probably will work, with minor changes, for other temperature controlled iron's.

* Bad
- The system from JBC costs in excess of 400 Eur, it's hard to justify just for the hobby that amount. A good soldering Iron will cost 10x less and does the same job. This system costs half of it but still expensive.
- Proprietary hardware on the tips and with the price of just two tips you already buy a perfectly fine soldering iron, not even considering the tip holder.
- Tips will most likely have a shorter live due to low size causing thermal fatigue shortly.
- It overshoots easily with this type of control, anyhow if you consider the set temperature as the minimum then take that as a feature.


Inside:


And during software troubleshooting:

The schematic was based on this from "Great Scott":


My schematic (approximately):
I used a 220/12+12 transformer, tip is powered by 24V AC (showing 15 on schematic).
Used also another display type (I2C), another Triac (MOC3021) and another opto-isolator (4N35).
Also for the supply I used the same transformer for the Iron and Zero crossing detector (4N35). The Arduino used a separate transformer with two regulators, one for the Arduino (7808 to vIn/vcc) itself and another for the MAX6675 and LCD display (7805 +5v) since the regulator for the Arduino was causing reset's if the MAX6675 was powered from Arduino 5v output.

Here's how fast is from power on to melting solder:
...around 5s since power is applied to the tip. I think the other Iron I have takes more than 2 minutes.

I ordered the T245-C with the foam handle and got a T245-A with plastic and foam on top. that is a good thing and that was exactly what I expected when ordering, look's JBC is adding an extra layer of isolation:


The plug on the panel is an Hirose RPC1-12RB-6P(71) with 2.5mm holes.
I only fixed with two bolts since I'm not very good at aligning holes and only have the hand drill.

The iron tip counterpart plug:


Here's connections and tip equivalent circuit:



The total cost of the project was around 215.00 Eur (full station "mimic" of the JBC one: JBC CD-2BE) including the estimated price of a normal iron stand (18 Eur). Still half of the vendor price if I had shopping around.

Will try in the future to test this controller with other similar function Irons.

The code will not be listed for the moment, it is a modified version of Scott's code with a different LCD (I2C).
The display function call in Scott's code had to me moved out of the zero crossing function since it would break I2C communication due to fast rate of interrupts. That caused me some delay until I could understand what was the situation of the display freezing. I placed the display call on the main loop updating every 0.2s.

Another problem I had was since I was doing the build according to my needs I tried to avoid separate power transformers for the iron and modules so caused a short after connecting the "-" of a bridge output to the actual tap of the AC on the transformer. This broke one rectifier bridge and also caused two diodes to fail in short circuit which then on the troubleshooting caused me a problem with a secondary short-circuit. That's what happen when you don't put on paper the changes made. The schematic on this page has that corrected.



To be done:
- More soldering/stability testing using the unit, I already did some soldering with it and so far so good.
- Code refinements on the display update part
- Filter some erroneous (over) temperature reading
- Test and implement the sleep function
- Test and implement the tip change function


Have fun!


P.S. Code as it is without further improvements:

////////////////////////////
// JBC T245 control station
// Dez 2017 - CT2GQV
//
//
////////////////////////////
// pieces of code and ideas from:
//  www.instructables.com/id/DIY-Arduino-Soldering-Station/  Great Scott, simple control
//  hackermagnet.com/portfolio/soldering-station/
//  jacoburge.co.uk/diy-jbc/
//  learn.edwinrobotics.com/230v110v-ac-mains-detection-using-arduino-raspberry-pi-and-esp8266-thing/  rising detector
//
// PINOUT
// * max6675
// Data - digital 4
// Chip Select - digital 5
// clock - digital 6
// * zero crossing detector
// pin5 of 4n35 to - digital 2
// * TRIAC_PIN control
// TRIAC_PIN opto pin1 (anode of led) to resistor of 330 and then to digital 7
// * set temperature by potentiomenter
// whipper of pot to pin analog 3

#include <max6675.h>
//url=https://github.com/adafruit/MAX6675-library
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// for future implementation
//#include <EEPROM.h>

// Settings before compile, to be changed by who compiles //
#define SELF_TEST_DELAY 1000 // delay betwen the diferent self test steps
#define SPLASH_SCREEN_DELAY 2000 // time the inital logo displays
int max_pot_temp = 260; // 380 dont allow to set to more than 380 this will also increase the pot resolution
int min_pot_temp = 150; // 120 don't allow to set temp less than 80, not needed anyway, except for sleep
int sleeptemp = 130; // the temperature to set the iron in sleep mode, 130 for now looks a good value, could be lower since it heat's up fast


// static settings //
// LCD definitions
//#define I2C_ADDR    0x27  // I2C Address, found with I2C scanner
// #define I2C_ADDR    0x3F // the new lcd
#define I2C_ADDR    0x27
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7
LiquidCrystal_I2C       lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

// zero crossing detector
#define INTERRUPT_PIN 2 // D2 from pin5 on the 4n35 optocoupler
int initial_counter_for_self_test=0; // counter for the inital self test, if increases then the zero crossing detector is working...
// TRIAC_PIN control pin via optocoupler diac
#define TRIAC_PIN 7
// potentiomenter to read set temperature
#define POT_PIN A3
#define SLEEP_PIN A0 // short to ground and will enter sleep mode, pull up from 100K resistor from 3.3v or 5v
#define TIP_CHANGE_PIN A1 // short do ground to disable power so we can change tip
// max k type termocouple interface
int thermoDO = 4;  // digital 4
int thermoCS = 5;  // digital 5
int thermoCLK = 6; // digital 6
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

// variables
float temperature;
int pottemperature;
int counter;
int readbutton; // to keep the value read on the sleep pin
int sleepmode=0; // we are not in sleep mode
int allowpower=1; // we are in power mode 1 initaly, there's no tip change


void updatedisplay() {
  pottemperature = analogRead(POT_PIN);
  pottemperature = map(pottemperature, 0, 1023, min_pot_temp, max_pot_temp);
  // going to override the read of the set temperature and place the sleeptemp
  if(sleepmode==1)pottemperature=sleeptemp;
  if(allowpower==0)pottemperature=0; // we set temp to 0, this will disable the iron by going to 0
  //lcd.clearDisplay();
  lcd.setCursor(0, 0);
  lcd.print("SET:    ");
  lcd.setCursor(4, 0);
  lcd.print(pottemperature);
  lcd.setCursor(0, 1);
  lcd.print("TMP:    ");
  lcd.setCursor(4, 1);
  lcd.print(int(temperature));
}

void setup() {
 pinMode(INTERRUPT_PIN, INPUT_PULLUP);//zero crossing pin pull up since the circuits used as example didn't had the pull up.... ???
 //pinMode(TRIAC_PIN, OUTPUT);
 //digitalWrite(TRIAC_PIN, LOW);
 //  that is from the 4n35 emiter to ground and collector to arduino. 
 lcd.begin (16,2,LCD_5x8DOTS);
 lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); // init the backlight
 lcd.setBacklight(1);       
 lcd.home ();                   // go home  
 lcd.print("    Soldering   "); 
 lcd.setCursor(0,1);
 lcd.print("    Controler   "); 
 delay(SPLASH_SCREEN_DELAY);
 // clears the controler message only since the next one is going to override the "Soldering" message 
 lcd.setCursor(0,1); lcd.print("                ");
 lcd.setCursor(0,0);
 if (isnan(thermocouple.readCelsius())) {
  lcd.print("Sensor: FAIL  ");
 } else { lcd.print("Sensor: OK    "); }
 delay(SELF_TEST_DELAY);
 lcd.clear();
// so it does not turn on on power on during boot...
temperature=30;
pottemperature=25;

pinMode(TRIAC_PIN, OUTPUT);
digitalWrite(TRIAC_PIN, LOW);

// let's attach the interrupr
attachInterrupt(0, zero, RISING); 
} // end setup


// zero crossing interrupt
void zero() {
 // code from DIYSolderingStation.ino
  counter++;
  if (counter < 40) {
    if (temperature <= pottemperature) {
      digitalWrite(TRIAC_PIN, HIGH);
    }
    else {
      digitalWrite(TRIAC_PIN, LOW);
    }
  }
  if (counter == 40) {
    digitalWrite(TRIAC_PIN, LOW);
    detachInterrupt(0);
    temperature = thermocouple.readCelsius();
    counter = 0;
    attachInterrupt(0, zero, RISING);
  }
} // end zero_crossing

void loop() {
   readbutton = analogRead(SLEEP_PIN); // iron on holder so lets set low power
    if (readbutton <=10) { // that is the pin goes low because the ground of iron shorts pin to ground.
       // sleep mode
       sleepmode=1;
       if(allowpower==0)allowpower=1; // we touched sleep mode after power is disable means we change tip else allowpower is allways 1.
    } else {
       sleepmode=0; // we are not in sleep mode
    }
   
   readbutton = analogRead(TIP_CHANGE_PIN); // to change tip we read if the iron touched that pin
   if (readbutton <=10) { // that is the pin goes low because the ground of iron shorts pin to ground and then we disable power to change tip
       // sleep mode
       allowpower=0; // shuttdown power to change tip
    } else {
       allowpower=1; // give power since it's normal operation
    }
   
updatedisplay();  
delay(200);

}
// end code