High Voltage and X-Ray Experiments

By Henning Umland

http://www.celnav.de/hv/hvindex.htm

“If, for example, the capacitance of C were 1000 μF, a charge of 1 mAs would result in a voltage of 1 V, independent of any current fluctuations (the capacitor voltage varies in proportion with the charge). I use two paper/oil capacitors with a total capacity of approx. 1500 μF. Thus, a capacitor voltage of 1 V is equivalent to a charge of 1.5 mAs. The time constant resulting from C and the internal resistance of the vacuum tube volt meter, VTVM (Ri = 11 MΩ), is 16500 seconds. Therefore, the capacitor voltage remains virtually constant for some time after the anode current stops flowing. Electrolytic capacitors are not suitable for such a circuit because of their relatively high and unpredictable leak current…”

From “Building a Simple X-Ray Machine”

 

Arduino electric eye and musical stairs

Summary of experiments with IR beam detection.

Initial testing with Radio Shack sensors and IRremote library: https://reactivemusic.net/?p=4027

musical stairs project

Built by students at Gould Academy, Bethel, Maine 2013.

Detects movement on stairs using individual IR sensor pairs on each step. When an IR beam is broken, a note is triggered and status LED lights up. Using an Ethernet shield, the data is tracked in a feed at xively.com

materials

Adafruit IR emitters and receivers

https://www.adafruit.com/products/157

https://www.adafruit.com/product/388

construction of sensor units

IR transmitters and receivers wired into terminal strips (no soldering):

transmitting unit:

schematic:

receiving unit:

schematic:

layout of stairs

Arduino connections and code

code:

[wpdm_file id=19]

(local file: musicalStairsVersion3tz2)

notes

Pd signal streaming objects

Use streamout~ and streamin~ to stream audio over a local network

The ‘help file’ for streamout~ has an example. Change ‘localhost’ in the connect message to the local IP address of the target.

AM audio transmitter using Arduino

Transmit AM audio on 727 KHz. using a voltage divider and an Arduino.

By Markus Gritsch

Note: with the actual circuit the signal is closer to 760 KHz.

Samples incoming audio at 34 KHz. and rebroadcasts as RF using the Arduino clock.

This is a simplification of Markus’ original circuit. It eliminates the tuned output circuit. Probably at the expense of increased harmonic distortion.

The voltage divider is uses 2 47K Ohm resistors and a 1 uF electrolytic capacitor. It is the input half of the original circuit.

http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=2892#p28410

(I substituted 2 100 K Ohm resistors in parallel for each of the 47 K’s.)

A voltage divider is useful as a general purpose coupler, for sampling analog signals using  Arduino PWM input.

The Arduino sketch is Markus’ original – reprinted here:

(note) Local file is AM_audio_transmitter.

// Simple AM Radio Signal Generator :: Markus Gritsch
// http://www.youtube.com/watch?v=y1EKyQrFJ−o
//
// /|\ +5V ANT
// | \ | /
// | −−−−−−−−−−−−−−−− \|/
// | | R1 | Arduino 16 MHz | C2 |
// | | 47k | | || | about
// audio C1 | | | TIMER_PIN >−−−−−||−−−−−+ 40Vpp
 // input || | | | || |
 // o−−−−−||−−−−−+−−−−−−−> INPUT_PIN | 1nF |
 // +|| | | | )
 // 1uF | | R2 | ATmega328P | ) L1
 // | | 47k −−−−−−−−−−−−−−−− fres = ) 47uH
 // fg < 7 Hz | | 734 kHz )
 // | |
 // | |
 // −−− GND −−− GND
 //
 // fg = 1 / ( 2 * pi * ( R1 || R2 ) * C1 ) < 7 Hz
 // fres = 1 / ( 2 * pi * sqrt( L1 * C2 ) ) = 734 kHz

#define INPUT_PIN 0 // ADC input pin
#define TIMER_PIN 3 // PWM output pin, OC2B (PD3)
#define DEBUG_PIN 2 // to measure the sampling frequency
#define LED_PIN 13 // displays input overdrive

#define SHIFT_BY 3 // 2 ... 7 input attenuator
#define TIMER_TOP 20 // determines the carrier frequency
#define A_MAX TIMER_TOP / 4

void setup() {
pinMode( DEBUG_PIN, OUTPUT );
pinMode( TIMER_PIN, OUTPUT );
pinMode( LED_PIN, OUTPUT );

// set ADC prescaler to 16 to decrease conversion time (0b100)
ADCSRA = ( ADCSRA | _BV( ADPS2 ) ) & ~( _BV( ADPS1 ) | _BV( ADPS0 ) );

// non−inverting; fast PWM with TOP; no prescaling
TCCR2A = 0b10100011; // COM2A1 COM2A0 COM2B1 COM2B0 − − WGM21 WGM20
TCCR2B = 0b00001001; // FOC2A FOC2B − − WGM22 CS22 CS21 CS20

// 16E6 / ( OCR2A + 1 ) = 762 kHz @ TIMER_TOP = 20
OCR2A = TIMER_TOP; // = 727 kHz @ TIMER_TOP = 21
OCR2B = TIMER_TOP / 2; // maximum carrier amplitude at 50% duty cycle
}

void loop() {
// about 34 kHz sampling frequency
digitalWrite( DEBUG_PIN, HIGH );
int8_t value = (analogRead( INPUT_PIN ) >> SHIFT_BY ) - (1 << (9 - SHIFT_BY ));

digitalWrite( DEBUG_PIN, LOW );

// clipping

if( value < -A_MAX) {

  value = -A_MAX;
  digitalWrite( LED_PIN, HIGH );
  } else if ( value > A_MAX ) {
  value = A_MAX;
  digitalWrite( LED_PIN, HIGH );
  } else {
  digitalWrite( LED_PIN, LOW );
  }

OCR2B = A_MAX + value;

}

 

 

 

 

 

FM audio transmitter using NTX2

Transmit FM audio on 434.65 Mhz. by substituting a Radiometrix NTX2  for a crystal oscillator in this circuit:

http://scitoys.com/scitoys/scitoys/radio/am_transmitter.html

Radiometrix: http://www.radiometrix.com/content/ntx2

NTX2 datasheet: http://www.radiometrix.com/files/additional/ntx2nrx2.pdf

On the NTX2, the connections are:

  • 5V to the NTX2 VCC pin 4
  • 5V to the NTX2 EN pin 5
  • GND to the NTX2 GND pin 6
  • Upper lead of audio transformer to the NTX2 TXD pin 7

A voltage divider input coupler will also work. See this post for a simple circuit: https://reactivemusic.net/?p=12263

notes

  • Audio modulation level is very low. This circuit would benefit from a preamp. For example, as in this circuit by Amanda Ghassaei: http://www.instructables.com/id/Arduino-Audio-Input/
  • Connect an antenna wire to NTX2 pin 2 (and 1 for RF ground)
  • The circuit worked with 3.3 volts and would probably be fine with less.
  • Used line out of an iPod touch for an audio source. Volume was up fairly high.
  • You can also receive using AM mode using ‘edge’ detection
  • In the US, you need a ham license to transmit on 434.65 Mhz.

RTTY with Arduino and NTX2

A circuit from the UK High Altitude Balloon sight, that sends RTTY, from Arduino using the Radiometrix NTX2 transmitter on 434.650 Mhz.

http://ukhas.org.uk/guides:linkingarduinotontx2#where_to_buy_the_ntx2

circuit notes

substituted  2 100k resistors in parallel for the 47k connected to TX output in the circuit

RTTY settings

We used rtl-sdr with Max as the receiver, in SSB mode, sending audio via Soundcloud to dl-fldigi to decode the RTTY. The params that worked:

  • 50 baud
  • carrier shift 400-480 hz (varies)
  • 7 bits per char
  • no parity
  • 2 stop bits
  • reverse mode on
audio input monitor in dl-fldigi

Unfortunately there was no way to hear the signal while decoding because dl-fldigi doesn’t feed through the input audio. A workaround is to run  Audacity in the background. In audacity:

  • set input to soundflower,
  • set output to built-in output
  •  press pause
  •  press record – now you should hear the radio.

pwm circuit

An updated version of the system described above.

This circuit features no additional components. Just the NTX2 and Arduino. The voltages are generated using PWM (pulse width modulation).

Described in a 3 part series.

by Anthony Stirk at ava.upuaut.net

http://ava.upuaut.net/?p=617

Example 1 – testing

The first example generates a carrier shift of 310 Hz. It took several minutes for the transmit frequency to stop drifting. The AFC setting in dl-fldigi helps to keep things locked in – as long as their is a constant carrier.

Example 2 – RTTY

Reducing the filter bandwidth to less than 150 Hz helps, due to the narrow carrier shift.

Example 3 – dominoEX MFSK

Requires a 175 ohm resistor for precise timing. Didn’t have one, so I just ran the sketch without decoding. Here’s what it sounds like:

what’s next?
  • decoding RTTY in Max

 

Stock market music in Max

Make music from the motion of stock prices.

This program gathers stock prices into a database. It generates Midi data – mapping price to pitch, and mapping trading volume to velocity and rhythmic density. It uses ancient Web technology: HTML/javascript front-end with a php back-end accessing a mysql database.

Case study: http://zproject.wikispaces.com/stock+market+music

To run this project, you will need a server (preferably linux) with the following capabilities:

  • mysql + phpmyadmin
  • php (and ability to run php over the web)
  • netcat (nc)
  • network access

All of this is pretty standard – so I won’t talk about it here. I am running it on Ubuntu Linux. There are many other ways to get the project working, by using the layout described here.

download

https://github.com/tkzic/internet-sensors

folder: stock-market

files

Max

stock_market_music.maxpat

HTML/javascript web client
  • newstock3.html: (web page interface)
  • selectstock3.js:  (front-end)
php server
  • getstock3.php (back-end server to get quotes and save them to a database)
  • play3.php: (back-end server to retrieve quotes, analyze, and map to Midi sequence to send to Max)
  • udp.php: Osc library
Set execute privileges on php files so they can be run from your web server. (chmod +x)

 

database

The selectstock3.php program harvests stock quote data and stores it in a mysql database.

The database name is:  stocks – table is: quotes

Table structure:

The table is basic flat representation of a stock quote, indexed by the ticker symbol. It contains price, volume, high/low/change, timestamp, etc., For our purposes, the price, volume and timestamp are essentially all we need.

SQL to create the table:

 CREATE  TABLE  `stocks`.`quotes` (  `ticker` varchar( 12  )  NOT  NULL ,
 `price` decimal( 10, 2  )  NOT  NULL ,
 `qtime` datetime NOT  NULL ,
 `pchange` decimal( 10, 2  )  NOT  NULL ,
 `popen` decimal( 10, 2  )  NOT  NULL ,
 `phigh` decimal( 10, 2  )  NOT  NULL ,
 `plow` decimal( 10, 2  )  NOT  NULL ,
 `volume` int( 11  )  NOT  NULL ,
 `ttime` timestamp NOT  NULL  DEFAULT CURRENT_TIMESTAMP ,
 `id` int( 11  )  NOT  NULL  AUTO_INCREMENT ,
 `spare` varchar( 30  )  DEFAULT NULL ,
 UNIQUE  KEY  `id` (  `id`  ) ,
 KEY  `ticker` (  `ticker`  )  ) ENGINE  =  MyISAM  DEFAULT CHARSET  = latin1 COMMENT  =  'stock quote transactions';

creating the database, user, and table

  • Log into  phpmyadmin as root
  • Create a new database called ‘stocks’
  • In privileges, add a user called: ‘webdb1′ with a password of ’34door’ (note you can change the password later)
  • In SQL, copy in the above query to create the ‘stocks’ table

Instructions

Web client

The webpage control program allows you to select stocks by ticker symbol, and get either one quote or get quotes at regular time interval. Each quote is inserted into the stock table for later retrieval and analysis.

 

The web front end is quirky so I will describe it in terms of how you might typically use it:

market is open – and you just want to play music based on current stock prices
  1. Enter the ticker symbols for your stocks
  2. Press ‘tracking’ button – so the quotes get saved
  3. Enter the IP address of the computer running Max
  4. Press the ‘auto’ button in the upper left corner – it will run and play forever
market is closed – or you want to play historical data you have saved
  1. Enter the ticker symbols for your stocks
  2. Enter the IP address of the computer running Max
  3. set start end end dates
  4. Press the ‘play’ button to play once or press ‘loop’ to play continuously (using time interval in seconds)
  5. market is open – you just want to collect stock quote data
  6. Enter the ticker symbols for your stocks
  7. Press the tracking button so quotes will get saved
  8. Press the ‘get quotes’ button to get current quote or press ‘loop’ button (on the same line) to retrieve quotes  continuously every 30 seconds.

Instructions

Max patch

  1. Make sure the IP address is set to the address of your server
  2. Select the Midi port for output
  3. Play a few test notes
  4. Select either ‘one instrument’ mode (piano) or multi instrument mode. Each time you click the multi instrument button it randomly selects a new combination 

notes on stock market data

To look at historical trends, you would need access to historical stock data. To use it as a tool for short term analysis, you would need access to real-time quote data in an API. At the time, both of these cost money.

However, it doesn’t cost money to get recent quotes from Yahoo throughout the day and store them in a database – so that’s the approach I took.

If I were to do this project today, I’d look for a free online source of historical data, in machine-readable form – because the historical data provides the most interesting and organic sounds when converted into music. The instant high speeding trading data would probably make interesting sounds as well, but you still need to pay for the data.

notes on local files