Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dnl

Pages: 1
1
I'm using a TinyZero with the WiFi (WINC1500) Tiny Shield in a cloudless monitoring project. While porting the code from an Adafruit platform to Tiny Circuits devices, I saw the WiFI driver interacted with the builtin LED (LED_BUILTIN). There's no such interaction with the Adafruit WINC1500 device.

I isolated the problem using the WiFi sample code at https://learn.tinycircuits.com/Communication/WiFi_TinyShield_Tutorial/. I added code to turn the builtin LED on at the start of setup(); the LED is turned off when WiFi.begin() is called (also WiFi.status()). The LED cannot be turned on again after the call. WiFi.setPins() does not affect the LED. Modulo this interaction, the example code works as expected. My much larger monitoring project also works as expected, which includes AP and client modes (the latter uses SSL).

I don't see any mention of this in the compatibility matrix at https://tinycircuits.com/pages/tinyduino-overview.

Please advise.

2
I am successfully using the GPS Tiny Shield with a TinyZero. These are the relevant lines from my code:

Code: [Select]
...
#include "GPS.h"
#include "SoftwareSerialZero.h"
TinyGPS GPS;
SoftwareSerial swuart( GPS_RXPin, GPS_TXPin );
...

void setup() {
    ...
    // GPS
    swuart.begin( GPSBaud );
    gpsInitPins();
    delay( 100 );   // delay() is EVIL when GPS is in use
    gpsOn();
    delay( 100 );   // delay() is EVIL when GPS is in use
    // Drain the GPS module's pent-up data
    while( swuart.available() )
        swuart.read();
    ...
}

void loop() {
    int year;
    byte month, day, hour, minute, second, hundredths;
    unsigned long age;
    float flat, flon;

    ...
    GPS.crack_datetime( &year, &month, &day, &hour, &minute, &second, &hundredths, &age );
    if( age != TinyGPS::GPS_INVALID_AGE ) {
        ...
    }
    GPS.f_get_position( &flat, &flon, &age );
    if( age != TinyGPS::GPS_INVALID_AGE ) {
        ...
    }
}

I use the GPS in a widget that provides data for astrophotography, including the current GMT and location among other data. It will take 5 to 10 minutes to get a fix when it's first used after a long time. The next night, however, it will get a fix within 30 seconds.

HTH
--
dnl

3
A note for future users of the Bluetooth Low Energy TinyShield (ST). The tutorial demonstrates using nRF UART v2.0. The Android app does not appear to be current and fails. Fortunately, I did suceed with nRF Toolbox and its Universal Asynchronous Receiver/Transmitter (UART) function.  To use, select the funtion, press All when the scanner starts, select BlueNRG, et voilà!

Quote
General Discoverable Mode.
Connected to device:79-42-45-07-1A-48
12 : Hello, world


I also tried Serial Bluetooth Terminal, but it returns a message Connection failed: no write characteristic (4/16).

HTH
--
dnl

4
PEBKAC

I had a stray unit test program file in the directory that contained a main program.  :(

Removing the file and rebuilding the program allowed the USB device to appear.

5
I was working with a TinyZero processor and all was well. Could reliably turn the device on and off and the USB device, 03eb:8008, would always show up and be recognized as /dev/ttyACM0. I could also repeatedly compile and install a program. This worked with or without your 150mAh battery attached.

Here's the relevant USB device data from usb-devices(1):
Code: [Select]
T:  Bus=01 Lev=02 Prnt=02 Port=05 Cnt=04 Dev#= 14 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=02(commc) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=03eb ProdID=8008 Rev=01.10
C:  #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=0mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=00 Driver=cdc_acm
I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm

At some point, this stopped. The USB device now appears if and only if I use the reset button. It will remain present as long as I don't turn the TinyZero off. It will also remain present until the program installation is complete. Once I turn it off, or install a program, the USB device is no longer present.

The program that I installed does work regardless of the state of the USB device. I've been using your TinyScreenBasicButton program to try to debug this problem.

I've done this on multiple Linux hosts using different OS versions. Both worked hosts earlier, and now both behaves identically. That is, this is NOT a host issue.

This happens with or without your 150mAh battery attached

It appears the initialization sequence without the reset sequence is  corrupted so that the USB device doesn't initialize even though the installed program does work.
Is there some deeper reset I can do?
Is there a way to flash the bootloader again?

Please advise?

6
TinyDuino Processors & TinyShields / Re: TinyZero + GPS + Analog
« on: March 23, 2022, 12:53:52 PM »
I've thought about publishing it somewhere. Here are some images of the final gadget and its GUI, which continually updates while connected. Though the screenshot is from a Linux system, it will be run from a Windows laptop.

7
TinyDuino Processors & TinyShields / Re: TinyZero + GPS + Analog
« on: March 21, 2022, 08:26:15 PM »
My project is now complete once I found the reason why my analog sensor wasn't working. My first choice was a TMP36, an analog thermal sensor; I used your Temperature Sensor Wireling instead.

The complete stack is:
  • ASM2021-R, TinyZero
  • ASD2501-R , GPS
  • ASD2511-R-P, Barometric Pressure
  • ASD2009-R-T, Tinyshield Proto Board
  • AST1021, Temperature Sensor Wireling
I didn't use the temperature sensor on the ASD2511 as it reflects board temperature, not true ambient.

The code running on the TinyZero will support either the proto board or the Wireling Adapter. As I only needed one wireling for this project, I opted to connect it via the proto board. I also wrote a Python GUI that displays the data so it can be copied into other astrophotography applications.

8
TinyDuino Processors & TinyShields / TinyZero + GPS + Analog
« on: March 20, 2022, 12:32:09 AM »
I'm building a gadget to produce some values needed for astrophotography. A GPS is the key item, and the ASD2501-R is working fine. Woohoo!

I was trying to add an analog sensor, but I could not get sensible values on A3 or A0. A test code that read the sensor reported correct results for both A/D inputs. Adding that identical code to a program using the GPS produced nonsensical results regardless of the input. Debugging eventually lead me to this call:

Code: [Select]
SoftwareSerial swuart( GPS_RXPin, GPS_TXPin );

It seems that executing the above was the source of my A/D problems. Worse yet, the effect lingers even when the known-good test code was reloaded. Turning the TinyZero off and then restarting restored correct A/D function.

As grep is my friend, it now appears an analog sensor is a non-starter as all the analog inputs are consumed by the GPS (GPS_TXPin = A0, GPS_RXPin = A1, GPS_SYSONPin = A2, GPS_ONOFFPin = A3) and I2C (SDA = A4, SCL = A5).

Please advise.


9
Wirelings / Re: RobotZero and stepper
« on: February 28, 2022, 06:34:51 PM »
I wasn't able to get the RobotZero to drive the steppers. The steppers worked OK on another platform.
I gave up on the RobotZero for the steppers. :(

I do have a nice GPS gadget running on a TinyScreen+. I've ordered a barometric pressure TinyShield and temperature Wireling to make an astrophotography gadget (UTC, Lat, Lon, barometric pressure, temp).

10
Wirelings / Re: RobotZero and stepper
« on: February 14, 2022, 02:03:07 PM »
I used a 3.7v battery and stepper motors from TinyCircuits; the motor are labeled "5V DC  25Ω".

Can/should/must I use a 5V battery to power the RobotZero when the steppers are used?

11
Wirelings / Re: RobotZero and stepper
« on: January 28, 2022, 05:31:50 PM »
I downloaded, built, loaded, and ran the code.
No stepper love. I suppose it's the HW...

12
Wirelings / Re: RobotZero and stepper
« on: January 27, 2022, 07:41:57 PM »
Thanks for looking into this!

For the above, I just uncommented the other setMotor() calls.
Code: [Select]
void goForward(){
  setMotorCurrent(100);
  setMotor(1, 10);
  setMotor(2, -10);
}

void stopMotors(){
  setMotorCurrent(1);
  setMotor(1, 0);
  setMotor(2, 0);
}
Sadly, no stepper love.

13
Wirelings / Re: RobotZero and stepper
« on: January 27, 2022, 02:14:15 PM »
[Post comment:  The "SPAM" protection and my Chrome browser hate each other. I have to post with empty code blocks and edit to add the code. This happened on the 1st post, too. The error claims Javascript needs to be enabled, but it is.]

I took the original, commented out all but the stepper code and added 2 lines to show sketch progress.
Code: [Select]
/**********************************************************************
 * RobotZero Peripheral Basics
 * This program illustrates the abilities of the RobotZero processor
 * board by spinning any attached motors or servos, while reading the
 * accelerometer data of the onboard 9-Axis sensor and Color
 * Sensor data for a Color Sensor Wireling attached to port 0.
 *
 * NOTES:
 *   - Serial Monitor must be open for program to run.
 *   - Battery must be plugged in to power motors.
 *
 * Hardware by: TinyCircuits
 * Written by: Ben Rose & Laveréna Wienclaw for TinyCircuits
 *
 * Initialized: June 2019
 * Last modified: Jan 2020
 **********************************************************************/

#include <Wire.h>
//#include <MotorDriver.h> // Download latest here: https://github.com/TinyCircuits/TinyCircuits-TinyShield_Motor_Library/archive/master.zip
//#include <Wireling.h>
//#include "Adafruit_TCS34725.h"  // The library used for the Color Sensor Wireling

//MotorDriver servo(15);// Value passed is the address- RobotZero is always address 15
#define SerialMonitorInterface SerialUSB // for SAMD21 processors
//int aX, aY, aZ, gX, gY, gZ, mX, mY, mZ, tempF; // 9-Axis variables
//uint16_t r, g, b, c, colorTemp, lux; // Color Sensor Wireling variables

//Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);

void setup() {
  // Enable and Power Wireling
  //Wireling.begin();
  //Wireling.selectPort(0);

  SerialMonitorInterface.begin(9600);
  while (!SerialMonitorInterface); // Halt everything until Serial Monitor is opened
  Wire.begin();

  // Initialize stepper motor driver
  stepperInit();

  // Initialize 9-Axis Sensor
  //IMUInit();
  delay(100);

  // Initialize servo driver
  //if(servo.begin(20000)){
    //while(1);
    //SerialMonitorInterface.println("Servo driver not detected!");
  //}

  // Initialize Color Sensor Wireling
  //if (tcs.begin()) {
    //SerialMonitorInterface.println("Found sensor");
  //} else {
    //SerialMonitorInterface.println("No TCS34725 found ... check your connections");
    //while (1);
  //}
}

void loop() {
  //tcs.setInterrupt(false); // Turn onboard Color Sensor Wireling LEDs off

  // Motors go forward
  SerialMonitorInterface.print( "Start..." );
  goForward();
 
  // Command all Servos to rotate
  //servo.writeCommand(COMMAND_SERVO_1,1000);
  //servo.writeCommand(COMMAND_SERVO_2,1000);
  //servo.writeCommand(COMMAND_SERVO_3,1000);
  //servo.writeCommand(COMMAND_SERVO_4,1000);
  delay(1000); //delay to allow motors and servos to move
 
  //tcs.setInterrupt(true); // Turn onboard Color Sensor Wireling LEDs on

  //SerialMonitorInterface.println(" ");
  //tcs.getRawData(&r, &g, &b, &c);
  //colorTemp = tcs.calculateColorTemperature(r, g, b);
  //lux = tcs.calculateLux(r, g, b);

  //SerialMonitorInterface.print("Color Temp: "); SerialMonitorInterface.print(colorTemp); SerialMonitorInterface.print(" K, ");
  //SerialMonitorInterface.print("Lux: "); SerialMonitorInterface.print(lux, DEC); SerialMonitorInterface.print(", ");
  //SerialMonitorInterface.print("R: "); SerialMonitorInterface.print(r, DEC); SerialMonitorInterface.print(", ");
  //SerialMonitorInterface.print("G: "); SerialMonitorInterface.print(g, DEC); SerialMonitorInterface.print(", ");
  //SerialMonitorInterface.print("B: "); SerialMonitorInterface.print(b); SerialMonitorInterface.print(", ");
  //SerialMonitorInterface.print("Clr: "); SerialMonitorInterface.print(c, DEC);
  //SerialMonitorInterface.println(" ");
 
  SerialMonitorInterface.println( "Stop" );
  stopMotors();
  //servo.writeCommand(COMMAND_SERVO_1,2000);
  //servo.writeCommand(COMMAND_SERVO_2,2000);
  //servo.writeCommand(COMMAND_SERVO_3,2000);
  //servo.writeCommand(COMMAND_SERVO_4,2000);
  delay(1000);

  // Read and print 9-Axis Accelerometer and Temperature data
  //(gyro and magentometer data can also be printed using the gX, gY, gZ, mX, mY, and mZ variables)
  //IMURead();
  //SerialMonitorInterface.print("X: ");
  //SerialMonitorInterface.print(aX);
  //SerialMonitorInterface.print(" Y: ");
  //SerialMonitorInterface.print(aY);
  //SerialMonitorInterface.print(" Z: ");
  //SerialMonitorInterface.print(aZ);
  //SerialMonitorInterface.print(" Temp: ");
  //SerialMonitorInterface.println(tempF);
}

void goForward(){
  setMotorCurrent(100);
  setMotor(1, 10);
  //setMotor(2, -10);
}

void stopMotors(){
  setMotorCurrent(1);
  setMotor(1, 0);
  //setMotor(2, 0);
}

Output occurs, but no stepper  movement. Tried with and without battery, tried both steppers in "motor 1" port.
Code: [Select]
$ arduino-cli monitor -p /dev/ttyACM0
Connected to /dev/ttyACM0! Press CTRL-C to exit.
Start...Stop
Start...Stop
Start...Stop
Start...Stop
Start...Stop
Start...Stop
Start...Stop

Cluebats still most welcome.


14
Wirelings / Re: RobotZero and stepper
« on: January 27, 2022, 01:29:49 PM »
That is the original source.

Sorry I wasn't clear. The stepper.ino file is present. The code compiles, links, downloads, and executes. Just no motor movement.

I removed everything unrelated to the steppers from setup() and loop() and "inlined" goForward() and stopMotors() functions to focus on the details for motor 1. I did the same type of pruning to use the IMU, and that functions perfectly.

But sure, I'll try it again.

15
Wirelings / RobotZero and stepper
« on: January 25, 2022, 10:59:05 PM »
I saw the StarTracker tutorial and decided to try that out. I tried to build the RTC_GPS_IMU code, but soon found myself in dependency despair.

To make progress, I decomposed the effort into the IMU, steppers, and GPS. The IMU code works a treat!

The stepper motors, however, are just not moving.

The serial output appears as expected, but the motor doesn't actually move. I've tried the RobotZero with just the USB cable and USB + 1500mAh battery. I've tried the Motor1 and Motor2 ports with the appropriate code changes.

Code: [Select]
/**********************************************************************
 * RobotZero Peripheral Basics
 * This program illustrates the abilities of the RobotZero processor
 * board by spinning any attached motors while reading the
 * accelerometer data of the onboard 9-Axis sensor.
 *
 * NOTES:
 *   - Serial Monitor must be open for program to run.
 *   - Battery must be plugged in to power motors.
 *
 * Hardware by: TinyCircuits
 * Written by: Ben Rose & Laveréna Wienclaw for TinyCircuits
 *
 * Initialized: June 2019
 * Last modified: Jan 2020
 *
 * Modified by: DNL, Jan 2022
 **********************************************************************/

#include <Wire.h>

#define SerialMonitorInterface SerialUSB // for SAMD21 processors

void setup() {

  // Enable serial
  SerialMonitorInterface.begin( 9600 );
  while (!SerialMonitorInterface); // Halt everything until Serial Monitor is opened
  SerialMonitorInterface.println( "Motors" );

  // Enable Wire
  Wire.begin();

  // Initialize stepper motor driver
  stepperInit();
  delay( 100 );

}

void loop() {

  // Motors go forward
  SerialMonitorInterface.print( "Start..." );
  setMotorCurrent( 100 );
  setMotor( 1, 10 );
  delay( 1000 ); //delay to allow motors to move

  SerialMonitorInterface.println( "Stop." );
  setMotorCurrent( 1 );
  setMotor( 1, 0 );
  delay( 1000 );

}

Cluebats are most welcome!!!


Pages: 1
SMF spam blocked by CleanTalk