Monday 27 August 2018

Using the Raspberry PI for Arduino development

There's quite a lot of fuss on the web right now about using the Raspberry Pi to develop sketches for the Arduino, especially the Nano. Seems few can get it working... so here's my notes of what I did to install Raspian Jessi and the Arduino IDE V1.8.6.

=========R_PI SETUP
MACBOOK
1. Format the SD card
 - SD Formatter program, Overwrite Format, label BOOT

2. raspberrypi.org
 - download RASPIAN STRETCH (image)
 - Unzip, trash zip

3. Use Etcher to write IMG to card/validate

4. MACBOOK Terminal for access to SD Card
 - $cd /Volumes/boot
 Add files
 - $ touch ssh
 - $ nano wpa_supplicant.conf
------------
  country=GB
  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  update_config=1
  network={
    ssid=“your SSID"
    psk=“your password”
}
------------

5. Quit MACBOOK Terminal.
 - Eject Devices > boot, then insert SD card in R_PI

6. Power up R_PI

7. MACBOOK Terminal again
=== this bit needed for Mac security reasons, may be not be needed on PC
 - $ cd /users/antonywatts/.ssh
 - $ nano known_hosts  // remove previous R_PI IP_Address line
                       // move down to, then highlight, ^K, ^O, ^X
===
 - Find R_PI IP_Adress
 - $ cd ~              // home
 - $ arp -a            // find R_PI IP_Address [mine was 192.168.1.16]

8. Log in to R_PI at its IP_Address
 - ssh pi@IP_Address   // pwd raspberry
 - $sudo raspi-config
  -- Change password -> “something new"
  -- Interfacing Options > P3 VNC
  -- Advanced Options > Resolution > Mode 35 1280x1024
  -- Finish, Reboot now
 - RealVNC app, File > New connection, pi/ffiddo

Use VNC for R_PI GUI access

9. Open R_PI Terminal
 - $ sudo apt-get update
 - $ sudo apt-get upgrade
 - $ sudo reboot        // reconnect VNC

========ARDUINO INSTALL via VNC to R_PI
1. Browser, arduino.cc Software > Downloads > LinuxARM > Just Download
 - to Downloads folder on R_PI

2 Application > Archiver
 - Menu > Open > go to Download folder, Right Click Arduino...xz. Open with Archiver. Wait RED/GREEN stops flashing.
- Menu > Action > extract to Downlaods

3. Terminal
 - $ cd Downloads
 - cd arduino-1.8.6
 - $ sudo ./install.sh

4 Copy my libraries and sketches to home/pi/Arduino from USB stick

5. Plug in Nano using CH340 USB serial chip. (You may have a nano with the FTDI chip… try it see if it works…)
 - driver QuinHeng HL340 loaded automatically see it with
 - Terminal $ lsusb

6. Start Arduino IDE
 - set up Tools > Board > Nano
          Tools > Processor > AYmega328P (Old Bootloader) <<<<<-----
          Tools > Port > /dev/ttyUSB0
 Restart Arduino IDE

7. Open My_OLED, compile and it runs!
IMG 0536<

PDF full description

Sunday 26 August 2018

Calibration of the Si5351 DDS

Each Si5351 module has a different crystal, whose frequency may not be exactly the 25MHz needed for exact output frequencies. But the Si5351 has the capability to compensate for that using a CALIBRATION value in your sketches. For example,

#define CALIBRATION 29000  // frequency CALIBRATION

#define FREQMIN 10000000
#define FREQMAX 15000000000

Si5351 dds;
Rotary enc = Rotary(CLK, DT);

uint64_t freq = 710000000;
uint64_t freqStep = 1000000;

void setup() {
  pinMode(CLK, INPUT_PULLUP);
  pinMode(DT, INPUT_PULLUP);
  pinMode(SW, INPUT_PULLUP);

  oled.begin();

  // set xtal capacitance, 25MHz, & CALIBRATION

  dds.init(SI5351_CRYSTAL_LOAD_8PF, 0, CALIBRATION);
  dds.drive_strength(SI5351_CLK0, SI5351_DRIVE_8MA);
  dds.output_enable(SI5351_CLK0, 1);
  dds.set_freq(freq, SI5351_CLK0);
Shows the CALIBRATION figure of 29000 used to compensate for the crystal in the "dds.init()...)" function.

7 Experiments S 001

But the question is how to find out the value of the CALIBRATION constant. The solution I have used is very simple. Tune a radio to BBC5Live on medium wave, at 909kHz. Then set the Si5351 to output what it thinks is 910kHz. This should create a 1000Hz beat tone on the radio.

Next install the WSJT-X program on your computer. This has a spectrum analyser for audio frequencies. Chose as an audio input your PC microphone and make sure it can hear your Radio. It will show the frequency of the beat tone as an input signal. Now change the CALIBRATION figure to bring the audio signal to exactly 1000Hz on the spectrum analyser. To do this you will have to edit your sketch, put in a new number, then upload to see the result. I suggest you start in 5000 steps and then as you get closer reduce to 1000, and 500.

Wednesday 8 August 2018

BARSICLE Finished Prototypes

Here they are! The finished prototypes of the beginners BARSicle project.

- The Direct Conversion RX for 40m

- The VFO/Signal Generator

- The RF Power Meter (1uW-100mW)

To come are a Power Supply (12V/2A), an SSB exciter and a 5W PA for 40m.

5 Arduino S 001