Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
Snoz  
#1 Posted : Wednesday, February 21, 2018 4:07:51 AM(UTC)
Snoz

Rank: Newbie

Groups: Registered
Joined: 2/21/2018(UTC)
Posts: 2

Was thanked: 2 time(s) in 2 post(s)
Hello,

I'm wondering if Embrio can help me solve my problem. I have next to no experience with programming. I'm trying to build a device that uses an Arduino Uno to plot accelerometer data from a 9-axes motion shield on a 1.8" TFT display. I want to graph the data as close to real time as possible.

I found three example programs that I think contain everything I need to make this happen. I lack the know-how to properly combine them.

TFT Graphics test

Analog graph

9-axes shield sample: Accelerometer

From the accelerometer example I only need one axis to graph. I was thinking I could replace the potentiometer voltage in the TFT graph example with that data.

Any help is greatly appreciated.

Thanks! :)

Edited by user Wednesday, February 21, 2018 11:49:35 AM(UTC)  | Reason: Not specified

thanks 1 user thanked Snoz for this useful post.
sample@email.tst on 4/7/2024(UTC)
EmbrioAdmin  
#2 Posted : Wednesday, February 21, 2018 3:13:21 PM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
Sounds like a relatively easy project. There isn’t much more going on than combining a couple Arduino examples into one project. As you’ve no doubt found, it’s easy to find Arduino example code to interact with just about any piece of hardware, but combining them into one program can be difficult especially if you don’t have much programming experience. In Embrio, you can implement a node out of each code example and keep them isolated and encapsulated then just drag the output of your accelerometer node to the input of your graphing node.

These both seem like good nodes to add to the library so I’ll help you out with writing the nodes. I don’t have the accelerometer shield so you’ll have to do the testing. I did order one of those TFT displays to play around with, so I’ll be able to test that myself in the next few days.

To get started on learning how to make a node in Embrio, and specifically how to convert an Arduino code example into a node, you should go through the Writing Custom Nodes section of the docs.

I made a node for the NAxisMotion which just reads 2 values and sets them as outputs. The outputs are currently float values. If this node works, you’ll probably want to replace the float outputs with Activation outputs and use the transform() function to convert from the range that the sensor reads to the range of 0 to 1. Let me know if you need help with that.

The first thing I did was get the library documents from here, then I included the NineAxesMotion files and the utility folder to my project. Important note: I got a compile error that the file “utility/BNO055.h” was not found. To fix this, I copied the BNO055 files from the utility folder into the base folder, then I opened NineAxisMotion.h and replaced the < and > characters on the line #include <utility/BNO055.h> with quotes and removed “utility/”. I need to investigate to see if this can be automated when importing a file.

Next I copied and pasted code into a new node with “touches physical pin” selected. In the declaration section I added the “include” lines, and declared an instance of the NineAxesMotion object. Notice that I left out the rest of the lines from the declaration section of the example code as those variables deal with timing which Embrio handles.
For the Startup block I copied all of the code except for the Serial commands and the delays. Embrio nodes should almost never use Serial commands or delay. In an Arduino program, you use Serial.print to send back data to view in the serial monitor, in an Embrio node you would send that data to node outputs.

The Every Update command does the sensor reading and assigns the value to the two outputs. Note you can use any of the sensor read functions here, I just used two of them. Also like I said above the float outputs should probably be replaced with activation outputs.

Attached is a text file with my copy of the node (it’s too big to paste into a reply because it contains the includes). Just open the text file and copy and paste the xml into an Embrio agent. It will also add the includes to your project. Try opening a connection to your Arduino and let me know if you get data on the outputs. I was able to upload this node to my Arduino but because I don’t have the hardware I can’t test it. I’ll reply again soon with a node for the TFT output, though I might need to get my hands on one before I can do anything useful with it.
File Attachment(s):
NAxisMotion_Node.txt (2,658kb) downloaded 0 time(s).

You cannot view/download attachments. Try to login or register.
thanks 1 user thanked EmbrioAdmin for this useful post.
sample@email.tst on 4/7/2024(UTC)
EmbrioAdmin  
#3 Posted : Wednesday, February 21, 2018 8:00:42 PM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
Here is a node to draw a graph using the TFT display, open the spoiler below and copy and paste the node. I haven't tested this yet but it's pretty simple and should work fine. This display seems really cool I'm looking forward to getting mine to play with.

It's very simple, it just has 3 integer inputs for the pin setup, then one activation input. On every update, the activation is transformed from the range of the activation from 0 to 1, to the range of 0 to the height of the display. It's just a copy of the example you sent, but I replace the analogRead with the activation input.

To use this with the previous accelerometer node, you'll have to transform the sensor reading to an activation. I mentioned that in the previous message.

Let me know if you have any trouble with these nodes or with converting the sensor data to activations.

Edited by user Wednesday, February 21, 2018 8:02:17 PM(UTC)  | Reason: Not specified

thanks 1 user thanked EmbrioAdmin for this useful post.
sample@email.tst on 4/7/2024(UTC)
Snoz  
#4 Posted : Thursday, February 22, 2018 2:47:56 AM(UTC)
Snoz

Rank: Newbie

Groups: Registered
Joined: 2/21/2018(UTC)
Posts: 2

Was thanked: 2 time(s) in 2 post(s)
Wow, thank you!

I will this out when I get home from school today and let you know how it goes.
thanks 1 user thanked Snoz for this useful post.
sample@email.tst on 4/7/2024(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error