Please point me to some step by step basics to code the PICAXE using Blockly.

hippy

Technical Support
Staff member
All wired, tested, and ready for a Picaxe, ordered May 5th and still not here!:(
Who did you order from ?

If it was direct from the PICAXE store we can check what the status of the order is, when it was dispatched, try to figure out where it is. If that's the case you can email the store with your order number and we will do our best to get it promptly sorted out -

http://www.picaxestore.com/index.php/en_gb/contact-address

I believe the general rule for overseas shipping is 7 days. Things are often delivered quicker than that but I believe 'within 14 days' is what most shippers say to expect. Unfortunately we have no direct control over what happens once an item goes out the door and it's in someone else's hands.
 

Gramps

Senior Member
Thank you, still have not heard back from the United States Post Office.
I emailed picaxe store again this morning and included my order number
 
Last edited:

AllyCat

Senior Member
Hi,

What if we glued one of these little guys to each of the hammers? Would that trigger the pin?
Let's say that it's not the way I would do it. :)

Firstly, the data sheet says: "The analog outputs are ratiometric: that means that 0g measurement output is always at half of the 3.3V output (1.65V), -3g is at 0v and 3g is at 3.3V" which means that the "idle" output state may be an "undefined" (unknown) logic level. I assume that the "hammers" are hand-held, not in a mechanical linkage like a piano?

I suspect that "waving the hammers around in the air" might create 3g signals and actually hitting a string (or anything else) may produce much larger accelerations (subject to the frequency response of the low-pass filter). Also, beware that acceleration is a "vector", i.e. it has not just a "magnitude" but also a "direction" (including a positive/negative sign) so detection (or interpretation anyway) can be quite complex.

Therefore, IMHO you would struggle to detect reliable "string hit" events from a high sensitivity accelerometer (or a mercury "tilt" switch), at least if mounted on a "drumstick" type of hammer. Since your aim is to detect when a string is being hit, personally I'd detect the sound (or at least the vibrations) that it produces! ;)

Cheers, Alan.
 

Gramps

Senior Member
It appears that the metal string pairs are electrically isolated, so a piece of conductive tape on the hammer might work......
A mike pickup seemed the most obvious way to go
 
Last edited:

AllyCat

Senior Member
Hi,

Yes, I'm all for the KISS (Keep It SimpleS) approach. It really depends how "invasive" you're prepared for the solution to be, relative to the normal operation of the instrument.

Cheers, Alan.
 

Gramps

Senior Member
Somebody (Ibenson?) in an earlier post mentioned that getting a picaxe to respond to a sudden sharp tone like a hammer strike is going to be difficult using a microphone. Vibration sensors would work but we would probably need a bunch of them.
 

techElder

Well-known member
I have used reed relays for shock sensors before, but mostly for high-shock sensors.

From what I know about hammers for dulcimers, they are made of some kind of metal so the moment of contact would be detectable somewhere on that hammer. You would know if you've hammered a dulcimer.

Now, you may have to "bias" the reed relay with a small magnet "nearby." Bias in this case means to move the magnet closer and closer to the reed until it pulls in. Then pull the magnet back until the reed just releases. This will make the reed more sensitive to a hammer strike. You'll have to play with this to make it reliable for your situation.

You may find that you can detect a hammer strike on the sound board. I'm not at all sure about that.
 

Gramps

Senior Member
We connected the ohmmeter to a pair of the strings and attempted to short them with a hammer covered with aluminum foil. It appears that the hammer does not strike both strings simultaneously. Taping one wire to the hammer and putting the other lead on the string worked marginally better.
It may be that the meter is just not able to detect such a short switch contact and the micro would do better,
 

lbenson

Senior Member
As it turned out, I received the non-i2c version of this the day before you posted: xl335.jpg
https://www.ebay.com/itm/GY-61-ADXL335-3-Axis-Analog-Output-Accelerometer-Angular-Transducer-3-5V-FA/401534029353

Today I wired it up and scotch-taped it to a pencil. It works reliably reading the "Z" axis with this code:
Code:
' 08accel_xl335 ' accelerometer

#picaxe 08M2 ' 20M2
#terminal 4800

do
  readadc10 C.1,w1 ' read "Z" axis of XL335 accelerometer
  if w1 < 380 then ' acceleration towards a strike
    sertxd(#w1," ")
    pause 200 ' reduce/eliminate double reports
  endif
  pause 5
loop
Typical "resting" ADC value is 480-620. A strike is below 380 (an "air" strike--no string hit--is the same). This might miss some light strikes, so adjustment could be needed.

If you're hitting 5 notes a second (e.g., tempo of 300bpm) the pause within the IF statement would need to be adjusted.

With some more analysis of a stream of READADC10 values, you could probably detect the instant when the hammer goes from maximum acceleration to stopped, if you needed that degree of accuracy.

Note that this is a 3.3V chip, so if used with, for instance, an LCD requiring 4.5V or more, a level shifter would be needed.
 
Last edited:

Gramps

Senior Member
These are much cheaper than the ones I found:cool: Would it work if it was taped near the handle rather than out on the end of the hammer?
 

lbenson

Senior Member
I taped the sensor near the eraser end of an 8" pencil, and held the other end. Acceleration would be considerably less at the non-striking end, but with analysis of the ADC stream every 10mS or so, conditions indicating a strike might be detectable. Then the program threshold number could be adjusted.
 

Gramps

Senior Member
The picaxe store said it appears the micro was lost in the mail and they would resend it.
We also ordered a pair of the accelerometers lbenson experimented with. ://www.ebay.com/itm/GY-61-ADXL3...A/401534029353
 

Gramps

Senior Member
It looks like the accelerometers need positive, ground and a data line.
I wonder if we could make them wireless.:D
 

lbenson

Senior Member
"wireless"

If with picaxe, it would require sensor, 08M2, wireless module, and power source--a lot of baggage.

It may be that a shock sensor on the soundboard would work, or a sound sensor. Maybe even a piezo taped to a central spot, as with a guitar pickup.
 

premelec

Senior Member
Not sure of the accel output - but if you just want to know if there is any action from either connect each to ADC pin through a resistor - if you need to discriminate between the two units that's more difficult... best to use 2 pins then... or external complications of components to show different levels of voltage with different combinations of analog voltages... i also suggest you just try piezo for vibration sense - I have seen piezos with lead blob cemented to them to act as crude accelerometer ;-0
 

hippy

Technical Support
Staff member
I haven't really followed the accelerometer discussion but it may be necessary to look at more than one signal from each stick if one cannot guarantee their orientation, and it doesn't seem likely one could. If attached to the strings it may be possible.

If just wanting to look for peak movements, eg impact, assuming that is this case then you could perhaps diode mix signals together.

A better solution maybe another PICAXE as a man in the middle detecting strikes and signalling those to the master PICAXE. Using an output which toggles rather than produces a pulse per strike can help in not missing strikes, simplifies the synchronisation of the two.
 

lbenson

Senior Member
... if one cannot guarantee their orientation ...
I think the motion is pretty close to a nearly vertical hatchet-chop--I don't think that it would add much to look at other orientations.

Can you diode-mix analog signals without essentially averaging them? It's possible that an average between neutral/no-strike and strike would be detectable, though I found a good bit of variation around neutral/resting with a hand-held pencil.
 

techElder

Well-known member
Can you diode-mix analog signals without essentially averaging them? It's possible that an average between neutral/no-strike and strike would be detectable, though I found a good bit of variation around neutral/resting with a hand-held pencil.
You probably want peak detection through diodes with a slow enough fall time to detect.
 

premelec

Senior Member
I think this is coming down to empiricism - see what works! Try some simple things to start... you could use diodes into small capacitor to ADC pin to catch and stretch peaks - however this situation is unique and best try out some stuff - if OP has scope could take a look with that to see what signals are available... even a microphone capsule on the sticks could do the job...
 

Gramps

Senior Member
Well, the good news is the picaxe starter pack came today! The bad news is it's only a 28 X 1. I thought (that's what thinking will get you) we ordered a 28 X 2.
 

lbenson

Senior Member
It's the opposite of peak detection--minimum detection. In my test, "resting" values were between 480 and 620 and striking action was below 380 trending down to the 200s at times. I got similar reading with a striking action that didn't actually strike anything.

Who sold a 28x1? Didn't know they were any longer available. I don't know what the differences may be for this application--perhaps significant for memory availability.

If you want to re-order, you could try https://phanderson.com/ Prices are good and delivery prompt in my experience.
 

Gramps

Senior Member
That sounds like a good idea to glue a couple microphones on the Hammers. They would certainly give a sudden sound when the hammer hit the string!
Revolution Education LTD sent an AXE001U picaxe 28 x 1 Starter Pack. They informed me that is exactly what we ordered.
 
Last edited:

premelec

Senior Member
I concur with Ibenson that Phanderson will give you fast and low shipping cost service if you want the 28X2 part...
 

Gramps

Senior Member
Thanks to Oldbitcollector, we we got the USB adapter and our picaxe 28-1 to respond to the editor!
Question. Will the 28-2 operate correctly in the 28 pin starter board we got from revolution?
 
Last edited:

Gramps

Senior Member
It appears the 28x1 has 16 usable pins and the 28 x 2 as 20 usable pins. Our LED array requires 17 pins Plus at least one input pin .
So we ordered a 28x2 from Phanderson today.
The education Revolution board came with 3 ribbon connectors. I'm not sure how to use them but it looks like we can solder some pin headers on the bottom of the board that will allow us to plug into a breadboard.
Is that the usual way to proceed?
 

lbenson

Senior Member
So we ordered a 28x2 from Phanderson today.
I know you already have the 28-pin board, but my recommendation would have been to get a 40X2 and breadboard it first, so you'd be sure you had enough spare pins to add whatever controls you decide you want.
 

hippy

Technical Support
Staff member
The education Revolution board came with 3 ribbon connectors. I'm not sure how to use them but it looks like we can solder some pin headers on the bottom of the board that will allow us to plug into a breadboard.
Is that the usual way to proceed?
I am assuming you have an AXE020 board -

http://www.picaxe.com/Hardware/Project-Boards/PICAXE-28-Project-Board

The usual way that would be used is to connect things to the ribbon cables and then connect those to the AXE020.

For prototyping and use on breadboard the normal approach would be to fit the 28X2 chip direct to the breadboard, add the power and reset connections plus decoupling capacitors and a download interface. The AXE029 Breadboard Download Adapter would be recommended for that. Everything would then be wired direct to the breadboard as required.

An AXE202 module may be more appropriate for what you want to do. That can be breadboarded and then moved to a stripboard built circuit for the final product. I haven't checked if it meets your I/O requirements -

http://www.picaxe.com/Hardware/PICAXE-Chips/PICAXE-28X2-Module
 

Gramps

Senior Member
Everything was working fine but now for some strange reason the editor cannot find the hardware.
We rebooted the machine restarted the editor and refreshed the download cable and it still says Hardware not found on com 9, when we attempt to load a program.
 

lbenson

Senior Member
Have you tried the "hard reset"? Power off the picaxe, start the download, power on the picaxe.

Hard reset can be required if your program is doing something which doesn't permit the normal periodic checking for a new download.
 
Top