Collect data from mobile phone

In my school lessons, I use the Arduino SJ app for data collection. This app is designed to gather and graph data from various sensors on a mobile phone, such as light, motion, sound, and more. My question revolves around the possibilty to directly collect mobile phone sensor data into Snap! I attempted to use the web serial library, but unfortunately, I did not achieve success.

Well in Snap they have JavaScript and you can run it by licking the gear icon then JavaScript extensions then go to operators drag the JavaScript block out and then drag out the run and then you know the rest. And if you do not know JavaScript here is an script
// Check if the browser supports the necessary APIs
if ('DeviceMotionEvent' in window) {
// DeviceMotionEvent is supported
window.addEventListener('devicemotion', handleMotionEvent);
} else {
console.error('DeviceMotionEvent is not supported');

if ('DeviceOrientationEvent' in window) {
// DeviceOrientationEvent is supported
window.addEventListener('deviceorientation', handleOrientationEvent);
} else {
console.error('DeviceOrientationEvent is not supported');

// Function to handle motion events
function handleMotionEvent(event) {
// Access acceleration and rotation rate data
const acceleration = event.acceleration;
const rotationRate = event.rotationRate;

// Do something with the sensor data
console.log('Acceleration:', acceleration);
console.log('Rotation Rate:', rotationRate);


// Function to handle orientation events
function handleOrientationEvent(event) {
// Access orientation data
const alpha = event.alpha; // Z-axis rotation
const beta = event.beta; // X-axis rotation
const gamma = event.gamma; // Y-axis rotation

// Do something with the sensor data
console.log('Alpha:', alpha);
console.log('Beta:', beta);
console.log('Gamma:', gamma);


Do you mean Arduino Science Journal?
It seems to be a standalone application with off-line export and some form of proprietary cloud sharing.

You are probably looking for something like PhoneIOT - a mobile agent integrated with the Netsblox. I'm not sure if it can be used for :snap: .

There is another, more generic, Pyphox app with the Wifi remote interface.

Thank you, yes it is the app Arduino Science Journal. I will have a look at all your suggestions. I came across Cedalo streamsheets Link to stream Mobile phone sensor data directly into a spreadsheet For my students, this would be very helpful to get this done from within Snap!.

The Netsblox PhoneIOT looks very promising. :grinning:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.