arduino analog input

363 views
Skip to first unread message

KPerks

unread,
Jun 29, 2021, 11:50:28 AM6/29/21
to Bonsai Users
Hello,
My setup is the following:
I have standard firmata uploaded to my arduino uno. The uno has an amplifier shield on it such that the analog input of the uno should be the amplified signal from the shield. 

I am able to control the digital output pins of the arduino appropriately (I can make LEDs on the shield light up that are controlled by digital output). 

However, I cannot figure out how to handle the Analog Input node. I have set the port appropriately (according to what I use for the digital output) and the channel is '0' for the analog input channel 0 (A0) of the uno. I was expecting it to have a MatVisualizer, which I do not see available.  Neither time series or text visualizer produce anything when I run the workflow. 

I searched the google groups conversations but cannot find any threads on analog input from Arduino. Let me know what you think I am missing to make this work and any threads that you think would help me. Thanks!
EEG_BackyardBrains.bonsai

KPerks

unread,
Jun 29, 2021, 11:56:48 AM6/29/21
to Bonsai Users
So... I don't know what happened. But it is working now. I tried several times in several different configurations before posting. I did not change anything before the last time I tried and it did not work and next time that I tried and it did.... So I don't know what magic happened to enable it to work now. The visualizer is still 'Time Series' visualizer. But that is ok. I will leave this post here so that my example workflow exists in the group forum in case it is helpful to anyone else. Let me know if there are obvious edits that I could make to make things more clean.

I am going to try to read multiple analog input in and combine the channels into a single MatrixWriter node. I am sure I will have questions on that and will add those questions to this thread.

Thanks! 

Gonçalo Lopes

unread,
Jul 4, 2021, 7:45:46 PM7/4/21
to KPerks, Bonsai Users
Hi Krista,

Not sure if this fixes it, but one tricky bit about the current Arduino module is the CreateArduino node should be declared before everything else in the workflow to make sure that the connection is established before you try to access any input nodes. If you don't do this, then the nodes will try to create the connection themselves with whatever is already configured in the system.

I'm attaching an updated version which should hopefully be more reliable.

image.png

Hope this helps!

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/2f942e93-85e6-4bcf-8b7a-ec3fda7ad397n%40googlegroups.com.
EEG_BackyardBrains.bonsai

KPerks

unread,
Jul 8, 2021, 2:51:09 PM7/8/21
to Bonsai Users
Thank you so much!
Ok. That makes sense. 
I will try this.

Reply all
Reply to author
Forward
0 new messages