TR-505 – A Better Mod for Individual Outputs

Descriptions of Individual Audio Outputs modifications for the Roland TR-505 have been around for a while. I searched the web for sources that describe how to do the mod:

There are many other sources that talk about having it made, but don’t explain how it’s done:

The problem

However, the modifications that are described share one problem: They don’t handle Cymbals and Open HiHat very well. That is because the signal is tapped too early in the output summing circuitry, before the volume envelope is applied. Citing circuit benders’ description of their mod:

“Longer sounds such as the crash and hats consist of a compressed sample, with a primitive envelope applied to it so it sounds vaguely realistic. As the outputs have to be sourced in the circuit before the envelope is applied, some sounds will not be identical to the main mix outputs.”

Image from masutopedals.wordpress.com/

What to do?

To sort it out, you need to tap audio from (LT MT HT TB) (CC RC) and (CH OH) after transistors Q6, Q7 and Q8 respectively, because the transistors apply the volume envelope to the audio signals. However the signal can’t be taken directly from the emitter of the transistor, because it’s is very weak at this point, and you will introduce noise, hum and instability. Instead, we take it after the buffers / amplifiers IC16 and IC15 respectively.

Red shows the standard 505 mods, green shows my modification spots

You will use the standard mod spots for (HCP RIM) (LCB HCB) (SD) (LCG HCG) and (BD), and the green ones for (LT MT HT TB) (CC RC) and (CH OH). I used breaking 3.5 mm jacks, so the sound is removed from the R / L mix when a cable is inserted in the individual output jack.

What you lose

You are going to lose the predefined, fixed panning that some of the sounds in the TR-505 have. But you will have all sounds on individual mixer channels to pan, equalize and add effects.

Also, the volume levels of the individual outputs may not be the same as on the R / L outs.

Rhodes Chroma

  • Initial problem: Some of the voices don’t tune correctly
  • PSU was changed by another synth tech
  • Now there’s a constant white noise and nothing else

Presets can be selected and edited, but mostly only white noise is produced. Sometimes after a restart, you can actually hear the patch behind the noise.

Temporary notes:

  • Some voice boards: Oscs not in tune
  • Voice board 2: The source of the noise. This board also makes all the other voice boards fail the initialization procedure, when it’s connected.

Roland CR-8000 Mod

This drum machine from 1981 is a close relative of Roland CR-78 and TR-808. It has a couple shortcomings, such as no user editable sounds, a Snare Drum with a lot of tone (what is called “Snappy” on 808) but a lack of noise / high frequency content. It sounds like a tom. Also the Hand Clap is low volume, at least on this specimen.

This CR-8000 was modified for individual audio outputs for each instrument group, a louder Hand Clap, as well as couple of potentiometers for Bass Drum and Snare Drum tuning. The BD now has two controls: Pitch and Decay, the SD has two controls: Pitch of the “snappy” portion, and Noise level.



The BD and Clap modifications are taken directly from gumielectronic. The exact changes with component values are listed further down in this article.

When servicing or modifing synths I try to conform to the part of Hippocrates’ oath that states “First, do no harm”. Therefore I made a break-out box, instead of drilling holes in the CR-8000 exterior. Also I left the original parts in place where possible, should someone want to reverse this mod in the future.

The break-out box sticks to the metal back plate of  the CR-8000 with neodyne magnets. The wires are directed through existing vent holes in the back.

The following list is an excerpt from gumielectronics’ extensive CR-8000 modifications. The red markings are the ones I chose to use (since there was a limited space on the break-out box) along with my component selections. The Snare Drum are my own changes, as some of the suggested changes didn’t make that much diggerence. C47 is Snappy Pitch, the changes after Q7 is the SD Noise portion boost.

Snare Drum specifics. The original SD sound isn’t available as it is now, it has a bit more noise content.

Here are a couple of images of the PCB and break-out box internals:

Bass Drum (green wire and some resistors) and Snare Drum Snappy (yellow wire bridging R34):

Snare Drum Noise Boost (red wires) and Snappy pitch (blue wires):

Individual outputs:

Tidying up a bit:


Caveats

Individual Outputs: The CR-8000 was not designed to have separate outs to begin with. Some things are not ideal because of this. The Clap for example, is a lot lower at the individual output than it is in the main mix. Also the accent effects are not applied to the individual outs, so in some cases the Main out instruments will sound beefier than the indy versions.

BD Decay: The Bass Drum will not have the oomph of the TR-808, maybe because of a shorter trig pulse, or some other envelope characteristic that is different.

SD Decay: Decay of the Snare Drum is hard to modify, unlike the Bass Drum. The mod point called “decay” in gumi’s description doesn’t change the overall decay of the instrument, only the length of the Snappy portion within the (very short) total length of the Snare Drum, and this change is hard to hear to be honest. I think it would take a longer trig pulse to make the Snare longer, but I haven’t tested this idea.

Conclusion

Nevertheless, I believe the changes described here are a significant improvement to the CR-8000.

 

Toaster with web server

Arduino files download: Sonoff_toaster_timer

This is really not a toaster with a web server, but a toaster that is controlled by a Sonoff Wifi switch, that is running a web server. There were two objectives with this project:

  • To be able to continue using my toaster that had a mechanical problem: It didn’t release the bread when time was up – Instead it continued toasting for ever. This is my second toaster of the same type that breaks. It’s obviously not reliable, but it does take long slices of bread
  • To be able to sequence the toasting like this: Toast-Pause-Toast-Stop. I had previously noticed that the toast quality was increased significantly when I did this manually – The slices didn’t get dry on the outside and wet on the inside. The pause is 30s long, to allow water to steam off of the bread before the last half minute of heat is applied

There are several reasons that I couldn’t use the Sonoff power switch and its control app EWeLink as it is:

  • It doesn’t work without Internet
  • Cloud server issues: Sonoff connects to an online web server to store settings and keep track of time etc. When I bought my 4 Sonoffs they couldn’t connect to the server because it was overloaded (?) and if they finally connected, their behavior was generally unreliable. It went on like that for a week, then I uninstalled the EWeLink app and threw the switches in a drawer for half a year
  • The timing was too inexact. If I recall correctly, the finest resolution is 1 minute
  • Way too limited scheduling: It was not possible to make an On-Off sequence. I wanted something like: On (2min), Off (30s), On (30s), Off. The only option in EWeLink was to turn On or Off at a certain time of the day
  • What happens if the Internet connection breaks while some appliance is on

 The project, Sonoff controlled by a local web page

The Sonoff contains an ESP8266 processor that does most of the work. Most importantly it has Wifi capabilities, which is why it’s used in many “Internet of Things”-applications. It’s possible to run a web server on the ESP8266, and have the user interface on a web page control the ESP8266 program. So in my case it serves a HTML / Javascript page with five buttons and a simple progress bar. The buttons select one of three “Toast Sequence Programs”, a “One-Shot 30s Toast Program” or the “Immediate Stop”. The shortest toast program is for white bread that is a bit dry, the longest is for dark bread that is frozen.

The Stop button doesn’t fit on my medieval iPhone 5 screen

New firmware, Arduino, randomnerdtutorials.com

To upload firmware to the ESP8266. I used Arduino IDE 1.8.1 and a USB-Serial TTL converter. I followed these instructions for wiring: https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/

Sorry, the power cord just popped off

There was also info on what libraries needed to be installed, how to set up an ESP web server, connect to Wifi and more. A good place to get started.

Maybe not randomnerdtutorials, after all

I soon realized that the code on randomnerdtutorials would be dangerous for this project. It works something like this: When you click a button on the web page, a new page is loaded. Appended to the URL is the name of the button that you clicked. This is a common way to pass data between html pages. The problem is that when the toast program is finished, it’s quite possible that you still have this page (with the button name) loaded in your web browser. Which means that if you reload the page (which can happen automatically in many situations, ie on a computer restart) the toaster will start again.

AJAX, circuits4you.com

Then I found this page: https://circuits4you.com/2018/02/04/esp8266-ajax-update-part-of-web-page-without-refreshing/ that demonstrates using AJAX XMLHttpRequest techniques to do calls without reloading the page. It was a better fit for my needs in many ways:

  • URL doesn’t change when you click a button
  • During development, the HTML code is kept in a well-formatted separate header file. When uploaded to ESP, the HTML is stored in Flash memory using the Arduino Flash memory routines. When the program runs, the HTML is read in to RAM when needed. Many examples online that do this use the SPIFF file system instead of Arduino Flash memory routines. SPIFF requires separate manual uploads from the computer to the ESP. I didn’t want to learn that in this project, I already had too many things that could go wrong
  • CSS styles in the header – I knew I didn’t want to download online (Bootstrap or similar) CSS definitions to my ESP at runtime. Because then it will fail if there’s no Internet connection. One of the reasons to do this project to begin with, was to make it suffice with a local network

The circuits4you code is a bit hard to understand, partly because there are about 10 different variables and handlers with similar names, partly because of the involved parallel code structures in HTML, Javascript and C. That’s why people hate web development. Also there were some small errors in the code :) Anyone who has done some HTML can probably spot this one:

server.send(200,”text/plane”, ledState); //Send web page

It’s not like we’re going to send an airplane to the web server. Also, data stored in Flash memory can’t be read into a C String variable like this:

String s = MAIN_page; //Read HTML contents

I changed it to:

String s = FPSTR(MAIN_page);   //Read HTML contents

Here’s the finished ESP8266 code, which is actually an Arduino sketch. It could be optimized a bit, and the States and Steps could be better clarified but still

And here’s the code for the HTML page. It needs to sit in a file called index_html.h next to the main sketch file

Toasting

Upper Left is the Sonoff. The Green Led shows the state: On for Toast, Flashing green for Pause


Helpful links

Reprogram Sonoff Smart Switch with Web Server
https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/

ESP8266 ajax – update part of web page without refreshing
https://circuits4you.com/2018/02/04/esp8266-ajax-update-part-of-web-page-without-refreshing/

ESP8266 Timer / ticker examples
https://circuits4you.com/2018/01/02/esp8266-timer-ticker-example/

Doepfer MCV4 Mod for Roland SH5


It seems Doepfer cut some corners when designing the MCV4 MIDI to CV interface. Firstly the MCV4’s gate voltage is to low to drive the Roland SH5 gate input. This can be remedied by opening up the interface to move a jumper, and then replacing the 9v power supply with a 12 volt one. After that the MCV4 controlled the SH5 gate and Pitch CV as expected. But it had no effect on the filter at all. That is because the output from the DAC isn’t buffered, and the DAC itself cannot drive the load of the Filter CV input. An MCP6002 OpAmp was connected as a basic voltage follower to buffer the Note Velocity output.

Beware that the image shows an unsuccessful experiment with a TL072, that has a different pin configuration.

Don’t use this image as a guide for connecting the MCP6002!

Kawai R-100 MIDI-Controlled Mod

A mid-80’s drum machine, modified for MIDI-controlled sound chip selection, circuit bending and pitch. Any MIDI sequencer or keyboard can be used. No changes are made to the exterior of the machine.

The Kawai R-100 drum machine classic was modified using an Arduino Nano, the circuitbenders.co.uk “R-ROM Switcher” and a HC-SR08 board. The Nano reads incoming note data on MIDI channel 2 to control the HC-SR08 and ROM Switcher board. Incoming MIDI data can

  • Control the playback pitch of the entire machine
  • Select sound ROM chip
  • Control a couple of the circuitbend connection points

The pitch mod: The HC-SR08 is a development board for the Analog Devices AD9850 Direct Digital Synthesis chip. The output DDS frequency is controlled by The Nano, reading MIDI notes and pitch bend. The output square wave is used as a clock signal for the R-100’s Address Generation Unit. This means that when the Kawai R-100 tries to play any sound, the rate at which the sound sample data bytes are found in memory is set by the 9850 output.

Actually this can be done without the HC-SR08, only using a pwm output on the Nano. This is how I originally tested the idea. But while this would work fine for very low pitches, the closer you’d get to the R-100’s original pitch, the less pitch resolution you would get. Since I wanted to be able to play it in a resolution of semi-tones (or even cents, using pitch bend) I had to use a higher resolution clock generator :)

The circuit bend: There are pre-made circuit bend points in the ROM Switcher pcb. It’s sufficient to have the Nano connecting these points to ground, they don’t need to be interconnected. To get back to non-circuit bent sound, the Nano pins are left in a floating state. The sound quality of the bends are much like a comb filter or phaser.

The ROM chip selection: To enable one ROM chip, the original ROM-Switcher connects the Output Enable (or possibly Chip Enable) pin of that chip to ground. Others are in HIGH state. A very simple task for a microcontroller.

Instruments for exhibition – Control Surface

Two unusual electronic instruments that were part of a greater ensemble, built for an exhibition in China. Idea and hardware by Daniel Araya. Programming and I/O-electronics by 9bit.

The MIDI Control Surface

The Control Surface is a Standard MIDI Interface compliant unit, built to interface with a MAX MSP patch on a host computer. The Control Surface has about 40 faders, knobs, switches, touch controls and a status LED that is controlled from within MAX MSP.

Testing the first of the eight really nice capacitive touch controls

This is testing MUXes and SPI port expansions on a CNC-made prototype PCB. MIDI on the Arduino Uno was only implemented as “MIDI over USB”, since it was not to be connected directly to other MIDI-capable instruments, only to a computer running host software.

Boxing it…

Instruments for exhibition – Metronomes

Two unusual electronic instruments that were part of a greater ensemble, built for an exhibition in China. Idea and hardware by Daniel Araya. Programming and I/O-electronics by 9bit.

The Metronomes

Three metronomes were built, one master and two slaves. The tempos of the slave units are synced to the master but the beat patterns that they play differ. The pattern generation algorithms used are mostly Euclidean Polyrhythms of varying lengths and “densities”. Thank’s to Wouter Hisschemöller’s page for cutting my firmware dev time.

The master unit features a tempo knob, sync-to-slave output, metronome beep, metronome light flash, DMX output.

The slave units feature a pattern length knob, pattern density knob, sync-to-master input, metronome beep, metronome light flash, DMX output.

Analyzing a DMX signal

DMX sync test

Wrapping it up

Avrdude – Burn fuses (16 MHz clock out on CLK0 / B0)

Reason

Fuses. There are a couple of user selectable operation modes of the AVR microcontrollers. The fuses can’t be edited in the same way you normally program you Arduino. You will need a hardware AVR programmer, ie the one described here: Arduino as ISP. There are a few GUI softwares that are supposed to do this, but I couldn’t get any of the Mac OS X ones to connect to my Arduino/Genuino Uno, so I used AvrDude from the Terminal.

I wanted to do this in order to get a 16 MHz clock output on the Arduino Digital pin 8 / B0 / CLK0. This signal was to be used as a Reference Clock for the AV9110 Serially Programmable Frequency Generator.

 

Parts list

• AVR Programmer
• Arduino Uno
• AvrDude software

 

Setting (aka Programming) the fuses

Step 1, find out the new fuse settings
Use this site to get the hex numbers for your new fuse settings: http://www.engbedded.com/fusecalc (If you don’t understand the contents of this site you need to read your AVR docs, search the web, or ask yourself if you really need to change any fuses.)

Step 2, burn the fuses with AvrDude

In your shell, type avrdude. (If it says unknown command or similar, you need to CD to the directory where AvrDude is on your Mac.) If it presents a list of AvrDude parameters you’re good to go. This command changes the CKOUT fuse so the system clock is output on B0:

The above settings can be gathered from the output of the Arduino IDE when uploading a sketch to your Arduino. Please turn on “Verbose Output when uploading”.

These are the new fuse settings from http://www.engbedded.com/fusecalc. I was mainly interested in CKOUT = true. Setting the fuses wrongly can make your Arduino unresponsive. Please read up on which fuses NOT to change, prior to experimentation.

Analog Joystick

Connect an analog joystick to an Arduino. Read two analog values (x- and y-position) and a switch using a method witch does not hog the processor during the whole ADConversion.

The capacitor reduces digital noise on the analog readings.
Joystick

Code

Avrdude – Upload hex file to Arduino using ISP / ICSP

Reason

In some cases USB cannot be used to program (upload hex file to) a processor on an Arduino board. One such case is when you are targeting the second processor on an Arduino Uno, the ATMega16u2 whose sole purpose is to cater for USB communication.

Another case arises after we succeeded in reprogramming the USB chip. Since it will become a MIDI communication chip instead, there will be no more USB connectivity, so the main processor (ATMega328p) will also have to be programmed with ISP.

 

Parts list

• Arduino IDE (I used arduino.cc 1.6.7 but any fairly modern will do)
• 2x Arduino Uno R3 (one programmer and one target)
• Hacked ICSP flat cable
• 3x LED / 3x 1k resistors (optional)

More info on the ICSP cable and connections at Nick Gammon’s

 

Using an Arduino board as ISP

Step 1, create an ISP programmer
Locate the ArduinoISP example sketch in the Arduino IDE. Upload it to the Arduino board that is to become the programmer. (The programmer board doesn’t necessarily have to be an Uno.)

Step 2, connect the boards
To upload a hex file to the USB-chip (m16u2 aka ATMega 16u2) on an Arduino Uno, you need to connect the programmer’s ICSP header to the target board’s second ICSP header. (If there is only one 6-pin ICSP-header, you have to get a more expensive target board.)

Step 3, upload hex file

 

Shell command

Uploading a pre-compiled hex file to the m16u2 USB controller on an Arduino Uno R3 board, using avrdude and an “Arduino as ISP”-programmer to target the m16u2.

Example

Using Terminal on Mac OS X
Uploading Hiduino midi firmware
from the folder “jobb/EMS/”
Using the “avrdude” that comes bundled with Arduino IDE
The serial port of the “Arduino as ISP”-programmer is /dev/cu.wchusbserial410

The hard part is to get the paths right. To get some hints, go to the Arduino IDE preferences and turn on “Show verbose output during -> Upload”. Then upload a sketch to an Arduino, and examine the log output.

After uploading the firmware I connected the target board to the computer with a USB cable and had a look in System Report:

Hiduino_in_system_report

Digital Etch-A-Sketch by Mattias Green

A simple but effective project to demonstrate physical control over a computer screen.

  1. Connect two potentiometers to Arduino analog inputs A0 and A1
  2. Use serial-communications to get pot values from Arduino to Processing
  3. Make a Processing sketch that accepts the serial data and draws lines

 Arduino Code

Please take a moment to think about how the variable values will be presented to Processing. You cannot just Serial.println(var1); Serial.println(var2); If you’d do that, there would be no way for processing to know which value comes from which variable. To help parsing the data in Processing, print the values on the same line, separated by a comma.

Now, processing will se your two values like this: 233,856 and they will be considered a text String, not numeric values. (233 would be the value at Arduino pin A0 and 856 at A1.) You can easily convert such a string of words delimited by commas into an array of words.  Use  split(str,delimiter) in Processing. “233,856” will be converted to [“233”, “856”] and each item can be accessed individually, and treated as a numeric value.

Processing Code

 

Proof of Concept ;)

(Does not work in Firefox for some WordPress-related reason)

 

Week 7 2015 Forsbergs Arduino Course

Four days of electronics and programming

You know you love it. The course contents were essentially the same as this course, and followed the posts on this site.

We also found a few errors in the posts, so I had an opportunity to correct them. Thank you Forsbergs Design 2 2014-2015 for beta testing ;)

Some of the students connected Processing IDE (on the Mac) to an Arduino using the serial-communications. Thus, the Arduino became an interface to Processing’s on-screen drawing tools. For an example, see this student project by Mattias Green.

A distant colleague of mine happened to have an Arduino course at the same time. They also connected Arduino to Processing, to enable physical control over audio sample playback on the computer.

Week 50 2014 Forsbergs Arduino Course

A one-week crash-course

…in electronics and programming. This is the kit we used for the course:

1602 LCD Servo Dot Matrix Breadboard LED Resistor UNO R3 Starter Kit for Arduino (eBay)

We did not use most of the advanced stuff in it. I also added a couple of components:

  • One solenoid: 12 volts, the strongest and longest slew I could find for a reasonable price (eBay)
  • One transistor: TIP120 60V / 5A (electrokit)
  • One high power diode: 1N4001, 50V / 1A (electrokit)
  • One power adapter 12V / 5A (eBay)

A few other things need to be added, for example a couple of decoupling capacitors, 0.1µF and 10µF, and maybe a fat electrolyte for smoothing out effects of sudden power draws.

Original kit contents:
1 x UNO R3 Mainboard
1 x USB Cable (30cm HIGH QUALITY,color could be blue or black,base on stock type)
1 x Extension Board with mini breadboard
1 x 830 Contact Points Breadboard
1 x 5mm LED Assorted Kit (Red/Green/Yellow 10pcs each + White 5pcs + RGB Trip-color 1Piece)
1 x 8bit Shift Register 74hc595
1 x MAX7219 Chip
2 x Buzzer 5v (1 active and 1 passive)
1 x Eight-segment Display (1-digit Common Anode)
1 x Eight-segment Display (4-digit Common Anode) with clock
10 x Push Button Switch 12*12mm
5 x Mini Push Button Switches 6*6mm
1 x Light Dependent Resistor (photocell)
20 x 10KΩ Resistor
20 x 220Ω Resistor
5 x 1kΩ Resistor
1 x 5k Trimpot Adjustable Resistor Potentiometer
1 x 10k Trimpot Adjustable Resistor Potentionmeter
1 x LM35 Temperature Sensor
1 x 1602 LCD Display
1 x PS2 Joystick Module
1 x Stepping Motor 5v
1 x Stepping Motor Driver Board
1 x SG90 Servo Motor
1 x RGB Module
65 x Jumper Wires
10 x Dupont Lines(Female to Female)
1 x 2.54mm Straight 40 Pin Header
1 x 2.54mm Elbow 40 Pin Header
1 x Mercury Switches
1 x Flame Sensor
1 x Infrared Sender
1 x Infrared Receiver
1 x Remote Controler (Battery- CR2025 Not Included)
1 x 8*8 Dot Matrix Display
1 x 5v 10A Relay Module with optocouple
1 x DC 9v Battery Button Cable (Battery-9V Not Included)


Additional info

SainSmart UNO R3 – Arduino Forum Lessons for a similar kit. The advanced lessons are not covered in this blog yet.

MAX7219 LED driver and 12088 8×8 LED matrix

The 8×8 LED matrix is 64 LEDs arranged in an 8 row, 8 column matrix, just like a chess board.

The Max7219 is used to control 64 LEDs at once. The Arduino sends data to the 7219 using the SPI serial communication protocol. You can have multiple SPI devices connected to an Arduino simultaneously.

For your convenience, the Arduino uses a library to talk to the LED driver. The library takes care of the SPI communication and may also have methods for writing characters or scrolling images. There are a number of Arduino libraries for MAX7219. I happened to chose LedControl.

Download the latest version of LedControl here (I used v1.0.1): https://github.com/wayoda/LedControl/releases

In-depth about the LedControl library, and a bit about the hardware. You don’t have to read it to follow the instructions in this article, but I scavenged a lot of info here: http://playground.arduino.cc/Main/LedControl

The hard part is to figure out the pin configuration of the 12088A/B LED matrix, and how to connect it to the 7219. So here are some images to help you out.

MAX7219 and 12088 LED-matrix

 

MAX7219->LED8x8_12088_02

 

IMG_7156_8x8_LED_matrix_01

Light sensor, LDR

The light sensor is also called a light-dependent resistor (LDR) or photocell. It is connected to Arduino pin A0. analogRead measures the voltage at the pin. You will get a value between 0 and 1023 (where 0 equals ground and 1023 equals +5 volts).

Changing the type of lamps and ambient light will give a bit of variation in your readings. In many cases a covered sensor equals about 500 and an exposed sensor is around 800. So under those circumstances an ON / OFF threshold-value of about 700 would be fine.

 

 

Light sensor


 

 

Code

Read a pot, control 5 LEDs

The pot controls which LED is turned on. The pot is connected to Arduino pin A0. analogRead is used to measure the voltage at A0.

You will get a value between 0 and 1023 (where 0 equals ground and 1023 equals +5 volts).  The analog range is divided into 5 sections (1023 / 5).

Five LEDs are connected to the digital pins 2, 3, 4, 7 and 8. Use a switch statement to address individual pins depending on pot rotation.

Use a small delay to let the circuitry rest before doing the subsequent read, or the value can be erroneous.

Connect a Potentiometer

 

5 LEDs to individual pins

Code

Read a pot, print to Serial Monitor

The USB connection is used for serial communication between Arduino and computer.

The potentiometer pin 2 is connected to Arduino pin A0. analogRead is then used to measure the voltage at the pin. (The potentiometer rating doesn’t matter, but avoid lower resistances than 5k, so you don’t get an uneconomically high current flow.) You will get a value between 0 and 1023 (where 0 equals ground and 1023 equals +5 volts).

Use a small delay to let the circuitry rest before doing the subsequent read, or the value can be erroneous.

Code

12 volt Solenoid or Motor

Use a 12 volt solenoid or motor. Connect a 12 volt power adapter to the Arduino board. On the board there is a pin called Vin that will provide the 12 volts directly from the power adapter. Use Vin to power the solenoid / motor.

There will be a lot of current flowing through the solenoid. If the flow keeps on too long, the solenoid will get very hot. The on-time will probably needs to be shorter than a second.

The term duty cycle means the relation between on-time and off-time. Generally the duty cycle has to be less than 50% if the solenoid shall be turned on and off repeatedly.

Solenoid

IMG_7142_solenoid_01

Code