<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DIY Archives - Digital Dowsing</title>
	<atom:link href="https://www.digitaldowsing.com/category/diy/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Building Gear for a Paranormal Planet</description>
	<lastBuildDate>Mon, 21 Feb 2022 23:24:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.7</generator>
	<item>
		<title>Scanning Radio AKA Ghost Box &#8211; Installment 3</title>
		<link>https://www.digitaldowsing.com/diy/scanning-radio-aka-ghost-box-installment-3/</link>
		
		<dc:creator><![CDATA[Bill]]></dc:creator>
		<pubDate>Mon, 21 Feb 2022 23:24:12 +0000</pubDate>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[BB&B]]></category>
		<category><![CDATA[BreadBoardsAndBill]]></category>
		<category><![CDATA[ghost box]]></category>
		<category><![CDATA[ghostbox]]></category>
		<category><![CDATA[scanning radio]]></category>
		<guid isPermaLink="false">https://www.digitaldowsing.com/?p=34252</guid>

					<description><![CDATA[<p>Installment 2 of the DIY scanning radio project. Part of the Bread Boards and Bill series. </p>
<p>The post <a href="https://www.digitaldowsing.com/diy/scanning-radio-aka-ghost-box-installment-3/">Scanning Radio AKA Ghost Box &#8211; Installment 3</a> appeared first on <a href="https://www.digitaldowsing.com">Digital Dowsing</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>Project Overview</strong></h2>



<p>This is part 3 of a DIY Scanning Radio Ghost Box series using an Arduino Uno which was launched on Twitter as part of the Bread Boards &amp; Bill series.</p>



<p>Prior to continuing forward the steps in <a href="https://www.digitaldowsing.com/diy/scanning-radio/">DIY Ghost Box Installment 1</a> and <a href="https://www.digitaldowsing.com/diy/scanning-radio-part-2/">DIY Ghost Box Installment 2</a> need to have been completed.</p>



<p>In this installment we are adding more features and improving the functions for the software and hardware.</p>



<p>Future installments will build upon the steps in these instructions.</p>



<h2 class="wp-block-heading">Reference</h2>



<p>The following is the pdf version of these instructions which includes additional information and tips beyond the instructions in this web guide. </p>



<div data-wp-interactive="" class="wp-block-file"><object data-wp-bind--hidden="!selectors.core.file.hasPdfPreview" hidden class="wp-block-file__embed" data="https://www.digitaldowsing.com/wp-content/uploads/2022/02/ghost-box-part-3rev.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of Embed of Scanning Radio DIY Project Installment 3 from Bread Boards &amp; Bill Series.."></object><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/02/ghost-box-part-3rev.pdf">Scanning Radio DIY Project Installment 3 from Bread Boards &amp; Bill Series</a><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/02/ghost-box-part-3rev.pdf" class="wp-block-file__button" download>Download</a></div>



<h2 class="wp-block-heading">Materials Needed</h2>



<p>This section will require a loading a new sketch to your Arduino and completion of DIY Ghost Box part 2.</p>



<ol><li>Download and un-zip this file to your PC. This file contains GB.exe (Windows Software) and ghostbox_ver301.ino</li></ol>



<h2 class="wp-block-heading">Building</h2>



<h3 class="wp-block-heading">Hardware Setup</h3>



<p>This project uses the build from part 2, no additional hardware is required.</p>



<h2 class="wp-block-heading">Source Code</h2>



<ol><li>Use the link below to download the new Arduino program file or cut and past from the code below. </li><li>Save it to your computer and open in the Arduino IDE editor (the file is in a zip format.).</li></ol>



<p><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/02/ghost-box-part-3rev.pdf">Part 3 Arduino source code zip file</a></p>



<pre class="wp-block-code"><code>//******************************************************************************************
// Ghost Box program scans up then down flashes led on UNO indicates sweeping
// Microphone add and new library Mutes while not scanning
//*********************************************************************************************
/// \file  TestTEA5767.ino
/// \brief An Arduino sketch to operate a TEA5767 chip based radio using the Radio library.
///
/// \author Matthias Hertel, http://www.mathertel.de
/// \copyright Copyright (c) 2014 by Matthias Hertel.\n
/// This work is licensed under a BSD style license.\n
//
//  Sketch modified for the Simple ghost box project 1/20/2022
//  added functions for serial interface software "BETA"
//
//*********************************************************************************************************
//  Includes
//*********************************************************************************************************
#include &lt;radio.h&gt;                                     // Library 
#include &lt;Wire.h&gt;                                      // SLC SDA communications for radio module
#include &lt;TEA5767.h&gt;                                   // Tells Radio library how to interface the radio module
TEA5767 radio ;                                        // Define radio model
//*********************************************************************************************************
// Global Variables
//*********************************************************************************************************
int LED1 = 13;                                        // create a name for led1 on the arduino
int hold = 50;                                        // hold is the delay time
int inc = 20;                                         // How far to move when tunning
int start_FM = 8790;//8790                            // US FM Band start **87.7 excluded
int stop_FM = 10790;//10790                           // US FM band stop
int breadboard = 12;                                  // power pin to breadboard
int mic = 11;                                         // microphone signal
int AntIn = 0;                                        // antena energy value 1 count = 1.1 / 1024 = .0010 volts
int scom;                                             // serial input
int mute = 1;                                         // loop mute
int sdir = 7;                                         // scan direction
int swsp = 0;                                         // speak when spoken to 1 on 0 off
int antst = 0;                                        // Antenna start scan 1= on 0 = off
int antlv = 800;                                      // Antenna levelk to start
int atsc = 0;                                         // Antenna Scan on or off 1= on
int atc = 0;                                          // Active tunned frequency
int mtune = 0;                                        // Manual tunning 1= on 0 = off
int hld = 0;                                          // hold till clear
//*********************************************************************************************************
// Program Setup
//*********************************************************************************************************
void setup()
{
  pinMode(LED1, OUTPUT);                               // led on board led
  pinMode(breadboard  , OUTPUT);                       // breadboard power
  Wire.begin();                                        // start IC2 communications
  digitalWrite(breadboard, HIGH);                      // power ON breadboard
  radio.init();                                        // Start radio
  radio.setMute(1);                                    // Mute ON radio sound off

  delay(10);                                           // allow breadboard to power ON

  Serial.begin(115200);

}
//*********************************************************************************************************
// Main program
//*********************************************************************************************************
void loop()
{
  while (!Serial.available())                         
  { 
    if (mtune == 0)                                   //  mtune 
     {
      if (mute == 0)                                  //  mute 
      {
        int a = 0;
       if (swsp == 1)                                 //  swsp 
       {
        while (a == 0)
          {
            delay(5);
            a =  digitalRead(mic);
           }
         delay(500);
        }
       if (antst == 1)
       {  
        AntIn = analogRead(A0);                            // read energy on antenna
        delay(10);
        while (AntIn &lt;= antlv) 
          {
            AntIn = analogRead(A0); 
            delay(10);
           }                                             // read energy on antenna
         }//ant tune antenna start speak when spoken start  
        
        radio.setMute(0);                                 // un-mute the radio and allow it to scan

        if (atsc == 1){scan_by_ant();}                    // if antenna scan is on

        if (sdir != 6 and atsc == 0){scan_up_band();}     //scan up on

        if (sdir != 5 and atsc == 0){scan_down_band();}   //scan down on
     
     
  
        } // muteoff
      } // mute = off
    if (mute == 1) {radio.setMute(1);}   // set mute
   } // mtune = 1

  if (Serial.available() &gt; 0)
  {
    scom = Serial.readString().toInt();
    Serial.flush();
  }


  switch (scom)
  {
    case 1: mute_off(); break;     // mute off
    case 2: mute_on(); break;      // mute on
    case 3: speak_on(); break;     // speak on
    case 4: speak_off(); break;    // speak off
    case 5: scan_up(); break;      // scan up
    case 6: scan_down(); break;    // scan dn
    case 7: scan_all(); break;     // scan up/dn 'all'
    case 8: increment(); break;    // inc
    case 9:  hld1(); break;          // hold
    case 10: ATon(); break;        // Antenna on / off
    case 11: AToff(); break;       // Antenna on / off
    case 12: ATOUT(); break;       // Antenna voltage
    case 13: Fstart(); break;      // fre-start
    case 14: Fstop(); break;       // fre-stop
    case 15: hold_on(); break;     // Freq change by antenna
    case 16: hold_off(); break;    // Scan direction change by Antenna
    case 17: actune(); break;      // Active tunning
    case 18: mtune_off(); break;   // manual tuning mode
    case 19: mtune_on(); break;    // manual tuning mode
    case 20: antscan_on(); break;  // antenna scan
    case 21: antscan_off(); break; // antenna scan
    default: delay(1);             // end test
  } // case select end

} // loop end

//*********************************************************************************************************
// End of main loop
//*********************************************************************************************************
// Sub routines
//*********************************************************************************************************
void mute_off() {
  radio.setMute(0);  // un-mute the radio and allow it to scan
  mute = 0;
}

void mute_on() {
  radio.setMute(1);  //Serial.print(1);                                 // un-mute the radio and allow it to scan
  mute = 1;
}

void speak_on() {
  swsp = 1; // speak on
}                 // speak when spoken to 1 on 0 off}

void speak_off() {
  swsp = 0; // speak off
}

void scan_up() {
  sdir = 5; // scan up
}

void scan_down() {
  sdir = 6; // scan dn
}

void scan_all() {
  sdir = 7; // scan up/dn 'all'
}

void increment() {} // inc

void hld1() {}      // hold

void ATon() {
  antst = 1; // Antenna on / off
}

void AToff() {
  antst = 0; // Antenna on / off
}

void ATOUT() {} // Antenna voltage

void Fstart()// read input for start
{
  while (!Serial.available()) {}
  start_FM = Serial.readString().toInt();
  Serial.print(start_FM);
}// fre-start

void Fstop()
{
  while (!Serial.available()) {}
  stop_FM = Serial.readString().toInt();
  Serial.print(stop_FM);
}// fre-stop

void hold_on() {hld = 1;} // Hold on

void hold_off() {hld = 0;} // Hold off

void actune()
{
  while (!Serial.available()) 
  {
    delay(1);
  }
  atc = Serial.readString().toInt();
  radio.setFrequency(atc);
  radio.setMute(0);
  Serial.print(atc);
} // actual tunning

void mtune_off() {
  mtune = 0; // mantune
}

void mtune_on() {
  mtune = 1; // mantune
}

void antscan_on() {
  atsc = 1; // antenna scan on
}

void antscan_off() {
  atsc = 0; // antenna scan off
}

void test_hld()
{
  while (hld == 1)
         {
          if (Serial.available() &gt; 0)
          {
             scom = Serial.readString().toInt();
             Serial.flush(); 
             if (scom == 15){hold_on();}
             if (scom == 16){hold_off();}
          }
          delay(10);
         } 
}

void scan_by_ant()
{
          AntIn = map(analogRead(A0), 0, 1024, 8790, 10800);                      // read energy on antenna
          digitalWrite(LED1, HIGH);                         // led ON
          radio.setFrequency(AntIn);                        // Set radio to new frequency
          if (Serial.available() &gt; 0) {return;}
          delay(hold / 2);                                  // wait here for 1/2 of hold
          digitalWrite(LED1, LOW);                          // led OFF
          delay(hold / 2);
          if (mute == 0) {Serial.print(AntIn);}
          test_hld();  
}

void scan_up_band()
{
           for ( int r = start_FM; r &lt;= stop_FM; r = r + inc)
          {
            digitalWrite(LED1, HIGH);                         // led ON
            radio.setFrequency(r);                            // Set radio to new frequency
          if (Serial.available() &gt; 0) {return;}
            delay(hold / 2);                                  // wait here for 1/2 of hold
            digitalWrite(LED1, LOW);                          // led OFF
            delay(hold / 2);                                  // wait here for 1/2 of hold
            if (mute == 0) {Serial.print(r);}
            test_hld();
           }//scan
  }
void scan_down_band()
{
 for ( int r = stop_FM - inc; r &gt;= start_FM + inc; r = r - inc)
          {
            digitalWrite(LED1, HIGH);                        // led ON
            radio.setFrequency(r);                           // Set radio to new frequency
           if (Serial.available() &gt; 0) {return;}
            delay(hold / 2);                                  // wait here for 1/2 of hold
            digitalWrite(LED1, LOW);                           // led OFF
            delay(hold / 2);                                  // wait here for 1/2 of hold
            if (mute == 0) {Serial.print(r);}
            test_hld();
            }//scan   
  }</code></pre>



<p>Example Python code using Python version 3.3. Python is an open source project that works on many different platforms.</p>



<pre class="wp-block-code"><code>
import tkinter as tk
import tk_tools
from tkinter import ttk
import warnings
import serial
import serial.tools.list_ports
import time
from tkinter.messagebox import showinfo

arduino_ports = &#91;
    p.device
    for p in serial.tools.list_ports.comports()
    if 'Arduino' or 'CH340' in p.description  # may need tweaking to match new arduinos
]
if not arduino_ports:
    raise IOError("No Arduino found")
if len(arduino_ports) &gt; 1:
    warnings.warn('Multiple Arduinos found - using the first')

arduino = serial.Serial(arduino_ports&#91;0],baudrate=115200, timeout=.1)

root = tk.Tk()
root.title("Ghost Box Version 0.1 Arduino found on "+str(arduino_ports&#91;0]))
g = 0
h1 = 0
x = 1
ra = 0
n = 16

def ts(v):
    root.title(str(v))


def tc():
    root.title(txt.get())
    first = 0
    last = 500
    txt.delete(first, last)

def fc1(): #3 or 4 swsp on off
    arduino.write(bytes(str(var1.get()), 'utf-8'))

def fc2(): # antenna start on/off 11 12
    arduino.write(bytes(str(var2.get()), 'utf-8'))

def fc3(): # antenna start on/off 20 21
    arduino.write(bytes(str(var3.get()), 'utf-8'))

def fl():
    #var1 check box
    #global g
    if vr.get() == 1:
        g = 5
        arduino.write(bytes(str(g), 'utf-8'))
    if vr.get() == 2:
        g = 6
        arduino.write(bytes(str(g), 'utf-8'))
    if vr.get() == 3:
        g = 7

        arduino.write(bytes(str(g), 'utf-8'))

def rf(): #stops happy fingers button M
    m.config(state='active')

def rr():#stops happy fingers button E
    e.config(state='active')


def manual_on_off():
    global h1
    e.config(state='disabled')
    if h1 == 1:
        h1 = 0
        g = 18
        arduino.write(bytes(str(g), 'utf-8'))#off
        led2.to_green()
        time.sleep(.25)

    else:
        h1 = 1
        g=19
        arduino.write(bytes(str(g), 'utf-8')) #on
        led2.to_green(on=True)
        time.sleep(.25)



    root.after(50, rr)


def mute_on_off():
    global x
    m.config(state='disabled')
    if x == 1 :
        x = 2
        led.to_green(on=True)
        arduino.write(bytes(str(x), 'utf-8'))
        time.sleep(.25)

    else:
        x = 1
        led.to_green()
        arduino.write(bytes(str(x), 'utf-8'))
        time.sleep(.25)

    root.after(50, rf)

def hold_on_off():
    global n
    m.config(state='disabled')
    if n == 16 : #on
        n = 15
        led1.to_green(on=True)
        arduino.write(bytes(str(n), 'utf-8'))
        time.sleep(.25)

    else:
        n = 16 #off
        led1.to_green()
        arduino.write(bytes(str(n), 'utf-8'))
        time.sleep(.25)

    root.after(50, rf)

def wtf():
      data = str(arduino.readline(), 'utf-8')
      arduino.flushInput()
      dtm = data.split("*")&#91;0]
      if dtm.find("*") == -1:
       if len(dtm) &gt;=4 :  # strip nul string from library debug *1234
          dv = int(dtm.strip())/100
          z.set_value(str(dv))
          p.set_value(dv)


      root.after(50, wtf)

#radio buttons
vr = tk.IntVar()
vr.set(3)
rb = tk.Radiobutton(root, text="Scan Up   .", variable=vr, value=1, command=fl)
rb.grid(row=0, column=2, sticky='NW')
rb1 = tk.Radiobutton(root, text="Scan Down ", variable=vr, value=2, command=fl)
rb1.grid(row=0, column=2, sticky='W')
rb2 = tk.Radiobutton(root, text="Scan UP/DN", variable=vr, value=3, command=fl)
rb2.grid(row=0, column=2, sticky='SW')

#checkbox
var1 = tk.IntVar()
c1 = tk.Checkbutton(root, text='Speak when spoken to', variable=var1, onvalue=3, offvalue=4, command=fc1)
c1.grid(row=8, column=0)

#checkbox
var2 = tk.IntVar()
c1 = tk.Checkbutton(root, text='Antenna Start', variable=var2, onvalue=10, offvalue=11, command=fc2)
c1.grid(row=8, column=1)

#checkbox
var3 = tk.IntVar()
c1 = tk.Checkbutton(root, text='Antenna Scan', variable=var3, onvalue=20, offvalue=21, command=fc3)
c1.grid(row=8, column=2)


# slider
#w = tk.Scale(from_=8790, to=10790, command=ts)#, relief='sunken'
#w.grid(row=0, column=0,sticky='nse')
#horizontal slider
#s = tk.Scale(from_=0, to=200, command=ts, orient='horizontal')
#s.grid(row=6, column=1)

#tesxt box
#txt = tk.Entry(width=10)
#txt.grid(column=1, row=8)

#gauge
p = tk_tools.Gauge(root, min_value=87.9,max_value=109.0, unit=' FM')
p.grid(row=0, column=1,sticky='nw')
p.set_value(0.0)

#zeven segment
z = tk_tools.SevenSegmentDigits(root, digits=5, background='light grey', digit_color='red')
z.grid(row=1, column=1,sticky='n')
z.set_value('8790')
x = 0

#leds
led = tk_tools.Led(root, size=20)
led.grid(row=0, column=0, sticky='NEW')
led.to_green(on=True)

led1 = tk_tools.Led(root, size=20)
led1.grid(row=0, column=0,sticky='ew')
led1.to_green()

led2 = tk_tools.Led(root, size=20)
led2.grid(row=0, column=0, sticky='sew')
led2.to_green()




#buttons           "Active Only
m = tk.Button(text="Mute - Radio ", command=mute_on_off)
m.grid(row=0, column=0, sticky='N')
B = tk.Button(text="Hold - Radio ", command=hold_on_off)
B.grid(row=0, column=0)
e = tk.Button(text="Manual  Tune", command=manual_on_off)
e.grid(row=0, column=0, sticky='S')
#q = tk.Button(text="Hold", command=tc)
#q.grid(row=9, column=0, sticky='N')


def callback(*args):
    showinfo(title='Information', message=args)


o = tk.Label(root, text="Powered By Digital Dowsing")
o.grid(row=9, column=1)
o1 = tk.Label(root, text="Start Freq")
o1.grid(row=10, column=0)
o2 = tk.Label(root, text="Active Freq")
o2.grid(row=10, column=1)
o3 = tk.Label(root, text="Stop Freq")
o3.grid(row=10, column=2)


# handle event list box
def items_selected(event): # handle item selected event
    selected_indices = listbox.curselection() # get selected indices
    selected_langs = ",".join(&#91;listbox.get(i) for i in selected_indices])    # get selected items
    msg = f'You selected: {selected_langs}'
    showinfo(title='List Box', message=msg)


# Combo box
def changed(event):
    """ handle the como changed event  12 """
    g = 13
    arduino.write(bytes(str(g), 'utf-8'))
    time.sleep(1)
    arduino.write(bytes(selected_v.get(), 'utf-8'))
    time.sleep(.25)

# Combo box
def changed1(event):
    """ handle the combo1 changed event 17 active tune send channel """
    g = 17
    arduino.write(bytes(str(g), 'utf-8'))
    time.sleep(1)
    arduino.write(bytes(selected_v1.get(), 'utf-8'))
    time.sleep(.25)
# Combo box
def changed2(event):
    """ handle the combo2 changed event 13 """

    #showinfo(title='Freq Start', message=f'You selected {selected_v2.get()}!')
    g =14
    arduino.write(bytes(str(g), 'utf-8'))
    time.sleep(1)
    arduino.write(bytes(selected_v2.get(), 'utf-8'))
    time.sleep(.25)

# create a combobox
selected_v = tk.StringVar()
cb = ttk.Combobox(root, textvariable=selected_v)
for h in range(8790,10810,20):
   cb&#91;'values']= tuple(list(cb&#91;'values']) + &#91;str(h)])
cb.current(0)
cb&#91;'state'] = 'readonly' # prevent typing a value
cb.grid(row=12,column=0)# place the widget
cb.bind('&lt;&lt;ComboboxSelected&gt;&gt;',changed)


# create a combobox#1
selected_v1 = tk.StringVar()
cb1 = ttk.Combobox(root, textvariable=selected_v1)
for h in range(8790,10810,20):
   cb1&#91;'values']= tuple(list(cb1&#91;'values']) + &#91;str(h)])
cb1.current(50)
cb1&#91;'state'] = 'readonly' # prevent typing a value
cb1.grid(row=12,column=1,sticky='EW')# place the widget
cb1.bind('&lt;&lt;ComboboxSelected&gt;&gt;',changed1)


# create a combobox#2
selected_v2 = tk.StringVar()
cb2 = ttk.Combobox(root, textvariable=selected_v2)
for h in range(10790,8770,-20):
   # Add itmes in combobox through Loop code
   cb2&#91;'values']= tuple(list(cb2&#91;'values']) + &#91;str(h)])
cb2.current(0)
cb2&#91;'state'] = 'readonly' # prevent typing a value
cb2.grid(row=12,column=2,sticky='w')# place the widget
cb2.bind('&lt;&lt;ComboboxSelected&gt;&gt;',changed2)


# Creating Menubar
menubar = tk.Menu(root)

# Adding File Menu and commands
file = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label='File', menu=file)
file.add_command(label='Save', command=None)
file.add_separator()
file.add_command(label='Exit', command=root.destroy)

# Adding Help Menu
help_ = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label='Help', menu=help_)
help_.add_command(label='Ghostbox Help', command=None)
#help_.add_command(label='Demo', command=None)
help_.add_separator()
help_.add_command(label='About BB&amp;B', command=None)

# display Menu
root.config(menu=menubar)


root.after(100, wtf)
root.mainloop()
</code></pre>



<h3 class="wp-block-heading">Testing</h3>



<ol><li>Download or paste the new code into the Arduino IDE editor.</li><li>The IDE editor will compile the new sketch and upload it to your Arduino Ghost Box project.</li><li>See the attached <a href="https://www.digitaldowsing.com/wp-content/uploads/2022/02/ghost-box-part-3rev.pdf">PDF</a> in the reference section for additional tips on changing this code to alter functions.</li><li>Download and run the python program <strong>gb.exe</strong> </li><li><strong>Note</strong>: <strong>you must have your Arduino Uno attached to your PC before starting the program</strong></li></ol>



<h3 class="wp-block-heading"></h3>



<p></p>



<h2 class="wp-block-heading">Looking Ahead to Installment 4</h2>



<p>In the next installment, we will discuss adding a physical display and a switch to allow the GhostBox to run with all features seen using the software. </p>



<p>Installment 4 will be a late summer release.</p>
<p>The post <a href="https://www.digitaldowsing.com/diy/scanning-radio-aka-ghost-box-installment-3/">Scanning Radio AKA Ghost Box &#8211; Installment 3</a> appeared first on <a href="https://www.digitaldowsing.com">Digital Dowsing</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Scanning Radio AKA Ghost Box &#8211; Installment 2</title>
		<link>https://www.digitaldowsing.com/diy/scanning-radio-part-2/</link>
		
		<dc:creator><![CDATA[Bill]]></dc:creator>
		<pubDate>Mon, 24 Jan 2022 00:05:04 +0000</pubDate>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[BB&B]]></category>
		<category><![CDATA[BreadBoardsAndBill]]></category>
		<category><![CDATA[ghost box]]></category>
		<category><![CDATA[ghostbox]]></category>
		<category><![CDATA[scanning radio]]></category>
		<guid isPermaLink="false">https://www.digitaldowsing.com/?p=34112</guid>

					<description><![CDATA[<p>Installment 2 of the DIY scanning radio project. Part of the Bread Boards and Bill series. </p>
<p>The post <a href="https://www.digitaldowsing.com/diy/scanning-radio-part-2/">Scanning Radio AKA Ghost Box &#8211; Installment 2</a> appeared first on <a href="https://www.digitaldowsing.com">Digital Dowsing</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>Project Overview</strong></h2>



<p>This is part 2 of a DIY Scanning Radio Ghost Box series using an Arduino Uno which was launched on Twitter as part of the Bread Boards &amp; Bill series.</p>



<p>Prior to continuing forward the steps in <a href="https://www.digitaldowsing.com/diy/scanning-radio/">DIY Ghost Box Installment 1</a> need to have been completed.</p>



<p>In this installment we are adding more features and improving the functions for the software and hardware.</p>



<p>Future installments will build upon the steps in these instructions.</p>



<h2 class="wp-block-heading">Reference</h2>



<p>The following is the pdf version of these instructions which includes additional information and tips beyond the instructions in this web guide. </p>



<div data-wp-interactive="" class="wp-block-file"><object data-wp-bind--hidden="!selectors.core.file.hasPdfPreview" hidden class="wp-block-file__embed" data="https://www.digitaldowsing.com/wp-content/uploads/2022/01/ghost-box-part-2E.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of Embed of PDF Version of Scanning Radio DIY Project Installment 2 from Bread Boards &amp; Bill Series.."></object><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/ghost-box-part-2E.pdf">PDF Version of Scanning Radio DIY Project Installment 2 from Bread Boards &amp; Bill Series</a><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/ghost-box-part-2E.pdf" class="wp-block-file__button" download>Download</a></div>



<h2 class="wp-block-heading">Materials Needed</h2>



<p>This section will require a microphone&nbsp;to add the <em>Speak When Spoken To</em> option.</p>



<ol><li>Breadboard &#8211; Breadboards come in a wide variety. For this project, most any will work. Consider buying a multi-pack or a bundle that has jumper wires included. Available from Amazon and many other retailers. As we do more projects this year, a breadboard will make the builds&nbsp;easier.</li><li>Short bare wire 2-3 inches long &#8211; you can remove the coating of one of your existing jumper wires</li><li><a href="https://www.amazon.com/dp/B00XT0PH10">Microphone</a> which allows the <em>Speak When Spoken To</em> option</li></ol>



<h2 class="wp-block-heading">Building</h2>



<h3 class="wp-block-heading">Hardware Setup</h3>



<p>It&#8217;s time to add a breadboard to the project. A breadboard will allow for more devices and a cleaner method of connecting items to the Arduino Uno.</p>



<p>The microphone connection has three leads:</p>



<ol><li>VCC, connected to Arduino pin 12</li><li>Ground, connected to Arduino Uno GND</li><li>Out, connected to Arduino Uno pin 11.</li></ol>



<p>Later on in the example code, you will also see an output called BreadBoard. This output is used to power the breadboard when the program is&nbsp;running aids in keeping parts safe from mistakes while setting&nbsp;things up.</p>



<p>One last item needed is a short bare wire 2-3 inches long; this wire will act as an antenna responding to EMF and Static electricity.</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://www.digitaldowsing.com/wp-content/uploads/2022/01/bbbp2_bb-1030x898.jpg" alt="Ghost Box" class="wp-image-34114"/></figure>



<h3 class="wp-block-heading">Software Setup</h3>



<ol><li>From the <strong>Tools</strong> menu, open the <strong>Library Manager</strong>.</li><li>Next, in the Library Manager search bar, enter <strong>radio</strong>.</li><li>Select the <strong>Radio Library</strong> and <strong>Install</strong>. </li><li>Close the Library Manager&nbsp;when done.</li></ol>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="521" height="313" src="https://www.digitaldowsing.com/wp-content/uploads/2022/01/Screen-Shot-2022-01-23-at-3.03.52-PM.png" alt="" class="wp-image-34116" srcset="https://www.digitaldowsing.com/wp-content/uploads/2022/01/Screen-Shot-2022-01-23-at-3.03.52-PM.png 521w, https://www.digitaldowsing.com/wp-content/uploads/2022/01/Screen-Shot-2022-01-23-at-3.03.52-PM-398x239.png 398w, https://www.digitaldowsing.com/wp-content/uploads/2022/01/Screen-Shot-2022-01-23-at-3.03.52-PM-300x180.png 300w, https://www.digitaldowsing.com/wp-content/uploads/2022/01/Screen-Shot-2022-01-23-at-3.03.52-PM-450x270.png 450w" sizes="(max-width: 521px) 100vw, 521px" /></figure>



<h3 class="wp-block-heading">Source Code</h3>



<ol><li>Use the link below to download the new Arduino program file or cut and past from the code below. </li><li>Save it to your computer and open in the Arduino IDE editor (the file is in a zip format.).</li></ol>



<p><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/gb_scan_updn_part_2.zip">Part 2 Arduino source code zip file</a></p>



<pre class="wp-block-code"><code>//******************************************************************************************
// Ghost Box program scans up then down flashes led on UNO indicates sweeping
// Microphone add and new library Mutes while not scanning
//*********************************************************************************************
/// \file  TestTEA5767.ino
/// \brief An Arduino sketch to operate a TEA5767 chip based radio using the Radio library.
///
/// \author Matthias Hertel, http://www.mathertel.de
/// \copyright Copyright (c) 2014 by Matthias Hertel.\n
/// This work is licensed under a BSD style license.\n
//
//  Sketch modified for the Simple ghost box project 1/20/2022
//
//*********************************************************************************************************
//  Includes 
//*********************************************************************************************************
#include &lt;radio.h&gt;                                     // Library 
#include &lt;Wire.h&gt;                                      // SLC SDA communications for radio module
#include &lt;TEA5767.h&gt;                                   // Tells Radio library how to interface the radio module
TEA5767 radio ;                                        // Define radio model
//*********************************************************************************************************
// Global Variables
//*********************************************************************************************************
int LED1 =13;                                         // create a name for led1 on the arduino
int hold =20;                                         // hold is the delay time
int inc = 20;                                         // How far to move when tunning 
int start_FM = 9230;//8790                            // US FM Band start **87.7 excluded 
int stop_FM = 9990;//10790                            // US FM band stop
int breadboard = 12;                                  // power pin to breadboard
int mic = 11;                                         // microphone signal
int AntIn = 0;                                        // antena energy value 1 count = 1.1 / 1024 = .0010 volts 
//*********************************************************************************************************
// Program Setup
//*********************************************************************************************************  
void setup()                                           
{
  pinMode(LED1, OUTPUT);                               // led on board led
  pinMode(breadboard  , OUTPUT);                       // breadboard power
  Wire.begin();                                        // start IC2 communications
  digitalWrite(breadboard, HIGH);                      // power ON breadboard
  radio.init();                                        // Start radio 
  radio.setMute(1);                                    // Mute ON radio sound off
  delay(100);                                          // allow breadboard to power ON
}
//*********************************************************************************************************
// Main program 
//*********************************************************************************************************
void loop()
{
  delay(10);                                          // allow analog time to settle 
  AntIn = analogRead(A0);                             // read energy on antenna 
  radio.setMute(1);                                   // radio mute ON
  int a = digitalRead(mic);                           // read mic to a
  
  // to talk or not to talk
  if ((AntIn &gt; 400) or (a == 0))                      // if Antin is greater  than 340 or a = 1 mic on then scan
  {
    while (a == 0)                                    // while mic = 1 wait here
    {
      delay(5);                                       // delay 5 ms
      a =  digitalRead(mic);                          // read mic to a
    }
   delay(500);                                        // wait 1.5 seconds before responding  
   radio.setMute(0);                                  // un-mute the radio and allow it to scan
   
  // for loop and scan from start-FM to stop-FM stepping by inc value in MHz
   for ( int r = start_FM; r &lt;= stop_FM;r = r+ inc)  
   {
    digitalWrite(LED1, HIGH);                         // led ON
    radio.setFrequency(r);                            // Set radio to new frequency
    delay(hold/2);                                    // wait here for 1/2 of hold
    digitalWrite(LED1, LOW);                          // led OFF
    delay(hold/2);                                    // wait here for 1/2 of hold
   }
   
//     for loop and scan from stop-FM to start-FM stepping by inc value in MHz ** -/+ inc to prevent repeat scan
    for ( int r = stop_FM-inc;r &gt;= start_FM+inc;r = r- inc)  
   {
    digitalWrite(LED1, HIGH);                         // led ON
    radio.setFrequency(r);                            // Set radio to new frequency
    delay(hold/2);                                    // wait here for 1/2 of hold
    digitalWrite(LED1, LOW);                          // led OFF
    delay(hold/2);                                    // wait here for 1/2 of hold
   }
  }
}
//*********************************************************************************************************
// End of program
//*********************************************************************************************************</code></pre>



<h3 class="wp-block-heading">Testing</h3>



<ol><li>Download or paste the new code into the Arduino IDE editor.</li><li>Click the right arrow &#8216;Left top of the IDE screen.&#8217;</li><li>The IDE editor will compile the new sketch and upload it to your Arduino Ghost Box project.</li><li>See the attached <a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/ghost-box-part-2E.pdf">PDF</a> in the reference section for additional tips on changing this code to alter functions.</li></ol>



<h3 class="wp-block-heading">Example Result</h3>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<div class='avia-iframe-wrap'><iframe title="Ghost Box demo pre-part 2" width="1500" height="844" src="https://www.youtube.com/embed/J1OF3XB4z18?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div></figure>



<h2 class="wp-block-heading">Looking Ahead To Installment 3</h2>



<p>In the next installment, we will discuss adding a display and doing more with the antenna and power. </p>



<p>The Ghost box can function without being connected to a computer.</p>
<p>The post <a href="https://www.digitaldowsing.com/diy/scanning-radio-part-2/">Scanning Radio AKA Ghost Box &#8211; Installment 2</a> appeared first on <a href="https://www.digitaldowsing.com">Digital Dowsing</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Scanning Radio AKA Ghost Box &#8211; Installment 1</title>
		<link>https://www.digitaldowsing.com/diy/scanning-radio/</link>
		
		<dc:creator><![CDATA[Bill]]></dc:creator>
		<pubDate>Sun, 16 Jan 2022 23:58:00 +0000</pubDate>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[BB&B]]></category>
		<category><![CDATA[BreadBoardsAndBill]]></category>
		<category><![CDATA[ghost box]]></category>
		<category><![CDATA[ghostbox]]></category>
		<category><![CDATA[scanning radio]]></category>
		<guid isPermaLink="false">https://www.digitaldowsing.com/?p=34034</guid>

					<description><![CDATA[<p>Installment 1 of the DIY scanning radio project. Part of the Bread Boards and Bill series. </p>
<p>The post <a href="https://www.digitaldowsing.com/diy/scanning-radio/">Scanning Radio AKA Ghost Box &#8211; Installment 1</a> appeared first on <a href="https://www.digitaldowsing.com">Digital Dowsing</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>Project Overview</strong></h2>



<p>This is a DIY Scanning Radio Ghost Box using an Arduino Uno. Launched on Twitter as part of the Bread Boards &amp; Bill series. </p>



<p>This is the first installment of a multi part project where we will continue to add features on to the base that this installment establishes.</p>



<h2 class="wp-block-heading">Reference</h2>



<p><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/BBB-GB-Ch1.pdf" target="_blank" rel="noreferrer noopener">PDF</a> Version of this guide with additional pictures:</p>



<div data-wp-interactive="" class="wp-block-file"><object data-wp-bind--hidden="!selectors.core.file.hasPdfPreview" hidden class="wp-block-file__embed" data="https://www.digitaldowsing.com/wp-content/uploads/2022/01/BBB-GB-Ch1.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of Embed of Scanning Radio DIY Project Installment 1 from Bread Boards &amp; Bill Series.."></object><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/BBB-GB-Ch1.pdf">Scanning Radio DIY Project Installment 1 from Bread Boards &#038; Bill Series</a><a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/BBB-GB-Ch1.pdf" class="wp-block-file__button" download>Download</a></div>



<p><a href="https://www.youtube.com/watch?v=9nAuH6UZbFg" target="_blank" rel="noreferrer noopener">Video</a> of this guide on YouTube</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<div class='avia-iframe-wrap'><iframe title="BBB ghostbox p1" width="1500" height="844" src="https://www.youtube.com/embed/9nAuH6UZbFg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div></figure>



<h2 class="wp-block-heading">Materials / Tools Needed</h2>



<ol><li><a href="https://www.amazon.com/dp/B08975R9PP?psc=1&amp;ref=ppx_yo2_dt_b_product_details" target="_blank" rel="noreferrer noopener">Arduino Uno</a></li><li><a href="https://www.amazon.com/dp/B07L74WYRX?psc=1&amp;ref=ppx_yo2_dt_b_product_details">Arduino Radio Module</a></li><li><a href="https://www.amazon.com/dp/B01EV70C78?psc=1&amp;ref=ppx_yo2_dt_b_product_details" target="_blank" rel="noreferrer noopener">Hook Up Wire</a></li></ol>



<h2 class="wp-block-heading">Software</h2>



<ol><li>Go to the <a href="https://www.arduino.cc/en/software" target="_blank" rel="noreferrer noopener">Arduino Software page</a></li><li>Choose the IDE based on the type of computer it will run on</li><li>Download and start</li><li>From the <em>Tools</em> menu select <em>Library Manager</em> </li><li>In Library Manager Search Bar type in <strong>TEA5767</strong></li><li>Select <strong>ArduinoTEA5767</strong> and Install</li><li>From File Menu select <em>Examples</em></li><li>Choose <strong>ArduinoTEA5767</strong> File <strong>SimpleFixedFrequency</strong> </li></ol>



<h2 class="wp-block-heading">Hardware</h2>



<ol><li>Connect BLACK wire from Arduino UNO GND to Radio Module GND</li><li>Connect RED wire from Arduino UNO 3.3v  to  Radio Module 5v ** Radio Module can run on 3.3v</li><li>Connect ORANGE wire from Arduino UNO SLC to Radio Module  SLC</li><li>Connect YELLOW wire form Arduino UNO SDA to Radio Module SDA</li><li>Install radio antenna , plug in earphone or speaker</li><li>Plug in USB cable to Arduino UNO</li><li>Double check wiring</li><li>Plug in USB cable to computer, Arduino UNO should power on.</li></ol>



<h2 class="wp-block-heading">Testing</h2>



<ol><li>With the example file <strong>SimpleFixedFrequency</strong> loaded </li><li>Select <em>Verify/Compile</em> from Sketch </li><li>Verify Successful compile</li><li>From Sketch select <em>Upload</em></li><li>Verify Program was uploaded to the Arduino UNO</li><li>Modify this line to change the selected frequency <code>radio.setFrequency(93.0); // 93.0 FM IE:radio.setFrequency(107.5); // 107.5 FM</code></li><li>Re-compile and reload then verify the frequency is set to the new station using headphones or a speaker</li></ol>



<h2 class="wp-block-heading">Troubleshooting</h2>



<ul><li><strong>Issue</strong>: Software won&#8217;t compile</li><li><strong>Resolution</strong>: Make sure the Library <strong>ARDUIOTEA5767</strong> was installed in the Library manager</li></ul>



<h2 class="wp-block-heading">Looking Ahead To Installment 2</h2>



<ol><li>Load scanning software </li><li>Discuss Band Allocation of the FM band US</li><li>Discuss how to change scan rate and scan distance </li><li>View the <a href="https://www.digitaldowsing.com/wp-content/uploads/2022/01/BBB-GB-Ch1.pdf" target="_blank" rel="noreferrer noopener">Complete PDF of this first installment</a></li><li>** For those who can&#8217;t wait copy the code below and paste it in your Arduino IDE , replace the original Simple Fixed Frequency </li><li>Compile and upload to your UNO, It will now scan from 88 &#8211; 108 FM the Step is in increments of .1 Mhz</li></ol>



<pre class="wp-block-code"><code>// TEA5767 Example by Simon Monk
// Scanning code part of the open ghostbox project 

#include &lt;Wire.h&gt;                             // SLC SDA communications for radio module
#include &lt;TEA5767Radio.h&gt;                     // Radio library tells the arduino how to interface the radio module
TEA5767Radio radio = TEA5767Radio();          // Define radio model

void setup()                                  // setup files
{
  Wire.begin();                               // start IC2 communications
}

void loop()
{

  for ( float r = 88.00; r &lt;= 108.00;r = r+.1)  // loop and scan from 88 to 108 stepping .1 mhz
  {
    radio.setFrequency(r);                      // Set radio to new frequency
    delay(200);                                 // wait here for .2 seconds
  }
}</code></pre>



<p>These are the lines you can modify to control scan, scan increment and scan rate.</p>



<pre class="wp-block-code"><code>
  for ( float r = 88.00; r &lt;= 108.00;r = r+.1)  // loop and scan from 88 to 108 stepping .1 mhz
  // this line controls the scan distance 88.00 , 108.00 
  
  delay(200);   
 // change the delay to increase of decrease the time between channels "Scan Rate"  

</code></pre>
<p>The post <a href="https://www.digitaldowsing.com/diy/scanning-radio/">Scanning Radio AKA Ghost Box &#8211; Installment 1</a> appeared first on <a href="https://www.digitaldowsing.com">Digital Dowsing</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
