<div dir="ltr">The modified version of the arduino sketch is included in the .zip in my first email if you want to have a go at it. i haven't changed anything on the pd side. I would rather sacrifice duty cycle resolution and be able to control 64 solenoids, than making the entire message longer and slowing down the entire system. <div>
<br></div><div>As far as the dropped messages go, I'm sending separate messages by packing the data and sending it to a single [trigger $1 $2{ message box. I'll try sending separate messages to see if that helps.<div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 6:24 PM, Roman Haefeli <span dir="ltr"><<a href="mailto:reduzent@gmail.com" target="_blank">reduzent@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, 2013-09-10 at 01:53 -0400, Epic Jefferson wrote:<br>
> To control solenoids with dynamics, I adapted Reduzent's<br>
> [Solenoiduino] abstraction and arduino sketch to include the TLC5940<br>
> functions, which is what the Practical Maker PWM shield is based on.<br>
> So far, I'm able to control 44 solenoids using custom drivers and 2<br>
> stacked PWM shields. This is an excellent alternative if you want to<br>
> build a relatively cheap electro-mechanical piano setup.<br>
><br>
><br>
> The problems i've run into:<br>
</div>> 1. if 2 or more messages get sent simultaneously, one of them<br>
<div class="im">> might get dropped (this happens a lot)<br>
<br>
</div>This shouldn't happen and actually never happened in my own experience.<br>
A single 2-byte message sets and one pin to HIGH and sets a timer for </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
that pin. So, if you need two set two pins simultaneously, you need to<br>
send two 2-byte messages. I don't see how the code could omit a message,<br>
unless two subsequent messages set the same pin.<br>
<br>
If you modified the code, you can send me a copy, so I'll look into it.<br>
<br>
> 1. the handshake does not seem to work on Linux (Ubuntu 11)<br>
<br>
It's pretty crude. Whenever you send it a '255' (0xff) byte, it responds<br>
with the following ASCII sequence: 'SOL 0 1'. You can easily test that<br>
with [comport] directly.<br>
<br>
The ugly thing is that [solenoiduino] has to make sure not to send any<br>
0xff bytes and thus some values for periods are not allowed / replaced,<br>
e.g 127, 255, 383 etc.<br>
<br>
> 1. the original code only supports 16 solenoids<br>
<div class="im">> This last one is the one that goes over my head, since the code uses<br>
> that bit twiddling stuff, I can't figure out how to send the<br>
> appropriate messages to any solenoids past 15. So, I'm a little stuck<br>
> here, any help?<br>
<br>
</div>The solenoiduino code uses two bytes per message, while the first bit of<br>
each is used for defining the byte order. This leaves 14 bits for the<br>
payload. The current implementation uses 4 bits for the pin address and<br>
10 bits for the duty cycle. If you can live with a lower duty cycle<br>
resolution, you can shift some bits around. For instance, you could<br>
adapt the bitmask to use 6 bits for the address (allows to control 64<br>
solenoids) and use only 8 bit for the velocity / duty cycle.<br>
<br>
Alternatively, you could extend the protocol to use 3 bytes per message.<br>
This would give you a payload of 21 bits to be distributed between<br>
address and duty cycle. Of course, this reduces your maximum message<br>
rate by 1.5.<br>
<br>
Roman<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
<a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><a href="http://www.epicjefferson.com" target="_blank">www.epicjefferson.com</a><br><a href="http://www.avmachinists.org" target="_blank">www.avmachinists.org</a> Puerto Rico based Art Collective/ Non-Profit Org
</div></div></div>